AP Series PLC Programming Manual V02.4

Chapter 1 PLC Component Table of Contents

Chapter 1 PLC Component ...... 1-1 1 Product Summary and Corresponding Programming Language ...... 1-1 2 Device Overview ...... 1-3 3 Program Memory and Parameter Structure ...... 1-6 4 Notes(Input and output processing, response lagging, dual-coil) ...... 1-9

1-0 Chapter 1 PLC Component Summary

Chapter 1 PLC Component

1 Product Summary and Corresponding Programming Language Product summary ■ AP100 :10/14 points Built-in Flash memory(4000 steps), RS485 communication. ■ AP100 Type :20 points Built-in Flash memory(4000 steps), RS485 communication. Support expansion card such as RTC card. ■ AP100 Type :30 points Built-in Flash memory(4000 steps), RS485 communication. Support expansion card such as RTC card. With an external power supply, the digital I/O could be expanded to 128 points. Can expand 56-channel analog input, 8-channel analog output. ■ AP200 Type :24/32/40/60 points Built-in Flash memory(8000 steps), RS485 communication. Support expansion card. With an external power supply, the digital I/O could be expanded to 256 points. Can expand 56-channel analog input, 8-channel analog output. ■ AP300 Type :24/32/40/60 points Built-in Flash memory(24000 steps), RS485 communication. Support expansion card. With an external power supply, the digital I/O could be expanded to 384 points. Can expand 56-channel analog input, 8-channel analog output.

Programming Method <> It refers to the sequential control instruction input with LD, AND, OUT, etc. For example: Step No. Instruction Device 0 LD X000 1 OR Y005 2 ANI X001 3 OUT Y005

1-1 Chapter 1 PLC Component Summary

<> The ladder Logic programming employs sequential control signals and device numbers, and draws sequential control circuit on the drawing. Such method represents sequential control loop with contact symbol and coil symbol, which is intuitive than the programming in the table. Thus, so it is easy to understand the content. Meanwhile, the state displayed by the loop can be used to monitor action of PLC.

<> SFC programming is the input method for sequential control design according to the flow of mechanical actions. In the peripheral equipment with personal computer and other graphics, the chart below can be used to determine flow of the sequential control.

S 0 Initial state

Transfer Start condition S 20 Rise

Upper limit State(Working procedure) S 21 Fall

Lower limit S 22 Rise

Upper limit

Return S0

The above three programmed sequential control programs are all stored in memory of PLC in instruction list (content of the instruction list). Therefore, representation and edition of the program based on any programming method can be exchanged (even if it is instruction list program, it could represent the program based on instruction by the software corresponding to SFC chart according to SFC conversion rule), as shown in the figure below.

Instruction List

Ladder logic SFC

1-2 Chapter 1 PLC Component Devices for PLC

2 Device Overview

The PLC software design requires various logic components and computing components, to finish such functions as logic computation, timing and counting assigned by the program. These components have similar functions like the hardware relay, which are called PLC devices. There are so many relays, counters and timers in PLC, and they have many normally open contacts (contact a) and normally close contacts (contact b). These contacts and coils are linked to up sequential control loop(as shown in the figure below). The arrow represents signal transfer. In addition, there is memory device used to store data in PLC——data register (D, W).

Input terminal or input connector Input relay :X Interface for receiving external switching signal of PLC is input relay . Symbol of the device is X PLC is installed with input relay with corresponding number of points.

C Auxiliary Relay: M Counter : PLC has PLC has several auxiliary many counters, relays. Timer : T Symbol of device Output relay: Y device ,Device In PLC Is C PLC Symbol is M many timers , interface for driving external load Symbol of device is output relay Is T device ,Device Symbol is Y. Status:S In PLC In PLC there are many status components, there are several output relays device. Quantity Symbol Is S

External output contact of the output relay(contact1 A) PLC is installed with output relay with corresponding number of points. Output terminal or output connector

1-3 Chapter 1 PLC Component Devices for PLC

Interpretation for Various Devices: Input/Output Relays(X, Y) Address numbers of input relay in basic units are distributed as per X000~X007, X010~X017, etc. in octal code. The coil status of output relay is driven by the program. The address numbers of the output relays are also in octal code, such as Y000~Y007, Y010~Y017, etc. As for the input/output extension module, the address numbers are also in octal code based on X and Y, which follow the order of address number of the basic units. For example, if AP-130BR-A is installed with a 8EYR extension module, the number of extension module is Y020~Y027. Except for relay X and Y which are numbered in octal code, all other devices are numbered in decimal code.

Auxiliary Relay(M) The auxiliary relay is the relay in PLC, which provide normally open and normally closed contacts in internal programming. The auxiliary relay is different from input and output relays, which can not obtain external input and can be used in program. Some holding relays can hold ON/OFF state in case of power failure for PLC.

Status Relay(S) Status relay S is an important component to form step ladder or SFC. It is the relay used as working step number represented by step ladder or SFC. When it is not used as working step number, as the auxiliary relay, it can be programmed as common contact or coil.In addition, it can be used as signal alarm for diagnosing external failure.

Timer(T) There are three timing type for the timers in PLC, namely, 1ms, 10ms, and 100ms. In the program, the timer always works with a setting value. When timing based on clock pulse accumulation, it adds the clock pulses of 1ms, 10ms and 100ms respectively. When specified setting value is reached, the output contact(normally open or closed) acts. The timer based on clock pulse can be used to detect 0.001-3276.7 seconds.

Counter(C) The counters are divided into the following types based on different applications: <> General use/Holding for power failure 16-bit counter: for counting up, range of counting: 1~32,767. 32-bit counter: for counting up/down, range of counting: -2,147,483,648~+2,147,483,647. These counters can be used as internal signal of PLC, with response speed less than 10Hz (0.1s).

1-4 Chapter 1 PLC Component Devices for PLC

<> Holding for power failure 32-bit counter: for counting up/down, range of counting: -2,147,483,648~+2,147,483,647. The counters are divided into single-phase and single counting, single-phase and double-counting, double-phase and double counting based on different counting up/down methods. The high-speed counters are distributed to specific input relays. The high-speed counter can perform 20KHz(AP100)/100KHz(AP200) /200KHz(AP300)counting, which has nothing to do with scan cycle of PLC.

Data registers(D& W), (V), (Z) The data register is the device for storing data. Data register of PLC is 16-bit (the highest bit is the symbol mark), with the range of data: -32768~32767. Combine the two registers to store 32-bit data (the highest bit is symbol mark). Range of data: -2,147,483,648~+2,147,483,647. -2,147,483,648~+2,147,483,647. Like other soft devices, the data register is classified for general use and holding in case of power failure. Z and V registers among the data registers are for indexing (address indexing). The index registers are used to change the address number(index) of the device. Z and V registers work with other devices, with the device number +V[ ] or Z[ ], for example: If V0=3,Z0=5, D100V0 is D103; C20Z0 is C25. The data register and index register can be used for indirect specifying and applied instruction of the timer and counter.

Constants (K), (H) Of values used by PLC, K represents values of decimal system, H represents values of hexadecimal system. They are used as setting values of timer and counter or operand of applied instructions.

Pointers (P), (I) The pointer is divided into branching pointer(P) and interruption pointer(I). The pointer P for branching is used to specify F00(CJ) conditional jump or F01(CALL) sub-program jump. The pointer I for interruption is used to specify input interruption, timing interruption and interruption program of counter.

1-5 Chapter 1 PLC Component Memory and Parameters

3 Program Memory and Parameter Structure

Memory Structure The PLC memory structure is as shown in the Figure. In addition, the memory devices are divided into A, B and C according to content of initialization.

●Data Register ●Index Register System ROM CPU C: For general use B:V register A: For holding in case of power failure B:Z register A: For use B: For special use A: data ●Current value register of timer A: Parameter C: For 100ms use A: For accumulative 100ms use C: For 10ms use A: For 1Ms use ●Current value register of counter C: 16-bit and 32-bit for general use A: 16-bit and 32-bit for holding in case of power failure Content of built-in A: For use of high-speed counter A:PLC Program storage device is held via battery or flash memory Via Built-in storage device of bit-device storage device parameter If expanded storage settings device is loaded, the ●Memory corresponding to the built-in storage device is contact A:Annotation OFF and one side of the C: Input relay storage box will act in C: Auxiliary relay for general use 4,000 ~ A: File register priority. A: Auxiliary relay for holding in case of 8,000 power failure steps B: Special auxiliary relay C: State for general use A: State for holding in case of power failure A: Signal alarm

Refer to the following Setting of capacity of Storage Device For the setting range of the program storage device. C: Output relay Data register and bit-device storage are in the built-in storage device of PLC. When power is OFF or RUN→STOP, the storage content is cleared, content of the device ●Timer contact, timing coil for holding in case of power failure and some special C:For 100ms use C: For accumulative 100ms use devices are held by battery or flash memory. C:For 10ms use C: For accumulative 10ms use ●Timer contact, counting coil, reset coil C: 16-bit and 32-bit for general use A: 16-bit and 32-bit for holding in case of power failure A: For use of high-speed counter

1-6 Chapter 1 PLC Component Memory and Parameters

Power is Power Memory content STOP→RUN RUN→STOP OFF OFF→ON A:Battery, flash memory backup supporting series No change storage device B:Auxiliary registers after Setting of initial M8000, data registers after Clear No change[Note] value[Note] D8000, index registers C:Other non-backup No change Clear supporting series storage Clear No change of M8033 drive device [Note]:Please pay attention to that some registers will be cleared when STOP→RUN.

Parameter Structure The parameters are used to specify range of holding in case of power failure and capacities of annotation and file registers. Setting and change of parameters can be executed via AP-PCLINK. Regarding instruction and operation details, please refer to Help of AP-PCLINK. As for the functions of the parameters, please refer to the operating manual of AP PLC .

<> 1. Available memory capacity: D8006. 2. Settings of storage range: It is used to change range of holding in case of power failure of PLC. 3. Password level: Password can be set, which is used to wrong writing pr embezzlement of programmed sequential control program. Moreover, for online operation of programming software, password can be used to set 3 protection levels. 4. Other parameters: It is used to set validity/invalidity of RUN/STOP, specify non-battery operation mode and set PC general communication.

1-7 Chapter 1 PLC Component Memory and Parameters

<> Default AP-PCLINK Item AP100 Series AP200 Series AP300 Series software Program 4K 8K 24K ⊙ Memory capacity Capacity Annotation 0 0 0 ⊙ capacity 500-1023 by 500-1023 by 500-1023 by Auxiliary default default default ⊙ Relay(M) (0-1023 is (0-1023 is (0-1023 is available) available) available) 500-999 by 500-999 by 500-999 by default default default Status(S) (0-1023 is ⊙ (0-1023 is (0-1023 is available) available) available) Holding 100-199 by range 90-99 by default 100-199 by default Counter(C) default (Holding (0-99 is (0-199 is ⊙ (16bit) (0-199 is range in available) available) available) case of 220-255 by 200-511 by power 200-255 by default Counter(C) default default failure) (200-255 is ⊙ (32bit) (220-255 is (200-511 is available) available) available) 246-255 by 246-255 by Timer(T) 246-255 by default - default default 400-511 by 200-511 by Data 200-511 by default default default registers(D, (200-511 is ⊙ (400-511 is (0-511 is W) available) available) available) Password None ⊙ Input setting of None ⊙ terminal RUN Input number of None ⊙ terminal RUN ⊙:Change available

1-8 Chapter 1 PLC Component Notes

4 Notes (Input and output processing, response lagging, dual-coil)

<>

[Input processing] Input image storage zone

[Program processing] R efresh in g o f im age storage zone of devices

[O utput processing] T ransferring to output locking zone <> The time width of input ON/OFF of PLC is longer than the cycle time of PLC. If the response lagging of input wave filter is 2ms, and the cycle time is 10ms, time of ON/OFF needs 12ms respectively. Therefore, the input pulse of 1,000/(12+12)=40Hz and above can not be processed. However, if special function and applied instruction of PLC are used, such defect will be improved.

Such input ON signal can be obtained Such input ON signal can Such input OFF signal not be obtained can not be obtained

OFF ON ON OFF

Output Input processing (Time) Scan cycle processing See the left chart, the same coil Y003 can be used multiple points. For example: take X001=ON, X002=OFF For initial Y003, for X001 is ON, the image storage zone is ON, and the output Y004 is ON as well. However, for the secondary Y003, the input X002 is OFF. Therefore, the image storage zone is rewritten as OFF.

Therefore, actual external output Y003=OFF, Y004=ON.

1-9 Chapter 2 Device Table of Contents

TOC

Chapter 2 Device ...... 2-2 1 Processing of Digits, Constants K and H ...... 2-2 2 List of Device Numbers ...... 2-4 3 Number and Function of Input / Output Relays (X/Y) ...... 2-10 4 Number and Function M of Auxiliary Relay ...... 2-14 5 Number and Function of Status S ...... 2-17 6 Number and Function of Timer T ...... 2-20 7 Number and Function of Counter C ...... 2-25 8 Number and Function of Built-in High-Speed Counter C ...... 2-32 9 Number and Function D of Data Register D ...... 2-40 9.1 Data registers(D, W) ...... 2-40 9.2 Index Registers V, Z ...... 2-44 10 Number and Function Pointer P/I ...... 2-47

2-1 Chapter 2 Device Table of Contents

Chapter 2 Device

1 Processing of Digits, Constants K and H

Processing of Digits Decimal Setting value of timer and counter(constant K). system digit Numbers of auxiliary relay M, timer T, counter C, status S and etc. (number of device). DEC Specify digit and command action K in application instruction operation (constant K). Hexadecimal Like decimal system digit, specify digit and command action K in application instruction system digit operation (constant H). HEX Specify digits of, time, counter or data register with decimal or hexadecimal system, Binary digit however, such digit is processed with binary system digits within PLC. When monitor BIN is performed on AP-PCLINK, such device can be converted into decimal or hexadecimal system digit automatically. Device numbers of the input/output relays are executed according to octonary digit Octonary system, therefore, it can be numbered 0~7、10~17、……70~77,100~107 and etc. digit OCT There is no 8 and 9 in octonary system. BCD code is used to express 0-9 of decimal system with 4-digit binary system. It is easy BCD code to process, so it is used to perform digital switch of BCD output form or monitor control of 7 codes and etc. K is the symbol used to represent integral of decimal system. K is the symbol used to represent integral of hexadecimal system. Constants K When operation related to command digit is performed on AP-PCLINK for and H programming, input with K for decimal digit and H for hexadecimal digit, such as K10, H102. E is a real number (floating-point) symbols. The main value is used to specify the E number of applications operating instructions

2-2 Chapter 2 Device Table of Contents

Conversion of digits Hexadecimal Octonary Decimal system Binary system BCD digit(OCT) digit(DEC) digit(BIN) digit(HEX) 0 0 00 0000 0000 0000 0000 1 1 01 0000 0001 0000 0001 2 2 02 0000 0010 0000 0010 3 3 03 0000 0011 0000 0011 4 4 04 0000 0100 0000 0100 5 5 05 0000 0101 0000 0101 6 6 06 0000 0110 0000 0110 7 7 07 0000 0111 0000 0111 10 8 08 0000 1000 0000 1000 11 9 09 0000 1001 0000 1001 12 10 0A 0000 1010 0001 0000 13 11 0B 0000 1011 0001 0001 14 12 0C 0000 1100 0001 0010 : : : : : : 143 99 63 0110 0011 1001 1001 Internal device Device numbers numbers except PLC BCD digit switch Main of input/output constant, Constant H, etc. Internal 7 codes Application relays input/output processing monitor relays

2-3 Chapter 2 Device Processing of Digits

2 List of Device Numbers

Device List AP100 series Input relay X X0~X377 256 points Output relay Y Y0~Y377 256 points Auxiliary M0~M499 M500~M1023 M1024~M1535 M8000~M8511 Relay 500 points for 524 points for 512 points for 512 for special M general use※ 1 holding※ 2 holding※ 3 purpose※ 4 S0~S499 500 points for general use※ 1 S500~S1023 524 points for holding※ 2 Status Relay For initialization: S0~S9; For origin return: S For alarm: S900~S999 S10~S19 T246~T249 T0~T39,T196~T199 T200~T245 4 points, 1ms T250~T255 44 points, 100ms Timer 46 points accumulation 6 points For general use※ 5 T 10ms For holding※ 3 100ms accumulation For sub-program: For general use※ 5 For sub-program: For holding※ 3 T196~T199 T246~T249 32-bit down 16-bit up counting 32-bit high-speed up/down counting counting C235~C245 C246~C249 C251~C254 Counter C0~C89 C90~C99 C220~C234 11 points 4 points 4 points C 90 points 10 points 15 points 1-phase 1-phase 2-phase For general For For 1-input 2-input 2-input use※ 1 holding※ 2 holding※ 2 For For For holding※ 2 holding※ 2 holding※ 2 D0~D399 Data Register D400~D511 D8000~D8511 400 points for general D 112 points for holding※ 2 512 for special purpose※ 4 use※ 5 Index register V0~V15, Z0~Z15 V, Z 32 points (For indirect specifying) For general use※ 5 Special F0~F1999(AP-PCLINK monitoring is unavailable) register F P0~P127 I00*~I50* I6**~I8** I010~I060 N0~N7 128 points 6 points 3 points 6 points Indicator 8 points Jumping and For interruption For time For counting N, P, I For main sub-program input interruption interruption control circuit Branching Indicator Indicator Indicator pointer Constan K 16-bit -32,768~32,767 32-bit -2,147,483,648~2,147,483,647 t H 16-bit 0~FFFFH 32-bit 0~FFFFH

2-4 Chapter 2 Device Processing of Digits

※1:Non-holding range in case of power failure Parameters are used to set and change the holding range in case of power failure. ※2:Range of holding in case of power failure Parameters are used to set and change the non-holding range in case of power failure. ※3:Fixed range for holding in case of power failure The holding range can not be changed. ※4: Refer to list of special elements. ※5:Non-holding range in case of power failure The holding range in case of power failure can't be set or change by parameters.

2-5 Chapter 2 Device Processing of Digits

AP200 series Input relay X X0~X377 256 points Output relay Y Y0~Y377 256 points Auxiliary M0~M499 M500~M1023 M1024~M1535 M8000~M8511 Relay 500 points for 524 points for 512 points for 512 for special M general use※ 1 holding※ 2 holding※ 3 purpose※ 4 S0~S499 500 points for general use※ 1 S500~S1023 524 points for holding※ 2 Status Relay For initialization: S0~S9; For origin return: S For alarm: S900~S999 S10~S19 T246~T249 T0~T199 T200~T245 4 points 1ms T250~T255 200 points 100ms Timer 46 points accumulation 6 points For general use※ 5 T 10ms For holding※ 3 100ms accumulation For sub-program: For general use※ 5 For sub-program: For holding※ 3 T192~T199 T246~T249 32-bit down 16-bit up counting 32-bit high-speed up/down counting counting C235~C245 C246~C249 C250~C255 Counter C0~C99 C100~C199 C200~C234 11 points 4 points 6 points C 100 points 100 points 35 points 1-phase 1-phase 2-phase For general For For 1-input 2-input 2-input use※ 1 holding※ 2 holding※ 2 For For For holding※ 2 holding※ 2 holding※ 2 D8000~D8511 D0~D199 D200~D511 D512~D2047 Data Register 512 points 200 points 312 points 1536 points D For special For general use※ 5 For holding※ 2 For general use※ 5 purpose※ 4 Index register V0~V15、Z0~Z15 V, Z 32 points (For indirect specifying) For general use※ 5 Special F0~F1999(AP-PCLINK monitoring is unavailable) register F P0~P127 I00*~I50* I6**~I8** I010~I060 N0~N7 128 points 6 points 3 points 6 points Indicator 8 points Jumping and For interruption For time For counting N, P, I For main sub-program input interruption interruption control circuit Branching Indicator Indicator Indicator pointer Constan K 16-bit -32,768~32,767 32-bit -2,147,483,648~2,147,483,647 t H 16-bit 0~FFFFH 32-bit 0~FFFFH ※1:Non-holding range in case of power failure Parameters are used to set and change the holding range in case of power failure. ※2:Range of holding in case of power failure Parameters are used to set and change the

2-6 Chapter 2 Device Processing of Digits non-holding range in case of power failure. ※3:Fixed range for holding in case of power failure The holding range can not be changed. ※4: Refer to list of special elements. ※5:Non-holding range in case of power failure The holding range in case of power failure can't be set or change by parameters.

2-7 Chapter 2 Device Processing of Digits

AP300 series Input relay X X0~X377 256 points Output relay Y Y0~Y377 256 points Auxiliary M0~M499 M500~M1023 M1024~M7679 M8000~M8511 Relay 500 points for 524 points for 6656 points for 512 for special M general use※ 1 holding※ 2 holding※ 3 purpose※ 4 S0~S499, 500 points for S500~S1023 Status Relay general use※1 524 points for holding※ 2 S1024~S4095 S For initialization: S0~S9 3072 points for holding※ 3 For alarm: S900~S999 For origin return: S10~S19 T0~T199, T246~T249, 4 T250~T255, 200 points points 1ms 6 points 100ms For T200~T245 T256~T511,256 accumulation 100ms Timer general use※ 46 points, 10ms points For holding※ 3 accumulatio T 5 For general use 1ms For general use n For sub- ※5 For sub- ※5 For program: program: holding※ 3 T192~T199 T246~T249 16-bit up counting 32-bit down counting 32-bit high-speed up/down counting C235~C245 C0~C99, C100~C C250~C255; C200~C234 ; C246~C249 100 199,100 C506~C508 C256~C499; C500~C505 4 points Counter points,F points 9 points C509~C511 ;17 points 1-phase C or For 2-phase 282 points 1-phase 2-input For general holding 2-input For For holding※ 2 1-input For holding※2 use※1 ※2 holding※2 holding※2 Note: Up/down counting function is unavailable for C256~C499, C509~C511. D0~D199 D200~D511 D512~D7999 D8000~D8511 Data Register 200 points 312 points 7488 points 512 points D For general use※ 5 For holding※ 2 For holding※ 3 For special purpose※4 Data Register W0~W32767 32768 points for holding※ 3 W Index register V0~V15、Z0~Z15 V, Z 32 points (For indirect specifying) For general use※ 5 Special F0~F1999(AP-PCLINK monitoring is unavailable) register F P0~P127,128 I6**~I8**, N0~N7,8 I00*~I50*,6 I010~I060,6 points points Jumping 3 points For Indicator points For points For For counting and sub-program time main control interruption input interruption N, P, I Branching interruption circuit Indicator Indicator pointer Indicator Constan K 16-bit -32,768~32,767 32-bit -2,147,483,648~2,147,483,647 t H 16-bit 0~FFFFH 32-bit 0~FFFFH ※1:Non-holding range in case of power failure Parameters are used to set and change the

2-8 Chapter 2 Device Processing of Digits holding range in case of power failure. ※2:Range of holding in case of power failure Parameters are used to set and change the non-holding range in case of power failure. ※3:Fixed range for holding in case of power failure The holding range can not be changed. ※4: Refer to list of special elements. ※5:Non-holding range in case of power failure The holding range in case of power failure can't be set or change by parameters.

2-9 Chapter 2 Device Device Numbers

3 Number and Function of Input / Output Relays (X/Y)

Input/Output Relays Numbers of input/output relays Numbers of input and output relays are made up of inherent address No. of basic unit and address No. assigned to the expansion module. The assigned address number of the expansion module is based on the fixed address number of the basic unit. These address numbers are expressed in octonary system. It will be plus 1 when it reaches 8, so there is no 8 or 9. For example, 17 and 20 are adjacent integrals in octonary system. Input/Output Relay X Relay Y Type Basic unit Expansion module Basic unit Expansion module AP-110 X000~X005 — Y000~Y003 — AP-114 X000~X007 — Y000~Y005 — AP-120 X000~X013 — Y000~Y007 — AP-130 X000~X017 X020~X157 Y000~Y015 Y020~Y157 AP-224 X000~X013 X020~X357 Y000~Y013 Y020~Y357 AP-232 X000~X017 X020~X357 Y000~Y017 Y020~Y357 AP-240 X000~X027 X030~X357 Y000~Y017 Y020~Y347 AP-260 X000~X043 X050~X347 Y000~Y027 Y030~Y327 AP-324 X000~X013 X020~X377 Y000~Y013 Y020~Y377 AP-332 X000~X017 X020~X377 Y000~Y017 Y020~Y377 AP-340 X000~X027 X030~X377 Y000~Y017 Y020~Y377 AP-360 X000~X043 X050~X377 Y000~Y027 Y030~Y377 Note: 1. AP-120 and AP-130 in AP100 series can be expanded with one expansion card, and the number of digital expansion card starts from X370 and Y370. Only AP-130 can be added or expanded with X/Y expansion module, with the 128 input/output points in total, which means the X points of main unit+ X points of expansion+ Y points of main unit + Y points of expansion ≤128. 2. Each model type in AP100 series can be expanded with one expansion card, and the number of digital expansion card starts from X370 and Y370. Each model type can be added or expanded with Y expansion module, with the 256 input/output points in total, which means the X points of main unit+ X points of expansion+ Y points of main unit + Y points of expansion ≤256. 3. AP-360 in AP300 series can be expanded with two expansion cards, while other model types can be only expanded with one expansion card. The number of digital expansion card starts from X370 and Y370. Each model type can be added with X/Y expansion module, with the 384

2-10 Chapter 2 Device Device Numbers input/output points in total, which means the X points of main unit+ X points of expansion+ Y points of main unit + Y points of expansion ≤384. Please note that: When using the digital expansion card, the number(X/Y) of the occupied digital expansion card can't be used in digital expansion module.

There are 512 points in total for X/Y relays, however, in practice the I/O modules can only use the points listed in above table as input/output. The rest output points can be used as auxiliary relays. The numbers of X/Y relays are in octonary system, such as:X000~X007, which is followed by X010 rather than X008. The input relay is the window for PLC to receive the external input switch signal. Through the optical coupler, the PLC reads and stores external signal conditions into image memory register. The input terminal is connected to external normally opened contact or closed contact and series connection or parallel connection circuits or electronic sensor made of several contacts (such as, proximity switch). In echelon, normally opened contact and closed contact of input relay can be used for many times. PLC of output relay is the window for PLC to send loading signal. The output relay is used to transmit output signal of PLC to the output module and the later one drives external loading.

Benefits and Features The following is the sketch map of PLC control system. When external input circuit of X000 terminal block is get connected, the corresponding input image memory register is “1” and “0” when it is disconnected. Status of input relay only depends on status of external input signal, which is not controlled by users’ program. Therefore, there will not be coil of input relay in echelon. When Y000 coil is connected, normally opened contact of corresponding hardware relay in output module of relay is closed, meanwhile, the external loading works. Each relay in the output module has only one normally opened contact, however, in the program, normally opened contact and closed contact of each output relay can be used for many times.

2-11 Chapter 2 Device Device Numbers

External power supply S/S C0 Program ~ instance X000 X001 X000 X000 Y000 Y000 Load Y000 X000 Y000 Normally Normally Input Input opened opened terminal contact contact terminal X000 Normally Y000 Normally closed PLC closed contact contact

Input terminal is the terminal for receiving external input switch signal. PLC input terminal is Output terminal is the terminal connected to the connected to input component X which is an outside. The output relay is the contact for external electronic relay with optical coupling features, and output (transistor, double-direction flow, The relay is it owns several normally opened contacts (Contact a) used for output terminal in PLC). The output relay on and normally closed contact (Contact b). Theses PLC has many normally opened/closed contacts and contacts are used in PLC and input relay can not be can be used at your discretion. External output contact driven in program. and internal contact can be seen below.

2-12 Chapter 2 Device Device Numbers

Action Time Sequence of Input Relay PLC controls the sequence by executing the processing sequence as below repeatedly. When massive input/output is used, the response for the drive time and computation cycle of output wave filter and output module will be correspondingly delayed.

■ Input processing Before PLC executing Input processing ① Read program,ON/OFF status of all input X000 terminal block will be read into the X001 Inp X002 image zone. ut Input ter image During program executing, in min zone al case of input change, content of input image zone will not be changed. When it is processed in the next cycle, such change will be read. In addition, even ON→OFF and Y000 ③Read OFF→ON, there will be about 10ms X000 External ④Read image delay for the input wave filter before zone M 0 judging ON/OFF. ⑤Read Y000 ■ Program processing PLC reads out ON/OFF status from input image zone or image zone of other devices according to ⑥ Output processing command of the program memory. It Output Y000 computes from step 0, then writes the Y001 results into the image zone. Therefore, Output Outpu Y002 locking t the image zone of the device shall storage termi zone nal update the content with the program execution. Moreover, the internal contacts of the output relay actions according to the content of the output image memory . ■ Output processing Once all commands have been executed, ON/OFF status of image memory of output Y is transmitted to the locking zone, which will become the actual output of PLC. For contacts for external output of PLC, the response will be delayed according to the device for output.

2-13 Chapter 2 Device Input / Output Relays

4 Number and Function M of Auxiliary Relay

Auxiliary Relay The auxiliary relay (M) is realized by device. It can not accept external input signal and also can not drive external loading. It is an internal status sign like the mid relay in the relay control system. Number of auxiliary relay M is stated blow(the number is distributed according to decimal system): Device Auxiliary Relay(M) Series type M0~M499 M500~M1023 M1024~M1535 M8000~M8511 AP100 Series 500 points for 524 points for 512 points for 512 for special AP200 Series general use※ 1 holding※ 2 holding※ 3 purpose※ 4 M0~M499 M500~M1023 M1024~M7679 M8000~M8511 AP300 Series 500 points for 524 points for 6656 points for 512 for special general use※ 1 holding※ 2 holding※ 3 purpose※ 4 ※1:Non-holding range in case of power failure Parameters are used to set and change the holding range in case of power failure. ※2:Range of holding in case of power failure Parameters are used to set and change the non-holding range in case of power failure. ※3:Fixed range for holding in case of power failure The holding range can not be changed. ※4: Refer to list of special elements.

Instance of Function and Action: PLC has many auxiliary relays. Like output relay, coil of such auxiliary relay is driven by contact of various devices in the PLC. The auxiliary relay has many electronic normally opened contacts and closed contacts, which can be used in PLC. However, such contact can not drive external loading directly, and drive of external loading shall be executed through the output relay.

For General Use In case of power failure on PLC, the common auxiliary relays and the output relays will be all OFF. If it is powered for a second time, they will be still OFF except for the input condition is ON(Connected). Distribution of auxiliary relays for general use and holding in case of power failure in AP PLC can be set and adjusted through AP-PCLINK.

2-14 Chapter 2 Device Input / Output Relays

M100 For Holding in Case of Power Failure M100 Normally opened contact Some control system is M100 Normally closed required to memorize status contact before power failure and such status will reappear for a second operation. Auxiliary relay for holding in case of power supply(also called relay for holding) is for the above-mentioned purpose. It makes use of backup battery or flash memory in the PLC for holding in case of power failure. It keeps the instant status in the second of power failure in the first scanning cycle after PLC is powered on again. If the special relay for holding power supply is taken as general auxiliary relay, RST or ZRST can be used to clear the content at the front-most of the program. In addition, when simple inter-PC link or parallel connection link is used, some auxiliary relays will be occupied as link. The left figure displays the demonstration for holding in case of power failure for M600. In the circuit, if X000 is connected, and M600 acts, it will keep action even if it is OFF. Therefore, even X000 is open due to the power failure, M600 will continue to act for a second operation. However, if normally closed contact of X001 is open for a second operation, M600 won't act. See the right figure for the resetting method by using SET and RST commands. X000 X001 X000 M600 SET M600 M600 X001 RST M600

Circuit for self-holding in case of power Setting and clearing for the circuit holding in case failure of power failure

Example of holding in case of power failure

Left limit Right limit switch switch LS1(X000) LS2(X001)

Reciprocatin Brake g platform motor As shown in the figure, when it is operated for a second time, direction of advance is the same as the direction before power failure.

2-15 Chapter 2 Device Input / Output Relays

X000 X001 Right drive M600 instruction M600

X001 X000 Left drive M601 instruction M601

X000=ON(Left limit switch) →M600=ON→Right drive→Power off→Platform stops→Operate for a second time(M600=ON)→X001=ON(Right limit switch)→M600=OFF, M601=ON→Left drive.

For special application There are 512 special auxiliary relay in the PLC. These relays have its specified functions, which are divided into two types: a. (Special auxiliary relay with contact functioning): drive coil of PLC is used, and the user can use such contact. Example: M8000: Operation monitor (Connected in operation) M8002: Initial pulse (Contacted instantly when it starts to operate) M8012:100ms period oscillation The user can not use undefined special auxiliary relay. b. (Special auxiliary relay with coil drive): the users can drive these coils for specific operation Example: M8033: Keep memory as required M8034: All outputs forbidden M8039: Constant scanning Please note that it is valid when driving and after executing END.

2-16 Chapter 2 Device Auxiliary Relay

5 Number and Function of Status S

Status The status relay is a kind of programming element for programming sequential control, which is used together with commands of STL and RET described in Chapter 4. The status relay for general use does not have the function of holding in case of power failure. The status relay for holding in case of power failure can utilize the built-in backup battery or Flash memory of PLC for storing ON/OFF status. The status number S is stated below (Distributed based on decimal system): Device Status Relay S Series type S0~S499 500 points for general use※ 1 S500~S1023 524 points for holding※ 2 AP100 Series For initialization: S0~S9; For origin AP200 Series For alarm: S900~S999 return: S10~S19 S0~S499 S500~S1023 S1024~S4095 500 points for general use※ 1 524 points for holding※ 2 AP300 Series 3072 points for For initialization: S0~S9 For origin For alarm: S900~S999 holding※ 3 return: S10~S19 ※1:Non-holding range in case of power failure Parameters are used to set and change the holding range in case of power failure. ※2:Range of holding in case of power failure Parameters are used to set and change the non-holding range in case of power failure. ※3:Fixed range for holding in case of power failure The holding range can not be changed.

Instance of Function and Action: Status S is an important device for simple programming of step control of working procedure, which is usually used with step echelon instruction STL.

For general use/holding

2-17 Chapter 2 Device Auxiliary Relay

As the step control of working procedure described in S 2 the Figure, if the starting signal X000 is ON, the status S20 Start X000 will be ON, and the electromagnetic valve Y000 for down Y000 S 20 will act. The result is that: if the lower limit switch X001 is Fall ON, the status S21 will be ON and electromagnetic valve Lower limit X001 Y001 Y001 for clamping will act. S 21 Clam If the switch X002 confirmed by clamping is ON, the p Clamping X002 status S22 will be ON. Y002 S 22 With action moving, the status will return to original Rise Upper limit X003 status automatically. After status relay for general use is powered off, it will stay in OFF status. The status relay for holding in case of power failure can store the ON/OFF status before power failure. Therefore, it can be operated from the middle of the working procedure.

Like auxiliary relay, status relay has many normally opened and closed contacts, which can be used within the X001 S10 sequential control procedure randomly. S10 In addition, if it is not used for step echelon instruction, M30 status relay S and auxiliary relay M can be used in general sequence control(As shown in the left Figure). Y005 PLC can change distribution for general use and power-off use via setting of AP-PCLINK parameters.

For signal alarm The status for signal alarm can also be used as output of external failure diagnosis.

2-18 Chapter 2 Device Auxiliary Relay

For instance, compile external failure diagnosis M8049 circuit in the figure below, monitor the content of the M8000 special data register D8049 and display minimum Y000 X000 F46 ANS T0 K10 S900 number of S900~S999.

In case of several failures, clear the failure with X001 X002 minimum number to get the number of the next F46 ANS T1 K20 S901 failure. X003 X004 If special auxiliary relay M8049 is F46 ANS T2 K100 S902 driven, the monitor will get into effective status. M8048 After driving advance outputs Y00, if the Y010 advance terminal detects that X000 does not work within 1second, S900 will be enabled. X005 F47 ANR P If the upper limit X001 and lower limit X002 do not work for more than 2 seconds, S901 will be enabled. For continuous operation mode input X003 is ON for machine with interval less than 10 seconds, if the action switch X004 does not work in one cycle, S902 will be enabled. If any of S900~S999 is ON, the special auxiliary relay M8048 will be enabled, the failure display output Y010 will act as well. External failure diagnosis program is changed into OFF by the reset button X005. Every time X005 is ON, action status of minimum number is reset one by one. When special auxiliary relay M8049 is not driven, the status of holding in case of power failure, like the common status, can be used in the sequential control program.

2-19 Chapter 2 Device Status Relay

6 Number and Function of Timer T

Number of timer Device Timer T Series type T0~T39,T196~T1 T246~T249 T200~T245 99 4 points, 1ms T250~T255 46 points 44 points, 100ms accumulation 6 points AP100 10ms For general use※ 5 For holding※ 3 100ms accumulation For general For sub-program: For sub-program: For holding※ 3 use※ 5 T196~T199 T246~T249 T246~T249 T0~T199 T200~T245 4 points 1ms T250~T255 200 points 100ms 46 points accumulation 6 points AP200 For general use※ 5 10ms For holding※ 3 100ms accumulation For general For sub-program: For sub-program: For holding※ 3 use※ 5 T192~T199 T246~T249 T246~T249 T0~T199 T200~T245 T250~T255 T256~T511 4 points 1ms 200 points 100ms 46 points 6 points 256 points accumulation AP300 For general use※ 5 10ms 100ms 1ms For holding※ 3 For general accumulation For general For sub-program: For sub-program: use※ 5 For holding※ 3 use※ 5 T192~T199 T246~T249 ※3:Fixed range for holding in case of power failure The holding range can not be changed. ※5:Non-holding range in case of power failure The holding range in case of power failure can't be set or change by parameters. Note: If it is not used as timer number of the timer, it can be also used as data register for storing data.

Function The timer accumulates the clock pulse of 1ms, 10ms, 100ms and etc. of PLC. When reaching specified setting, contact of the output will act. The setting value employs the constants K(with the range of K0~K32767)and H(with the range ofH0~H7FFF) as setting value. Besides, the content of data registers D and W can be used for indirect specifying.

For General Use

2-20 Chapter 2 Device Status Relay

As shown in the Figure below, if drive input X000 of the timer coil T200 is ON, T200 employs the clock pulse totaled 10ms of the current counter. If the value is equal to setting value K123, output contact of the timer will act. That is, the output contacts acts 1.23 seconds after coil drive. Drive input X000 is off or powered off, the timer and the output contact will be reset.

1.23?

X000 X000 K123 T200 Setting value T200 Current value Y000

Y000

For Accumulation Use As shown in the Figure below, if drive input X001 of the timer coil T250 is ON, T250 employs the clock pulse totaled 100ms of the current counter. If the value is equal to setting value K345, output contact of the timer will act. During computation, even if input X001 is cut off or powered off, when it restarts, it will continue to compute. The accumulated action time is 34.5 seconds. If reset input X002 is ON, the timer and the output contact will be reset.

t1 t2 t1+t2=34.5? X001 Accumulation X001 time T250 K345 Setting value T250 Current value Y001 X002 RST T250 Y001

X002

Note: For the accumulation timer T, if the coil is reset, but the current value doesn't reach the default value, and the timer drive input is enabled, the coil will be reset, and the timer will continue timing based on the current value.

Specifying Method of Setting Value

Specifying constant X003 As shown in the figure: T10 is the counter T10 K 100 taking 100ms (0.1S) as unit and 100 is specified as constant K(integer in decimal system). The

2-21 Chapter 2 Device Status Relay sample screen is the timer of 0.1S×100=10S. Indirect specifying D content of indirect specified data X001 F12 MOV K100 D5 register into program or input with digit switch. X003 If it is specified as memory for holding in case of T10 D5 power failure, please note that low battery D5=K100 10s counter voltage may lead to unstable value setting. Processing of Digit Device Current value of the timer can be used as value through application instruction and etc. When it is used as data device, please refer to number and function of internal counter.

Precautions in Program For sub-program and interruption program, please use T192~199(T196~T199 for AP100 series) or T246~T249 timer, which starts timing when executing coil command or END command. If timing reaches setting value, when executing coil command or END command, the output contact will act. The common timer executes coil command timing(Refer to act and precision of the timer in the following). Therefore, under some conditions, when the coil command is used for executing sub-program or interruption degree, it won't perform timing and cannot act normally. If 1ms accumulation timer is used in the sub-program or interruption program, when it reaches setting value, user shall note that when executing initial coil command, the output contact will act.

Action details and precisions of the timer Except for the timer executing interruption, timers start timing after the coil is driven. After timing,

Input processing the initial X010 coil K 12 T0 instructio T 0 n will be Y010 executed,

Timing action (if length of time is and the long, several clocks are used) Contact doesn't work X010=OFF? ON output Timer starts counting contact T0 contact works will act. {1.2 Y010 second} ON

The nth cycle The (n+1)th cycle The 1st cycle The 2nd cycle

2-22 Chapter 2 Device Status Relay

As shown in the above figure, action precision of timer contact from driving coil to finishing of the contact action, can be expressed by the following: (T-α)~(T+To) α:Correspondent with 1ms, 10ms and 100ms timer, it is 0.001, 0.01 and 0.1 second respectively. T: Setting time of timer(second) To: Scanning period(second) When programming, the timer contact shall be written before the coil command, with maximum error +2 To. When setting value of the timer is 0 and the next coil command for scanning is executed, the output contact will start acting. In addition, after 1ms interruption counter executes coil command, 1ms clock pulse counting is executed in interruption mode.

Example of Actions Output delay OFF timer

Sparkling point X001 T2 X001 K20 T1 T1 T2 T1 T2 T1 Y000 2s 1s 2s 1s K10 T2 T2 Y000 1 scan cycle In addition, F66(ALT) instruction can be used for sparkling action.

2-23 Chapter 2 Device Status Relay

<< Multiple Times Executed by Application Instruction F65 >> This instruction could be used to program output delay OFF timer, single pulse output timer and sparkling timer easily. X000 S· m D· ● Specified value m is the F65 STMR T10 K100 M0 setting value of the specified timer, which is 10 seconds in the X000 example.

10 10 ● M0 is OFF delay timer. M 0 seconds seconds ● M1 is the single pulse timer 10 10 M 1 seconds seconds after ON→OFF. ● M2 and M3 are sparkling 10 M 2 seconds timers, which act as shown in

M 3 the Figure.

X000 M 3 F65 STMR T10 K100 M0

X000

M 2

M 1

● If M3 is wired as shown in the left Figure, M1 and M2 will sparkle output. ●When X000 is changed into OFF, M0,M1 and M3 will be changed into OFF, and T10 will be reset after the time is set. ● The timer used here can not be used for other common circuits. In addition, if F64(TTMR) demonstration timer command is used, input time of the switch can be used to set time of the timer.

2-24 Chapter 2 Device Timer

7 Number and Function of Counter C

Number of counter The number of counter is stated below (Distributed based on decimal system): Counter(C) Device 32-bit down Series type 16-bit up counting 32-bit high-speed up/down counting counting C235~C245 C246~C249 C251~C254 C0~C89 C90~C99 C220~C234、 11 points 4 points 4 points 90 points 10 points 15 points 1-phase 1-phase 2-phase For For For 1-input 2-input 2-input AP100 general holding※ 2 holding※ 2 For For For use※ 1 holding※ 2 holding※ 2 holding※ 2 Note: In AP100 series, C250 and C255 are not high-speed up/down counters, which are 32-bit counters instead. C235~C245 C246~C249 C250~C255 C0~C99 C100~C199 C200~C234 11 points 4 points 6 points 100 points 100 points 35 points 1-phase 1-phase 2-phase AP200 For For For 1-input 2-input 2-input general holding※ 2 holding※ 2 For For For use※ 1 holding※ 2 holding※ 2 holding※ 2 C235~C245; C250~C255; C200~C234 C246~C249 C0~C99 C500~C505; C506~C508 C100~C199 C256~C499; 4 points 100 points 17 points 9 points 100 points C509~C511 1-phase For 1-phase 2-phase For 282 points 2-input AP300 general 1-input 2-input holding※ 2 For For use※ 1 For For holding※ 2 holding※ 2 holding※ 2 holding※ 2 Note: Up/down counting function is unavailable for C256~C499, C509~C511 in AP300 series. ※1:Non-holding range in case of power failure Parameters are used to set and change the holding range in case of power failure. ※2:Range of holding in case of power failure Parameters are used to set and change the non-holding range in case of power failure.

<>

2-25 Chapter 2 Device Timer

Counter Direction Counter Direction Counter Direction Counter Direction No. Switching No. Switching No. Switching No. Switching C200 M8200 C209 M8209 C218 M8218 C227 M8227 C201 M8201 C210 M8210 C219 M8219 C228 M8228 C202 M8202 C211 M8211 C220 M8220 C229 M8229 C203 M8203 C212 M8212 C221 M8221 C230 M8230 C204 M8204 C213 M8213 C222 M8222 C231 M8231 C205 M8205 C214 M8214 C223 M8223 C232 M8232 C206 M8206 C215 M8215 C224 M8224 C233 M8233 C207 M8207 C216 M8216 C225 M8225 C234 M8234 C208 M8208 C217 M8217 C226 M8226 —— —— Note: C200~C219 are unavailable on AP100. Features of Counter Features of 16-bit counter and 32-bit counter are stated below. It can be independently used according to direction switching and range of counting. Item 16-bit counter 32-bit counter Counting up/down (Setting as the table Counting direction Counting up above) Counting range 0~32,767 -2,147,483,648~+2,147,483,647 (Decimal system) Constant or setting in Constant or setting in data register Setting value data register (The data register shall be set by 32-bit) Change of current Without change after Change after counting up to the setting value reaching the setting value value (Circular counting) Keep acting after counting up to the Keep acting after setting value Output contact reaching the setting value Counting down should be below the setting value When executing RST instruction, current value of the counter will be Reset action zero, and the output contact will be reset. Register of current 16-bit 32-bit value

Instance of Function and Action: Distribution of status for counters for general use and holding in case of power failure can be set and changed by the parameters on AP-PCLINK.

2-26 Chapter 2 Device Timer

16-bit counter for general use/holding in case of power failure The effective setting value of the 16-bit up counter is 1~32,767 (decimal constant). The setting values K0 and K1 have the same meaning, namely, the output contacts acts at the first counting. If cutting the power supply of PLC, the counting value of the counter for general use will be cleared, while the counter for holding in case of power failure can store the counting value before power failure. Therefore, the counter can continue counting from the last value before power failure. X010 RST C 0 X011 C 0 K10 Setting value C 0 (constant) Y000 Indirect specifying

Every time the counting input X011 drives C0 coil, the current value of the counter will increase. When it executes the coil command at the tenth time, the output contact will act. After that, if the counting input X011 acts again, the current value of the counter will remain unchanged. If reset input X010 is ON, RST command will be executed, current value of the counter will be 0, and the output contact will be reset. Setting value of the counter, besides specified by constant K, can be specified by number of data register. For instance, when specifying D10, if D10 is 123, the setting method will be the same as K123. When the data above the setting value are written into current data register with MOV and other instructions, the output coil is connected at the next input and the current register will be changed into setting value.

2-27 Chapter 2 Device Timer

X010

X011 10 9 8 7 6 5 4 3 2 1 0

Y000

32-bit counter for general use/holding in case of power failure Effective range of setting value for 32-bit up/down counting is -2,147,483,648~+2,147,483,647 (Constant in decimal system ). Special auxiliary relays M8200~M8234 are used to specify direction of up/down counting.

X012 M8220

X013 RST C220

X014 C220 K-5 Setting value (constant) C220 Indirect Y001 specifying

If C*** drives M8***, it will be down counting. Otherwise, it will be up counting. According to constant K and data register D, the setting value can be positive and negative, and two consecutive data registers are used as 32-bit data. When D0 is used to specify the setting value of 32-bite counter indirectly, D0 and D1 will be combined as 32-bit setting value.

2-28 Chapter 2 Device Timer

X012 Rise Fall Rise

X013 Reset input

X014

5 4 4 3 3 2 2 1 1 Current value 0 0 0 -1 -2 -3 -3 -4 -4 -5 -5 If output is connected -6 -6 -7 -7 -8 Y001 When C220 coil is used to drive counting input X014, up/down counting is available. When current value of the counter is increased from -6→-5, the output contact will be relocated. When it is decreased from -5→-6, tht output contact will be reset.

For general use/holding in case of power failure Increasing/decreasing of the current value has nothing to do with action of output contact. However, if it counts up from 2,147, 483, 647, it will be changed to -2, 147, 483, 648. Likewise, if it counts down from -2, 147, 483, 648, it will be changed to 2, 147, 483, 647. Such action is called ring counting. If reset input X013 is ON, RST command will be executed, current value of the counter will be 0, and the output contact will be reset. When the counter for holding in case of power failure is used, current value of the counter, action of the output contact and reset status will be kept. 32-bit counter can be used as 32-bit data register. However, 32-bit counter can not be used as device element in 16-bit application instruction. When the data above the setting value are written into data register of current value with D-MOV command and etc., counting can be performed for the counting input in the future, and the contact will be relocated.

Specifying Method of Setting Value 16-bit counter

Specifying constant K 100 counting Constant (Decimal system integral) range: K100 C0 0~32,767

Indirect specifying D X001 Write content of indirect specified data register F12 MOV K100 D5 into program or input with digit switch. X003 D5 If it is specified as memory for holding in case C0 of power failure, please note that low battery

2-29 Chapter 2 Device Timer voltage may lead to unstable value setting. As shown in the left Figure: D5=K100, the count is 100.

32-bit counter

Specifying constant K 43210 counts Constant (Decimal system integral) X003 K43,210 range: C220 -2,147,483,648~2,147,483,647 Indirect specifying D X001 2 indirectly specified data memories F12 MOV K43210 D5(D6) are paired as one group. While setting X003 D5(D6) value is written by 32-bit command , do not C220 use the same data register on other program.

Response rate of the counter When the counter executes circular scanning and counting for X, Y, M, S, C and other contacts of PLC: For instance, when X011 is taken as counting input, duration for connecting and disconnecting must be longer than scanning time of PLC (generally less than 10Hz). This problem involves the KHz counting of high-speed counter by interrupting the specified input to be explained later. It has nothing to do with scanning time.

Processing of Digit Device The counter and timer act according to setting value. When the output contacts are used, counting value (current value) can be used as value for control. The structure of the current value register of the counter is as shown as below. As for numbering the counter of the operands in the application instruction, it is the same as the data register, processed as 16-bit or 32-bit data storage device.

16-bit(C) 《Structure of current value register and setting value register of counter and timer (only limited to 16 bits)》

Upper Lower position 16-bit position 0 111111110 0 0 0 0 0 0 b15 8 4 2 1

*1 64 32 16 512 256 128

Symbol 8,192 4,096 2,048 1,024 0: Positive number 16,384 1: Negative number 32-bit(C)

2-30 Chapter 2 Device Timer

Upper Lower positio 32-bit positio n n 0 11111111111111110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *1 b0 8 4 2 1

Symbol 64 32 16 0: Positive 512 256 128 8,192 4,096 2,048 1,024 16,384 number 65,536 32,768 1: Negative 524,288 262,144 131,072 8,388,608 4,194,304 2,097,152 1,048,576 67,108,864 33,554,432 16,777,216

number 536,870,912 268,435,456 134,217,728 ,073,741,824 1 *1: It is only available when it is taken as data register. << Case of application instruction >>

C20(Current value)→D10 transmission X000 F12 MOV C 20 D 10 Compare integral 100 and C30 (current X000 value) in decimal system, output the results to F10 K 100 C 30 M 0 M0~M2. X000 Convert C10 (current value) by BCD, F18 BCD C 10 K2Y000 output it toY000~Y007. Control 7-code X000 monitor. F22 MUL C 5 K 2 D4(D5) Double C5 (current value), send it to D5 X000 and D4. F12 DMOV C 220 D0(D1) C220(current value)→send it to D1, D0. X000 Compare C220 (current value) and integer F11 DZCP K100 K20000 C 220 M10 100-20,000 in decimal system, output the results to M10~M11.

2-31 Chapter 2 Device Counter

8 Number and Function of Built-in High-Speed Counter C

Number of Built-in High-Speed Counter Built-in high-speed counter of PLC is expressed as below: It is distributed on input X000~X005 and X010~X013 according to number of the counter C, which can not be used repeatedly. The input number which is not used as high-speed counter can be used as common input relay. Besides, number of high-speed counter which is not used as high-speed counter can be used as 32-bit data register for data storage.

AP Machine Type

1 phase 1 counting input 1 phase 2 counting 2 phase 2 counting input input

C235 C236 C237 C238C239 C240 C241 C242C243C244C245C246C247C248C249C250 C251 C252 C253 C254 C255

X000 U/D U/D U/D U U U A A A

X001 U/D R R D D D B B B

X002 U/D U/D U/D R R A R A R

X003 U/D R R U B B

X004 U/D U/D S D R A

X005 U/D R S R S (R) S B

1 phase 1 counting input 1 phase 2 counting 2 phase 2 counting input input

C500 C501 C502 C503 C504 C505 C506 C507 C508

X010 U/D U/D A A

X011 U/D R B B

X012 U/D U/D R A

X013 U/D R B

U : Up counting input R : Reset input A : A-phase input

D : Down counting input S : Start input B : B-phase input Note: 1. For C252, when M8170 is OFF, X002 will rest; when M8170 is ON, X005 will reset. 2. In AP100 series, C250 and C255 are not high-speed up/down counters, which are taken as common counter instead. 3. C500~C508 high-speed counting is only available in AP300 series.

Explanation of the table: ■ For 1 phase 1 counting input:

2-32 Chapter 2 Device Counter

X000 input: It could be corresponding to counting input of C235 counter(U/D), without interruption reset and interruption starting input functions. It could be also corresponding to counting input of C235 counter(U/D), without interruption reset and interruption starting input functions. Or it could be corresponding to counting input of C244 counter(U/D), which takes X001 as interruption reset(R) and X004 as interruption starting input(S), and so forth. ■ For 1 phase 2 counting input: X000 input: It is corresponding to up counting input(U) of C246 counter(U/D), which takes X001 as down counting(D) but doesn't support interruption reset and interruption starting input functions. It could be also corresponding to up counting input(U) of C249 counter(U/D), which takes X001 as down counting(D) but doesn't support interruption reset(R) and interruption starting input(S) functions, and so forth. ■ For 2 phase 2 counting input: X000 input: It is corresponding to A-phase input(A) of C251 counter(A/B), which takes X001 as B-phase input(B) but doesn't support interruption reset and interruption starting input functions. It could be also corresponding to A-phase input(U) of C254 counter(A), which takes X001 as B-phase input(B), X002 as interruption reset(R) and X005 as interruption starting input(S), and so forth. Note: The counter number C is distributed in input X000~X005(AP100/AP200/AP300), X010~X013(AP300). X000~X005 and X10~X13 can't be used repeatedly. The input number which is not used as high-speed counter can be used as common input relay. Besides, number of high-speed counter which is not used as high-speed counter can be used as 32-bit data register for data storage. If X000 is used in C235, it can not be used in C241,C244,C246,C247,C249,C251, C252,C254 and interruption I00*. Function of High-Speed Counter As shown in the table above, the high-speed counter executes interruption and performs high-speed action according to the specific input. It has nothing to do with the PLC scanning. This types of counter is 32-bit hexadecimal U/D counter, which can be divided into the following three types based on different switch method between up/down counting. Item 1 phase 1 counting input 1 phase 2 counting 2 phase 2 counting input input Specifying ON/OFF of The action of up/down While A-phase is ON,

2-33 Chapter 2 Device Counter

counting M8235~M8245 and counting input at the and B-phase turns from direction, M8500~M8505 controls input point decides the OFF→ON, it will up/down the up/down counting of up/down counter execute up counting; C235~C245 and automatically (As while it turns from C500~C505. shown in the table ON→OFF, it will above). execute down counting. By supervising M8246~M8249 , Supervise M8250~M8255,M8506~M8508, it shows the counting —— status of up counting (OFF) or down counting direction (ON). Various high-speed counters could determine the time to interrupt reset input and start to count by interruption input. 《Number of M8*** relays to switch up/down 《Number of M8*** relays to monitor up/down counting》 counting》 Type Counter Corresponding M8*** Type Counter Corresponding M8*** relay relay C235 M8235 C246 M8246 1 Phase C236 M8236 C247 M8247 2 C237 M8237 C248 M8248 Counting C238 M8238 C249 M8249 ON indicating: C239 M8239 C250 M8250 Down(DN) C240 M8240 When it is ON, C251 M8251

C241 M8241 execute: C252 M8252 OFF 1 Phase C242 M8242 Down(DN) 2 Phase C253 M8253 indicating: 1 C243 M8243 2 C254 M8254 Up(UP) Counting C244 M8244 When it is Counting C255 M8255 C245 M8245 OFF, execute: C506 M8506 C500 M8500 Up(UP) C507 M8507 C501 M8501 C508 M8508 C502 M8502 C503 M8503 C504 M8504 C505 M8505

Application Example for 1 Phase High Speed Counter

2-34 Chapter 2 Device Counter

△1 phase 1 counting input

X015 ( M8235 ) Increase/decrease X016 [ RST C235 ] Clear

● When X015 is OFF, it will execute up counting; When it is ON, it will execute down counting. ● If X016 is enabled, run RST command to reset. ● When X017 is ON, C235 will count the ON/OFF times of input X000.

X015 Rise Fall Rise

X016 Reset input

X017 Start input

X000 Count input 5 4 4 3 3 2 2 Current 1 1 value 0 0 0 -1 -2 -3 -3 -4 -4 -5 -5 If output is executed -6 -6 -7 -7 -8

C235 output contact

●Contact X015 sets up/down counting for C235. ●When the current value of the counter changes from -6 to -5, output contact of C235 will be ON; when the current value of the counter changes from-5 to -6, output contact of C235 will be cleared as OFF. ●The action of output contact is irrelevant to the increase/decrease of the current value. In up counting, 2,147,483,647 will become -2,147,483,648. Accordingly, in down counting, -2,147,483,648 will become 2,147,483,647. ●When clearing the action of contact X016, RST command will be executed. It will clear the current value of the timer as 0, and reset the output contact as OFF. ●For the high-speed counter for holding in case of power failure, the current value and ON/OFF status of the output contact will be kept even in outage.

2-35 Chapter 2 Device Counter

X010 ( M8244 ) Increase/decrease X011 [ RST C244 ] X012 ( C244 ) D0(D1)

● When X012 is ON, if the input X004 is ON, C244 will start counting immediately, and counting input of C244 is X000. The setting value in this example employs the content of the data register for indirect specifying(D1, D0). ● When X001 is closed, C244 will be reset immediately. Moreover, it could execute reset by X011 of sequential control as shown in the figure. ● M8235~M8245 ON / OFF can control C235~C245 counting direction(UP/Down).

△1 phase 2 counting input

X011 R S T C 246 X012 C246 K1234

●When X012 is ON, C246 executes up counting by turning X000 OFF→ON, and executes down counting by turning X001 OFF→ON. X011 RST C 249

X012 C249 K1234

● When X012 is ON, and X005 is ON, C249 will start counting immediately. The up counting input is X0000, and the down counting input is X001. ● When X002 is closed, C249 will be reset immediately. Moreover, it could execute reset by X011 of sequential control as shown in the figure. ● The counting direction(Up/Down) of C246~C249 can be supervised by M8246~M8249 ON/OFF. 2 Application Example for 2 Phase High Speed Counter △2 phase 2 counting input For the 32-bit counter, the current value of accumulation/down counting and the contact action are the same as the above 1 phase 1 counting input high-speed counter.

2-36 Chapter 2 Device Counter

X011 RST C251 X012 C251 K1234 C251 Y002 M8251 Y003

● When X012 is ON, C251 start counting by X000(A phase) and X001(B phase). When X011 is ON, RST command will be executed to clear C251. ● When the current value is above the setting value, Y002=ON. If it is below the setting value, Y002 will be OFF. ● When Y003 is ON, it will count down. When Y003 is OFF, it will count up accumulatively.

X011 RST C254 X012 C254 D0(D1) C254 Y004 M8254 Y005

● When X012 is ON, and X005 is ON, C254 will start counting, with the input points of X000(A phase), X001(B phase). ● When X011 is ON, C254 will be cleared by the program or X002. ● When the current value is above the setting value, Y004=ON. If it is below the setting value, Y004 will be OFF. ● When Y005 is ON, it will count down. When Y005 is OFF, it will count up. ● In this counter, when A phase is ON, B phase is turned from OFF to ON, it will judge up counting. When B phase is turned from ON to OFF, it will judge down counting. The up/down status of C250~C255 could be supervised by ON/OFF of M8250~M8255. △Action of 2 phase input signal ● 2-phase coder outputs A phase and B phase with 90° phase difference. Thus, high-speed counter could automatically execute up/down counting as shown in the Figure below. ●The 2-phase counter is taken as a counter of one time increment. A A phase phase B +1 +1 B -1 -1 Outp phase phase Time Time ut of Uplink action when it Downlink action when it rotates forwardly rotates reversely 2-37 Chapter 2 Device Counter

Counting Result When the current value of the high-speed counter reaches the setting value, please use the following application instruction if you wish to output immediately. A. <> ● After it reaches the comparison value, the interruption will be ON(Y000 ON). ●As for the output of PLC, please use the transistor machine type, because the relay type doesn't support real-time output.

B. <> ●It is the zone comparison instruction for high-speed counter.

X000 DHSZ K5 K20 C241 Y000 Comparison Compariso High-speed value 1 Output n value 1 2 counter number

K5>C241 present value →Y000 K5≤C241present value≤K20 →Y001 C241present value>K20 →Y002 The general comparison instruction FUN10(CMP) and zone comparison instruction FUN11(ZCP) are processed by PLC scanning, which will have computation delay. It is difficult to control in high-speed processing, To avoid computation delay, please use the interruption irrelevant to the scanning time. For example: Using above command could output external action directly.

2-38 Chapter 2 Device Counter

Restriction for Maximum Response Frequency Input response frequency for AP series AP100 Series AP200 Series AP300 Series Single phase (Max: Single phase (Max:100KHz)×4 Single phase (Max: 20KHz) × 6 points points & (Max:20KHz)×2 points 200KHz)×6 points & (Max: X000~X005 Dual phase (Max: Dual phase (Max:50KHz)×2 sets 20KHz)×4 points Dual phase 10KHz)×2 points & (Max:10KHz)×1 set (Max:100KHz)×3 sets & X010~X013 — — (Max:10KHz)×2 sets Regarding to hardware, the input X000~X005(AP100/AP200/AP300) and X010~X013(AP300) have the competence to accept 20KHz signal input. Due to the load capability of the software, the following suggestions and restrictions are made: When the rest functions of the system are massively used(such as: Frequent communication, long program, long scanning time, frequent interruption, pulse output, comparison instruction for high-speed counter, etc.), it is suggested lowering the maximum average frequency of the input for high-speed counter appropriately.

Common Precautions ● Regarding the contact used to drive the coil of high-speed counter, please use continuously connected contact when high-speed counting. Input number corresponding to C235 :M8000(Monitor) X000 C235 C235

When programming, please use the When the counting is specified, after the relay contact commonly used by the number is moved, the high-speed counter counter when it stops can’t count correctly. ● If the high-speed counting is performed by the device with contact such as the analog switch, the counter error may be caused by the switch vibration. Please pay attention to that. ● The number of input relay used for input of high-speed counter, could not be used together with other instructions with the same input. For example: input interruption processing(Pointer), pulse output density instruction FUN56 SPD. ● For all high-speed counters, the output point won't act as long as the counting input pulse is not assigned even if the instruction is executed when the current value is equivalent to the setting value. ● By connecting/disconnecting the input coil (OUT C***) of the high-speed counter, it could start/stop counting. The output coil requires programming on the main program. If the programming is interrupted in the circuit of step echelon, or the sub program, the counting and stopping won't be executed until running these step echelon and sub program.

2-39 Chapter 2 Device High speed Counter

9 Number and Function D of Data Register D

9.1 Data registers(D, W)

Number of Data Register The number of counter is stated below (Distributed based on decimal system): Device Data registers(D, W) Series type D0~D399 D400~D511 D8000~D8511 AP100 400 points for general 112 points for holding※ 2 512 for special purpose※ 4 use※ 5 D0~D199 D200~D511 D512~D2047 D8000~D8511 AP200 200 points 312 points 1536 points 512 points For general use※ 5 For holding※ 2 For general use※ 5 For special purpose※ 4 D0~D199 D200~D511 D512~D7999 D8000~D8511 200 points 312 points 7488 points 512 points AP300 For general use※ 5 For holding※ 2 For holding※ 3 For special purpose※ 4 W0~W32767 32768 points for holding※ 3 ※1:Range of non-holding in case of power failure Parameters are used to set and change the holding range in case of power failure. ※2:Range of holding in case of power failure Parameters are used to set and change the non-holding range in case of power failure. ※3:Fixed range for holding in case of power failure. The holding range can not be changed. ※4: Refer to list of special elements. ※5:Non-holding range in case of power failure. The holding range in case of power failure can't be set or change by parameters.

Structure and Function of Register Data register is the device element for storing data and the type is expressed as follows. These register is 16-bit (positive and negative mark for the maximum digit bit). Combine the two data register to store 32-bit data (positive and negative mark for the maximum digit bit).

16-bit (D, W) One data register (16-bit), with the digit range: -32,768~+32,767

Upper Lower position 16-bit position

0 111111110 0 0 0 0 0 0 b15 8 4 2 1

64 32 16 2-40 Symbol 512 256 128 0: Positive number 8,192 4,096 2,048 1,024 16,384 1: Negative number Chapter 2 Device High speed Counter

Readout and writing-in of data register employ application instruction. In addition, direct readout/writing-in can be executed from the unit (monitor) and programming equipment.

32-bit (D, W) Two adjacent data registers are used to express 32-bit data. (The high digit bit is a large number and the low digit bit is a small number). For example, combine D0 and D1 as 32-bit register, wherein D1 is high bit, and D0 is low bit. (In Index register, V is a high digit and Z is low digit). Therefore, it could process digits of -2,147,483,648~+2,147,483,647.

Upper Lower 32-bit position position 0 11111111111111110 0 0 0 0 0 0 0 0 0 0 0 0 0 0 b0

Symbol 8 4 2 1 64 32 16

0: Positive 512 256 128 8,192 4,096 2,048 1,024 16,384 number 65,536 32,768 524,288 262,144 131,072

1: Negative 8,388,608 4,194,304 2,097,152 1,048,576 67,108,864 33,554,432 16,777,216 536,870,912 number 268,435,456 134,217,728 1,073,741,824 When 32-bit is specified, if the following digit bit (such as D0) is specified, the number after the high digit bit (such as D1) will be occupied automatically. The low digit bit can be specified any device element of odd or even. Considering monitoring of AP-PCLINK, the following even device element number is recommended.

For general use/holding in case of power failure Once data is written into the data register, if other data will not be written, it will not change. However, in case of RUN→STOP or outage, all the data will be cleared as 0. If special auxiliary relay M8033 is driven, it can keep. Therefore, the data register for holding in case of power failure can keep the content in case of RUN/STOP and outage. AP-PCLINK parameter setting can be used to change distribution of PLC for general use and holding in case of power failure, except for special device element for holding in case of power failure. When the special data memory for holding in case of power failure is used for general use, please apply RST or ZRST commands to clear its content when starting. When inter-PC simple link or parallel connection link is used, some data registers are occupied by link.

For special application Data register for special application refers to writing in data for special purpose or writing special data into the data register in advance. When the power supply connected, it is set at the initial value. (Generally, it is cleared as 0. For the content with initial value, it will be written in by system ROM) For instance, in D8000, time of monitoring timer is initially set by the system ROM. If it is to

2-41 Chapter 2 Device High speed Counter be changed, the transmission command F12 MOV is used to write in target time in D8000. M8002 F12 MOV K250 D8000 Set monitor timer at 250ms Initial pulse Monitor timer F7 WDT refreshing Refer to program memory and parameter structure, as well the additional instructions for basic functions for the holding features of special data register in case of power failure. Refer to additional instructions for basic functions on the types of special data registers and functional description of each type.

Example of Actions There are a lot of applications for the data register, as introduced below. For more information, please refer to the specific application instructions. D0 T2 ■ It could specify the setting value of timer and counter. D20 Timer and counter set values as per specified data register. C20

Such as the action example of F12(MOV) instruction ■ Change current value of counter/timer. ■ Read current value of timer/counter into the data register. F12 MOV D5 C2 F12 MOV C10 D4

Change the current value of counter(C2) as the content of D5. Current value of counter (C10) is sent to D4. ■ Store the value in the data register. ■ Forward content of data register to other data registers. F12 MOV K8000 D10 F12 MOV D10 D20

Send content of D10 to D20. ■ Save data in the data register. Send 200 to D10 (decimal system) 16- Send 80,000 to D10(D11) (decimal system) The digits bit F12 MOV K200 D10 over 32,767 are in 32-bit, so they employ dual(D) 32- bit F12 DMOV K80000 D10(D11) instruction. If the data register is specified as low

bit(D10), the high bit D(11) will be occupied

2-42 Chapter 2 Device High speed Counter

automatically.

2-43 Chapter 2 Device High speed Counter

Take F12(MOV) instruction as an example. Send 300 to D10 (decimal system). Send the content of T10 to current value register of C20. At this time, T10 does not work as a timer but as a data register. When 32-bit is used, two 16-bit data registers (such as C0 and C1) are used to express a 32-bit counter. Moreover, 32-bit counter (such as C200) could be used to process 32-bit digits.

M8002 F12 MOV K300 T10

F12 MOV T10 C20

9.2 Index Registers V, Z

Structure and Function Like common data register, the index registers V and Z are 16-bit data registers for reading-out and writing-in data. There are 32 registers V0~V15 and Z0~Z15. Besides the same usage method as the common data register, such register can work with other device number or value in application instruction, and change device number or value in program, which is a special register. In addition, pay attention that LD, AND, OUT and other basic sequence control instructions of PLC, or device number of step echelon instruction may be used with index register together.

16-bit The two kinds of index registers V and Z have the same structure with the above data registers.

16-bit 16-bit V Z

V0~V15: 16 points Z0~Z15: 16 points

2-44 Chapter 2 Device High speed Counter

32-bit 32-bit V0(Upper position) Z0(Lower position) When processing device of 32-bit application instruction or values beyond 16-bit, Z0-Z15 must be used. See the V1(Upper position) Z1(Lower position) combination of V and Z in the left figure. AP PLC acts by taking V2(Upper position) Z2(Lower position) Z as low digit bit of 32-bit register. Therefore, even if the high bit of V0~V15 is specified, indexing can not be V3(Upper position) Z3(Lower position) realized. In addition, if it is specified as 32-bit digit, for V (high digit) and Z (low digit) are referred simultaneously. If V is at high bit, and other digits may lead to large computation error.

Even 32-bit application instruction does not exceed 16-bit digits, V14(Upper position) Z14(Lower position) writing-in of Z may also encounter the situation as shown in the V15(Upper position) Z15(Lower position) left figure. For DMOV and other 32-bit instructions, please modify V (high bit) and Z (low bit) simultaneously.

Instance of writing into 32-bit index register:

D M O V K 300 Z 2 K300— (V 2,Z2)

Device index For device that may possibly index, the content is described below: Devices and digits of decimal system: M, S, T, C, D, W, KnM, KnS, P, K. For instance: V0=K5, when D20V0 is executed, the executed device number is D25 (D20+5). In addition, the constant can be changed. For instance: For example, when K30V0 is specified, the executed element is the value K35(K30+5) of decimal system. Devices of octonary system: X, Y, KnX, KnY. For instance: Z1=K8, when X0Z1 is executed, the executed device number is X10 (X0+8: Addition of octonary system). As for device index of octonary system, content of V and Z should be converted into octonary system digits before performing addition computation. Therefore, assume Z1=K10, X0Z1 is specified as X12. Please note that this number is not X10. Value of hexadecimal system: H For instance: Constant H30V5 is specified based on V5=K30, it is regarded as H4E (30H+K30). Besides, constant H30V5 is specified based on V5=H30, it is regarded as H60 (30H+30H). Index Instance and Notes Concerning operand index and notes for application instructions, please refer to operand index of index register.

2-45 Chapter 2 Device High speed Counter

9.3 Special Register F

Function Special registers F range from F0~F1999, which are mainly applied in two instructions, FLASH STORE and FLASH LOAD.

Instance of using special register: X000 STOREP D100 F200 K3

After X0 is turned ON, the values of D100, D101 and D102 will be stored in special registers F200, F201 and F202 of FLASH. D100 F200 D101 F201 D102 F202

Note: F0~F999 and F1000~F1999 are two regions of FLASH. Thus, when the instruction in above instance is used for storage, it will read and write in these two regions of FLASH, so that the scanning cycle will be longer than that when witting in one region. Special registers F can't monitor with AP-PCLINK.

2-46 Chapter 2 Device Data Register

10 Number and Function Pointer P/I

Number of Pointer The number of pointer [P] and [I] is stated below (Distributed based on decimal system). When pointer for input interruption is used, the input code distributed to interruption can not be used for high-speed counting and pulse wave density (FUN56). For time For counting For Applicable For interruption input(10 points) interruption interruption branching Series (3 points) (6 points) Input Rising edge Falling edge X000 I001 I000 AP100, X001 I101 I100 I010 AP200, X002 I201 I200 I020 P0~P127 AP300 X003 I301 I300 I6** I030 128 X004 I401 I400 I7** I040 points X005 I501 I500 I8** I050 X010 IA01 IA00 I060 X011 IB01 IB00 AP300 X012 IC01 IC00 X013 ID01 ID00 Notes: External interruption input of AP300 Version V1.1, X10~X13, is effective . Instance of Function and Action: Function and action of pointers for branching and interruption are stated below: Almost all the pointers and application instructions can be used together. Therefore, refer to the manual for operation and instruction. Function and action of pointers for branching and interruption are stated below:

2-47 Chapter 2 Device Data Register

For branching 1. F00 (CJ)Conditional jumping 2. F01 (CALL)Call sub-program

X000 CALL P10 J Main X000 u Progr CJ P1 m am FEND p Jump

10 Mark Routin P1 sub- R progra When X000 is ON, instruction F00(CJ) will jump et to the specified position, and then the program u will be executed. SRET r END n

For interruption There are 3 types of pointer for interruption, application instruction FNC03 (IRET) for interruption return, FNC04(EI) interruption allowable and FNC05(DI) interruption forbidden, which could be combined for use. 1. For input interruption: Receiving the input signal from a specific number is not affected by PLC scanning cycle. When reading the signal, interruption sub-program will be executed When input is interrupted, signal shorter than the scanning cycle can be read. During sequence control, short time pulse wave signal can be processed in priority. 2.For time interruption:When it is the specified interrupted time cycle (3ms~99ms), the interruption sub-program will execute the interruption process at the fixed time beyond the scanning time of PLC. 3. For counting interruption: Execute interruption sub-program based on the comparison results of the high-speed counters in PLC. It is used to control the processing of counting results by high-speed counter which takes priority.

2-48 Chapter 3 Interpretation of Basic Sequential Control Instructions Table of Contents

Chapter 3 Interpretation of Basic Sequential Control Instructions ...... 3-2 1 Basic Instruction List ...... 3-2 2 Interpretation of LD, LDI, OUT and OUTI ...... 3-5 3 Instructions AND and ANI ...... 3-6 4 Instructions OR and ORI ...... 3-7 5 Instructions LDP,LDF,ANDP,ANDF,ORP and ORF ...... 3-8 6 Instruction ORB ...... 3-10 7 Instruction ANB ...... 3-11 8 Instructions MPS, MRD and MPP ...... 3-12 9 Instructions MC and MCR ...... 3-15 10 Instruction INV ...... 3-16 11 Instructions PLS and PLF ...... 3-17 12 Instructions SET and RST ...... 3-18 13 Output Reset Instructions for Counter (OUT, RST) ...... 3-19 14 Instructions NOP and END ...... 3-21 15 Instructions SMCS and SMCR ...... 3-22 16 Instructions JCS and JCR ...... 3-24 17 Notes for Programming ...... 3-26 17.1 Step and Execution Sequence of Program...... 3-26 17.2 Action of Double-coil of Double Output and Its Solution ...... 3-27 17.3 Nonprogrammable Circuit and the Solution ...... 3-29

3-1 Chapter 3 Interpretation of Basic Sequential Control Instructions Basic Instruction List

Chapter 3 Interpretation of Basic Sequential Control Instructions

1 Basic Instruction List

Basic Instruction List Symbol Function Circuit Step Initial logical operation XYMSTC [LD] contact type NO (normally 1

open) Initial logical operation XYMSTC [LDI] contact type NC (normally 1

closed)

Serial connection of NO XYMSTC [AND] 1 (normally open) contacts

Serial connection of NC XYMSTC [ANI] 1 (normally closed) contacts

Parallel connection of NO [OR] 1 (normally open) contacts XYMSTC

Parallel connection of NC [ORI] 1 (normally closed) contacts XYMSTC

Initial logical operation XYMSTC [LDP] 2 -Rising edge pulse

Initial logical operation XYMSTC [LDF] 2 -Falling edge pulse

Serial connection of rising XYMSTC [ANDP] 2 edge pulse

Serial connection of falling XYMSTC [ANDF] 2 edge pulse

3-2 Chapter 3 Interpretation of Basic Sequential Control Instructions Basic Instruction List

Symbol Function Circuit Step

Parallel connection of rising [ORP] XYMSTC 2 edge pulse

Parallel connection of [ORF] XYMSTC 2 falling edge pulse

X001 X002 Y001 Serial connection of [ANB] X003 X004 1 multiple contact circuits

X001 X002 Y001 Parallel connection of [ORB] X003 X004 1 multiple contact circuits

Store the current result of [MPS] 1 the internal PLC operations Read the current result of MPS [MRD] MRD 1 the internal PLC operations MPP Read computation results [MPP] 1 and reset

X001 INV Y001 [INV] Inverse 1

Denote the start of a master X001 [MC] MC N YM 3 control block

Denote the end of a master X001 [MCR] MCR N 2 control block

[NOP] No operation 1 [END] Program end 1

X001 [PLS] Rising edge pulse PLS YM 2

X001 PLF] Falling edge pulse PLF YM 2

[P] Indicator —

3-3 Chapter 3 Interpretation of Basic Sequential Control Instructions Basic Instruction List

Symbol Function Circuit Step [I] Interruption indicator — [OUT] Y, M : 1 [OUTI] S, Special [OUT T] XYMSTC M:2 Coil [OUT C] T:3 C:3(16bit)/ [OUT S] 5(32bit)

Set a bit device permanently X001 Y, M : 1 [SET] SET YMS ON S, Special

M:2 X001 Reset a bit device T,C:2 [RST] RST YMS permanently OFF D,W;V,Z:3

SM CS [SMCS] Master control set 1

[SMCR] Master control reset SMCR 1

JC S [JCS] Jump control set 1

JC R [JCR] Jump control reset 1

[STL] Start step ladder 1

[RET] End step ladder RET 1

3-4 Chapter 3 Interpretation of Basic Sequential Control Instructions LD/LDI/OUT/OUTI

2 Interpretation of LD, LDI, OUT and OUTI

Interpretation of instructions (1) [LD] Normally open contact and bus connection instruction, for X, Y, M, T, C and S. (2) [LD] Normally closed contact and bus connection instruction, for X, Y, M, T, C and S. (3)[OUT]Coil drive instruction used to drive one specified coil with result of logic computation. For instance: output contact, auxiliary relay, step point, output coil of timer/counter, which can not be used for input coil X, but for Y, M, T, C and S. (4) [OUTI]Inverse instruction of coil driving instruction [OUT], only for Y and M.

Programming Instance Y00 X001 1 LD X001 Y00 OUT Y001 X001 2 LDI X001 OUTI Y002

Output of Timer/Counter When instruction OUT is used for the timer and counter, the constants K and H are used to specify pre-setting values. Data registers D and W can be used to specify pre-setting values indirectly. See the following table for the setting ranges of time constant K and setting values of corresponding time:

Number Timer/Counter Setting range of value K Actual setting values of steps 1ms timer 1~32,767 0.001~32.767 seconds 3 10ms timer 1~32,767 0.01~327.67 seconds 3 100ms timer 1~32,767 0.1~3,276.7 seconds 3 16-bit counter 1~32,767 1~32,767 3 32-bit counter -2,147,483,648~+2,147,483,647 -2,147,483,648~+2,147,483,647 5

3-5 Chapter 3 Interpretation of Basic Sequential Control Instructions AND/ANI

3 Instructions AND and ANI

Interpretation of instructions (1)[AND] Normally open contact series connection instruction, for X, Y, M, T, C and S. (2)[ANI] Normally closed contact series connection instruction, for X, Y, M , T, C a n d S . ● [AND] / [ANI] instruction can be only used for series connection of single contact. The number of series connection contacts is unlimited, and cab be used repeatedly. If circuit block with two or more contacts in parallel connection is to be series connection, instruction ANB is used. Instruction ANB is the series connection instruction for circuit block in parallel connection, without target device followed.

Programming Instance

X001 X005 C022 LD X001 OR C022 C022 AND X005 OUT C022 X004 X003 C023 LD X004 ORI C023 C023 ANI X003 OUT C023

Relation of MPS and MPP If the ladder logic procedure is as shown in the following diagram, instructions MPS and MPP explained below will be used. Y003 X003 T1 Y004

M010

3-6 Chapter 3 Interpretation of Basic Sequential Control Instructions OR/ORI

4 Instructions OR and ORI

Interpretation of instructions (1)[OR] Normally open contact instruction in parallel connection, for X, Y, M, T, C and S. (2)[ORI] Normally closed contact instruction in parallel connection, for X, Y, M, T, C and S. ● When control circuits of the ladder logic is comprised of several contacts in parallel connection, instructions [OR] and [ORI] will be used. ● Instruction [OR]/[ORI] is used with said instruction [LD]/ [LDI] in parallel connection, no restriction on using times. ● Instruction [OR]/[ORI] is only used for parallel connection of single contact. If circuit block with two or more contacts in series connection is to be parallel connection, Instruction ORB is used. Instruction ORB is the parallel connection instruction for series connection circuit block, with no target device followed.

Programming Instance Parallel connection instruction of series connection circuit block ORB

X001 Y001 ORB: Instruction that makes two or more series LD X001 ORI X002 connection circuit blocks in parallel connection. X002 OR M1 OUT Y001 For circuit block with two or more M1 LDI Y001 AND X003 contacts in series connection, when the series LD M2 Y001 X003 X004 M2 AND connection circuit block is to be parallel ORB M2 M4 ANI X004 connection, instructions LD and LDI are used at OR M3 OUT M2 the start end of the branch, while instruction M3 ORB is used for terminal end of the branch.

Series connection instruction for parallel connection circuit block ANB

ANB: Instruction that connects start end of the parallel LDANB LD connection circuit block to the last circuit in series connection. OR Circuit with two or more contacts in parallel OR connection is called parallel connection circuit block. OR Instruction ANB is used for connecting parallel OR connection circuit block in series connection.

3-7 Chapter 3 Interpretation of Basic Sequential Control LDP/LDF/ANDP/ANDF/ORP/ORF Instructions

5 Instructions LDP,LDF,ANDP,ANDF,ORP and ORF

Interpretation of instructions (1) The instructions [LDP]/ [ANDP]/ [ORP] refer to the device operated by the instructions can connect one scanning cycle when triggering (OFF→ON) on the rising edge. (2) The instructions [LDF] / [ANDF] / [ORF] refer to the device operated by the instructions can connect one scanning cycle when triggering (ON→OFF) on the falling edge.

Programming Instance X001 M0 LDP X001 X002 ORP X002 OUT M0 X003 X004 M1 LDP X003 ANDP X004 OUT M1

X001 M0 LDF X001 X002 ORF X002 OUT M0 X003 X004 M1 LDF X003 ANDF X004 OUT M1

In the above chart, when X001-X004 is switched from ON~OFF or OFF→ON, M0 or M1 is only connected for one scanning cycle.

3-8 Chapter 3 Interpretation of Basic Sequential Control LDP/LDF/ANDP/ANDF/ORP/ORF Instructions

Interpretation of Actual Drive of Output Coil: The following circuits have the same drive effects.

OUT instruction and pulse instruction X010 X010 M6 PLS M6

X010

Scan cycle M6

Under two circumstances, when X010 is switched from OFF→ON, M6 is only connected for one scanning cycle.

Pulse executing form of rising edge detection and applied instruction

X020 MOV K10 D0

X020 MOV P K10 D0

When X020 is changed from OFF→ON, data is D0 is transmitted for one time, and the two procedures have the same drive effect. When logic results of the instruction MOV in previous condition are ON, the data are transmitted continuously. When the logic results are OFF, the data transmission will be stopped. When logic results of the instruction MOVP in previous condition are switched from OFF to ON, the data are transmitted accordingly. Such switches are in correspondence with times of data transmission.

3-9 Chapter 3 Interpretation of Basic Sequential Control Instructions ORB

6 Instruction ORB

Interpretation of instructions ORB: Instruction that makes two or more series connection circuits in parallel connection. ●The circuit with two or more contacts in series connection is called series connection circuit block. When it is in parallel connection, instructions LD/LDI are used at the start end of the branch, while instruction [ORB] is used for terminal end of the branch. ●[ORB] is a single instruction without device, without any device number followed. ● In multi-parallel connection circuit, if each series connection circuit uses the instruction ORB, times of parallel connection will be unlimited. [ORB] Instruction can be used continuously. At this time, times of repeated use of the instruction [LD]/ [LDI] on one bus shall be less than 8 times.

Programming Instance LD X001 AND X002 X001 X002 Y001 LD X003 AND X004 X003 X004 ORB LD X005 X005 X006 AND X006 ORB OUT Y001

3-10 Chapter 3 Interpretation of Basic Sequential Control Instructions ANB

7 Instruction ANB

Interpretation of instructions [ANB] Instruction that connects start end of the parallel connection circuit block to the last circuit in series connection. ● Circuit with two or more contacts in parallel connection is called parallel connection circuit block. Instruction ANB is used for connecting parallel connection circuit block in series connection. When it is connected to the last circuit in series connection, the instructions LD and LDI will be taken as start end of the branch circuit. After finishing parallel circuit block of the branching circuit, the instruction ANB can be used for finishing series connection of the two circuits. ●[ANB] is a single instruction without device, without any device number followed. ● When several circuits are in parallel connection, if each parallel connection block employs the instruction ANB for sequential series connection, quantity of parallel connection circuits is unlimited. The instruction [ANB] can be used collectively, but the instructions LD and LDI must be repeatedly used less than 8 times on the same bus.

Programming Instance X001 X002 X003 Y001 LD X001 OR X004 X004 X005 X006 LD X002 AND X003 X007 LD X005 AND X006 X010 ORB OR X007 ANB OR X010 OUT Y001

3-11 Chapter 3 Interpretation of Basic Sequential Control Instructions MPS/MRD/MPP

8 Instructions MPS, MRD and MPP

Interpretation of instructions (1) [MPS] (PUSH) Push instruction. (2) [MRD] (READ) Read instruction. (3) [MPP] (POP) Pop instruction. ● The group of the instructions can execute push protection for state of the contacts. When state of the contacts is required, the instruction pop will be MPP MPS executed to ensure correct connection of the following MRD circuits. ● In the PLC, there are 8 memories available for storing the middle computation results, which are equal to stacking in computer. One section of memory zone is obtained according

to the principle of first in and last out. ... ● When the instruction MPS is used one time, computation Stacking results at the moment will be stored in the first stacking unit. When MPS is used for a second time, the computation results will be stored on the stacking top. The former data will be stored to the next stacking unit. When the instruction MPP is used, the data are transmitted to the last stacking unit. After it is sprang out, the data on the stacking top will disappear from the stacking. MRD is the special instruction for reading data on the stacking to. Data in the stacking will not be transmitted. ●Instructions MPS, MRD and MPP are without device, so they are without any device number followed. MPS and MPP shall be used in pair, which shall be used less than 8 continuous times.

Programming Instance Y001 X001 X002 LD X001 MPS X003 Y002 AND X002 OUT Y001 X004 Y003 MRD AND X003 Y004 OUT Y002 MRD AND X004 OUT Y003 MPP OUT Y004 END

3-12 Chapter 3 Interpretation of Basic Sequential Control Instructions MPS/MRD/MPP

One section of stacking

X000 X001 X002 Y000 0 LD X000 1 AND X001 2 MPS Y001 3 AND X002 4 OUT Y000 X003 X004 5 MPP Y002 6 OUT Y001 7 LD X003 X005 8 MPS Y003 9 AND X004 10 OUT Y002 X006 X007 11 MPP 19 AND X010 Y004 12 AND X005 20 OUT Y005 13 OUT Y003 21 MRD X010 14 LD X006 22 AND X011 Y005 15 MPS 23 OUT Y006 16 AND X007 24 MPP X011 17 OUT Y004 25 AND X012 Y006 18 MRD 26 OUT Y007

X012 Y007

In one section of stacking, instructions ANB and ORB are applied together.

X000 X001 Y000 0 LD X000 1 MPS X002 2 LD X001 3 OR X002 4 ANB X003 X004 5 OUT Y000 Y001 6 MRD 12 ANB 7LD X003 13 OUT Y001 X005 X006 8 AND X004 14 MPP 9 LD X005 15 AND X007 10 AND X006 16 OUT Y002 X007 11 ORB 17 LD X010 Y002 18 OR X011 19 ANB X010 20 OUT Y003 Y003 X011

3-13 Chapter 3 Interpretation of Basic Sequential Control Instructions MPS/MRD/MPP

Two sections of stacking

X000 X001 X002 Y000 0 LD X000 1 MPS 8 OUT Y001 X003 2 AND X001 9 MPP Y001 3 MPS 10 AND X004 4 AND X002 11 MPS X004 X005 5 OUT Y000 12 AND X005 Y002 6 MPP 13 OUT Y002 7 AND X003 14 MPP X006 15 AND X006 Y003 16 OUT Y003

Four sections of stacking

X000 X001 X002 X003 X004 Y000 0 LD X000 8 AND X004 1 MPS 9 OUT Y000 2 AND X001 Y001 10 MPP 3 MPS 11 OUT Y001 4 AND X002 12 MPP 5 MPS Y002 13 OUT Y002 6 AND X003 14MPP 7MPS 15 OUT Y003 Y003 16 MPP 17 OUT Y004 Y004

X000 Y004 LD X000 X001 OUT Y004 Y003 AND X001 OUT Y003 X002 AND X002 Y002 OUT Y002 AND X003 X003 OUT Y001 Y001 AND X004 OUT Y000 X004 Y000

Compare the two programs. The circuit as shown in above figure requires programming with quad-MPS instruction. However, if the following circuit is used, it could be programmed conveniently without instruction MPS.

3-14 Chapter 3 Interpretation of Basic Sequential Control Instructions INV

9 Instructions MC and MCR

Interpretation of instructions (1) MC (Master Control Circuit Start) Connection instruction for public series connection contacts (new bus for public series connection contacts). (2)[MCR] (Master Control Circuit Reset) Reset instruction of MC instruction. ● The two instructions are set at the start and end points of the master control circuit block respectively. ● In the chart below, when the input X001 is ON, instructions between [MC] and [MCR] are executed. When X01 is OFF, devices between instructions [MC] and [MCR] will be in the following state: Accumulated timer/counter and devices driven by the instruction [SET]/[RST] will keep current state; the non-accumulated timer and devices driven by the instruction [OUT], will be OFF. ● After executing the instruction MC, the bus (LD and LDI) will be transferred to MC contact. To return to the original bus, the return instruction MCR is used. The instruction MC]/[MCR] must be used in pair. When using different numbers of device Y and M, the instruction [MC] can be used repeatedly. If the same device number is used, double coil output will occur like the instruction [OUT]. The instruction [MC] can be used in nested way. That is, the instruction [MC] can be used in the instruction [MC]. In this case, the number of the nested level is from small to big. When the instruction [MCR] is returned level by level, the number of nested level is from big to small.

Programming Instance X001 MC N0 M1 LD X001 MC N0 M1 X002 LD X002 Y001 OUT Y001 X003 LD X003 Y002 OUT Y002 MCR N0 MCR N0

If the instruction [MC] is used in the instruction [MC], the number of the master control point shall be from small to big (N0→N1→N2→N3→N4→N5→N6→N7). When returning, the instruction MCR is released from big to small levels. (N7→N6→N5→N4→N3→N2→N1→N0) The maximum nested level is 8 (N7).

3-15 Chapter 3 Interpretation of Basic Sequential Control Instructions INV

10 Instruction INV

Interpretation of instructions [INV] (Inverse) The instruction is expressed with one short diagonal with an inclination angle of 45°, which is to inversely obtain the computation results before the instruction. ● Instruction [INV] has no device, so it doesn't need to specify device number. The actions in the program are described as below:

Computation results before Computation results after executing the instruction INV executing the instruction INV OFF ON ON OFF

Programming Instance

X001 INV Y001

ON

X001 OFF OFF Y001 ON ON OFF

As shown in the above chart, when the input relay X001 is OFF, the output coil Y001 is ON. When X001 is ON, Y001 will be OFF. The instruction INV can be written at the same positions for inputting AND, ANI, ANDP and ANDF. The instruction INV can not be connected to bus like LD, LDI, LDP and LDF, or used independently like OR, ORI, ORP and ORF.

3-16 Chapter 3 Interpretation of Basic Sequential Control Instructions SET/RST

11 Instructions PLS and PLF

Interpretation of instructions (1) [PLS] differential output instruction is available for rising edge. (2) [PLF] differential output instruction is available for falling edge. ● The two instructions are used for pulse output for target device. When input signal changes, a pulse with width of one scanning cycle is generated. ● When the instruction [PLS] is used, if the drive input point is ON, the driven device will only action for one scanning cycle. ● When the instruction [PLF] is used, if the drive input point is OFF, the driven device Y and M will only action for one scanning cycle.

For instance: The input points X000 and X001 are ON according to the following chart. When PLC is operated as ON→ OFF→ ON, by analyzing the time sequence logic of the program, we can learn that when X000 is connected to the rising edge, M0 coil will be ON for one scanning cycle, closing of M0 normally opened will make Y001 powered as 1; when X001 is connected to falling edge, M1coil will be ON for one scanning cycle, closing of M1 normally opened makes Y001 reset as 0.

Programming Instance

X000 LD X000 PLS M0 PLS M0 M0 LD M0 SET Y001 SET Y001

X001 PLF M1 LD X001 PLF M1 M1 RST Y001 LD M1 RST Y001

X000

X001

M0 Scan cycle

M1 Scan cycle

Y001

3-17 Chapter 3 Interpretation of Basic Sequential Control Instructions SET/RST

12 Instructions SET and RST

Interpretation of instructions (1) [SET] (Set coil): Set instruction to keep the coil ON. (2) [RST] (Reset): Reset instruction to keep the coil OFF. ● By using the instructions [SET] and [RST] in program, it can set mark and clear mark for any state or time at any place for customers’ program conveniently. ● The instructions [SET] and [RST] have the function of self-holding. In the procedure as shown below, when X001 is ON, even if it is turned OFF, Y001 will stay ON. Once X002 is ON, even if it is turned OFF, Y0001 will stay ON. ●Instructions[ SET] and [RST] can be used repeatedly in any orders on the same device. However, only the lastly executed one will be valid. Other programs can be inserted between [SET] and [RST]. ●In addition to Y, M and S, the instructions [ SET] and [RST] are also available for T, C and D. That is, it can clear the values in data register D and index register. Moreover, the timer T and counter C can be reset to clear the time and counting value.

Programming Instance X001 LD X001 SET Y001 SET Y001 X002 LD X002 RST Y001 RST Y001 X003 LD X003 SET M 1 SET M1 X004 LD X004 RST M1 RST M1 X005 LD X005 SET S1 SET S1 X006 LD X006 RST S1 RST S1 X007 LD X007 RST D 1 RST D1 X001 K10 LD X001 T247 OUT T247 X007 K10 RST T247 LD X007 RST T247

X001

X002

Y001

3-18 Chapter 3 Interpretation of Basic Sequential Control Instructions OUT C/RST C

13 Output Reset Instructions for Counter (OUT, RST)

Programming Instance

X010 RST C 0

X011 K10 C0 C 0 Y000

Interpretation of logic of the above program: When the input point X011 is from OFF—ON, the counter C0 starts counting up. When the counting value reaches setting value K10, the output contact C0 acts and the output coil Y000 is ON. When X011 is from OFF—ON, the current value of the counter remains the same and the output coil Y000 is still ON. After the instruction OUT C, the constant K for counting shall be specified or the data register shall be used for specifying indirectly. Only when another input X010 is ON, will the counter C0 be reset to 0 and the output contact Y000 return.

High speed Counter Programming

X012 M*** X010 RST C***

X011 K10 C*** C*** Y2

When single-phase and single input counter C235-C245 is used, special auxiliary relay M8235~M8245 shall be used to specify the counting direction. As shown in above figure, when X012 is ON, it will be down counting; when X012 is OFF, it will be up counting. When X010 is ON, output contact of the counter C*** will return and the current value of the counter will be cleared to 0. If counter (C241, C242…) with the function of reset is used in the program, when the corresponding reset input is ON, the same effect with the above instruction can be achieved through interruption input, which doesn't require programming. When X011 is ON, counting shall be executed for the ON/Off of counting input X000-X005, which is determined by number of the counter.

3-19 Chapter 3 Interpretation of Basic Sequential Control Instructions OUT C/RST C

Current value of the counter is increasing, when it reaches the setting value, the output contact will be SET; if it is smaller than then current value, it will be RST.

3-20 Chapter 3 Interpretation of Basic Sequential Control Instructions NOP/END

14 Instructions NOP and END

Interpretation of instructions (1) NOP (No Operation) No operation instruction (or for deleting one instruction). (2) END Instruction to end the program. ● During program debugging , if the instructions NOP and END are appropriately used, it will bring convenience to users. ● NOP is a no operation instruction, and CPU will not execute the target instruction. The instruction NOP occupies one step sequence in the program. There is no corresponding device to express in the ladder logic. However, it can be reflected in the step sequence of the ladder logic. After clearing all the executing instruction programs, all the instructions will be changed to NOP. The program NOP can be inserted to minimize the times of changing the step number when the instructions are modified or added. ● As for finished program, when the instruction NOP is inserted, the program will change accordingly. Please pay attention to it.

● The instruction END is used to end the program, without target device. The instruction END can set sections during program debugging, It can insert the instruction END by section, then debug section by section. You should delete the instruction END after the debugging.

3-21 Chapter 3 Interpretation of Basic Sequential Control Instructions SMCS/SMCR

15 Instructions SMCS and SMCR

Interpretation of instructions (1) [SMCS](Start circuit branching) It is equal to one conditional bus. When the condition before the instruction is ON, the conditional bus bar will be ON. (2) [SMCR](Start circuit branching) End conditional bus. ● In the program [SMCS] and [SMCR] must be used in pair. In the program, the instruction [SMCS] can be used for many times continuously or discontinuously. It is mainly used for the positions which require several occurrences in other multiple circuits, so as to simplify the program.

Programming Instance

X001 SMCS

X002 X001 X002 Y015 Y015

X003 X001 X003 Y016 Y016

X004 X001 X004 Y017 Y017

SMCR

Instruction [SMCS] in the program can be used for many times, as shown in the figure below. Every time it is used, one condition for auxiliary bus is added. After the instruction SMCS has been used for many times, only one [SMCR] instruction can clear all the conditions.

X001 SMCS X002 X001 X002 Y015 Y015 X010 SMCS X001 X010 X003 Y016 X003 Y016 X001 X010 X004 X004 Y017 Y017

SMCR

Each instruction after [SMCS] and before [SMCR] can execute computation in CPU with

3-22 Chapter 3 Interpretation of Basic Sequential Control Instructions SMCS/SMCR the condition before SMCS. When the common circuit is pretty complicated or recurs for several times, such instruction can simplify the program. Note: OUT and application instructions cannot be after [SMCS] directly.

3-23 Chapter 3 Interpretation of Basic Sequential Control Instructions JCS/JCR

16 Instructions JCS and JCR

Interpretation of instructions (1) [JCS] Start jumping branching. (2) [JCR] Reset jumping branching.

● All the instructions after [JCS] and before [JCR] will not be executed. That is, during [JCS] conditional input is ON, content of the register will remain the same. The instruction [END] is not allowed between [JCS] and [JCR], otherwise, the error will occur to the program, and alarm indicator will be ON.

X001 JCS X001 X002 Y001 X002 Y001 X003 K50 T250 X003 X004 2s 3s RST T250 X004

JCR T250

Note 1: Pay special attention to timing signal of the timer, and the relative time relation between the input signals of counter (switch from OFF→ON) and ON/OFF state of [JCS].

JCS ABC status ② ④ ① ⑧ Input signal ③ ⑤⑥ ⑦ Y001

When X002 is in ① at the rising edge, Y001 will act, for state of[ JCS] is OFF. When the state(A) of [JCS] is OFF, the state of Y001 is determined by the input signal. When X002 is in ②③④ at the falling edge, at the rising edge, at the falling edge and ⑤ at the rising edge, Y001will not act, for state of JCS is ON. In other words, Y001 will keep ON. When JCS is ON, Y001 will not be affected by state change of ON→OFF or OFF→ON. Since the state of [JCS] is OFF (B), when X002 is in ⑥ at the falling edge, the input signal will be switched from ON→OFF, and Y001is switched from ON→OFF. When X002 is in ⑦ at falling edge, Y001 will keep the status, for [JCS] is ON at the

3-24 Chapter 3 Interpretation of Basic Sequential Control Instructions JCS/JCR moment. In ⑧ , [JCS] is from ON→OFF and the input signal is ON, so Y001 will act. Note 2: When state of [JCS] is ON, instructions that will affect positions between [JCS] and [JCR] will not be executed. Note 3: The instruction [END] between [JCS] and [JCR] will be executed certainly, which is not affected by ON/OFF state of [JCS]. At this time, execution of the program will be suspended and the next scanning cycle is entered. Note 4: Instructions [JCS] and [JCR] can be inserted between [SMCS] and [SMCR]. X000 SMCS

X001 JCS

X002 Y001

X003 K50 T250

X004 RST T250

JCR

SMCR

X000

X001

X002

Y001

X003 2s 5s X004 Current value of Current value of Current value of T250 T250 is K20 T250 is K0 T250 is K50 Note 5: Another [JCS] shall be inserted between [JCS] and [JCR], but only one [JCR] can be taken as state ending.

3-25 Chapter 3 Interpretation of Basic Sequential Control Instructions Notes for Programming

17 Notes for Programming

17.1 Step and Execution Sequence of Program

1) Ladder in the ladder logic starts from the left bus and ends in the right bus. Each row at the left side is the combination of contacts, which represents the conditions for driving logic coil. The logic coil representing the results can be only located at the right bus. The contacts can not be at the right side of the coil. 2) The contacts shall be drawn on the horizontal line rather than the vertical line. 3) When parallel connection blocks employ series connection, branch with more contacts shall be located at the left side of the ladder logic. When series connection blocks employee parallel connection, the parallel connection branch with more contacts shall be located on the upper side of the ladder logic. 4) Double-coil output is not recommended.

Structure and Step Sequence of Contacts As for circuit of the same program, the program can be simplified and the program capacity can be saved according to forming mode of the contacts .

① LD ② LD ⑤ OUT ① LD ③ AND ④ OUT

Without ③ OR ④ ANB ② OR ANB

① LD ⑤ OUT ① LD ② AND ④ OUT

Without ② LD ③ AND ④ ORB ③ LD ORB

3-26 Chapter 3 Interpretation of Basic Sequential Control Instructions Notes for Programming

Execution Sequence of Program The program is processed from up to down and from left to right. Flow of the program instruction is executed according to the block diagrams as shown below.

1 5

2 3 6 7 9 10

4 8 11

17.2 Action of Double-coil of Double Output and Its Solution

If double output (double-coil) is used in Input processing sequential control program, it will take priority in the X001=ON X002=OFF subsequent actions. X001 Initial Y003 As shown in the left chart, the same coil Y003 can be used at multiple points. Please pay attention to Y003 this situation. Y004 A second For instance: When X001=ON , X002=OFF, time X002 the RAM of Y003 is ON at the beginning, and the Y003 output Y004 is ON, for X001 is ON. At the second time, Y003 is OFF by X002, so its RAM is OFF. Output processing Therefore, actual external output is Y003=OFF, Y003=OFF Y004=ON

Y004=ON.

3-27 Chapter 3 Interpretation of Basic Sequential Control Instructions Notes for Programming

Solution for Double Output The double output does not disobey the rule in program, but the actions are very complicated. Therefore, it is recommended modifying the program based on the following instance .

AB AB Y000 Y000 CE Ignorable Ignorable CE D Y000 D

AB Or M100 CE M101 D

M100 Y000 M101

Skipping instruction and step ladder logic instruction can be used to modify the above program to the same output. When the step ladder logic instruction is used, please pay attention to the use of double output and the same output in the master program and state program .

3-28 Chapter 3 Interpretation of Basic Sequential Control Instructions Notes for Programming

17.3 Nonprogrammable Circuit and the Solution

Bridge Circuit As shown in the figure: It is the circuit that changes the direction of flow of the bi-directional loop. (parallel connection for loops without D and B)

CEB A B F F A E A E D

CD C

Connection Position of the Coil Do not write contact at the right side of the coil. Coil among contacts shall be programmed first. A AB D E C

BD E C

3-29 Chapter 4 Instructions of Step Ladder Logic Table of Contents

Chapter 4 Instructions of Step Ladder Logic ...... 4-2 1 AP-PCLINK SFC Programming Introduction ...... 4-4 2 Step Instructions STL,RET ...... 4-7 3 Action and SFC Representation of Step Ladder Logic ...... 4-11 4 SFC Features ...... 4-14 5 Prepared Knowledge for Programming SFC Flow ...... 4-16 6 Pattern of SFC Flows ...... 4-21 6.1 Skipping and Repeating Flows ...... 4-21 6.2 Combined Flow of Branching and Merging ...... 4-22 7 Function of Initial Status ...... 4-23 8 Intermediate Status Program ...... 4-24 8.1 General flow without branching and merging ...... 4-24 8.2 General States with Skipping and Repeating ...... 4-26 9 Program with Branching and Merging State ...... 4-27 9.1 Selective Branching and Merging State ...... 4-27 9.2 State of Parallel Branching and Merging ...... 4-28 9.3 Combination of Branching and Merging ...... 4-29 10 Instance of Single Flow ...... 4-30 11 Instance of Selective Branching and Merging Flow ...... 4-34 12 Instance of Parallel Branching and Merging Flow ...... 4-36

4-1 Chapter 4 Instructions of Step Ladder Logic SFC Programming Introduction

Chapter 4 Instructions of Step Ladder Logic

Programming Languages of PLC——Sequential function chart (SFC) Sequential Function Chart is an illustrated method for describing the functions of sequential control system. For the complicated sequential control system, internal interlocking is very complicated. If it is programmed with ladder logic, the programming step will be too long, which will be harder to read. SFC represents the mechanical action with the sequential function chart, programming with state transfer. It is especially applicable for programming the complicated sequential control program.

Programming idea of programming complicated sequential control with SFC: (1) According to requirements of structural program design, one complicated control procedure can be divided into several working steps, which are called state. The state is separated by transfer conditions. Adjacent states have different actions. When transfer conditions of adjacent states are satisfied, transferring can be realized, namely, ending the previous state and starting the next state.

(2) Element of SFC is made up of state, transfer and oriented segment. ① State It represents one working step (action). The state symbol is represented in single line

4-2 Chapter 4 Instructions of Step Ladder Logic SFC Programming Introduction frame, and the assembly number is in the frame. One control system shall have one initial state, which is correspondence with the operation origin. The symbol of the initial state is double line frame. ② Transfer It represents change from one state to another. Oriented segment is used to connect the transfer to indicate the direction. Vertical line on the oriented segment and the numeric symbol marked beside represent the transfer conditions of state. ③ Actions in correspondence with state are represented with one or several rectangles at the right side.

(3) Basic forms of SFC is divided into three forms according to the structure: ① Single flow structure: it refers to the state is operated one after another, each state is only connected to one transfer and vice versa; ② Selective structure: it refers to several single flow branches after one state. When the corresponding transferring conditions are satisfied, one single flow branch can be selected one time. Transferring conditions of selective structure is that one horizontal line is connected after a certain state, and the first transfer of each single flow branch is connected under the horizontal line. After ending of the single flow branch, one horizontal line shall be used to represent and there should be no transfer under it. ③ Parallel structure: it refers that under some transfer, if the transfer conditions are satisfied, several parallel single flow branches can be triggered simultaneously. These parallel sequential branches shall be written between the two horizontal lines.

4-3 Chapter 4 Instructions of Step Ladder Logic SFC Programming Introduction

1 AP-PCLINK SFC Programming Introduction

Firstly, create a new AP project, and then click "SFC"shown on the toolbar to access the following interface:

The left side is used to draw the flow structure for SPC, while the right side is used to program the ladder logic instructions. Click "L" on the left to write the initial program of SFC on the right. For example:

M8002 SET S0

After finishing the initial program, start to write the initial SFC step on the fourth column of the left side. Click “ ” on the toolbar, as shown below:

4-4 Chapter 4 Instructions of Step Ladder Logic SFC Programming Introduction

Add the initial step S0, and then program the corresponding ladder logic instruction on the right. If the initial step S0 doesn't have the corresponding ladder logic instruction, it will display “? 0” as shown above. After the instruction is programmed, “?” will disappear automatically. For example:

M0 Y000

After finishing the ladder logic instruction for initial step S0, you may add the transfer condition on the fifth column, as shown below:

After adding the transfer condition flow, please program the transfer condition on the right. The unprogrammed transfer condition will be shown as “? 0”. After it is programmed, “?” will disappear automatically. For example:

M100 TRAN

4-5 Chapter 4 Instructions of Step Ladder Logic SFC Programming Introduction

Once the initial step and transfer condition are completed, you may add other steps and transfer conditions in the following, as shown below:

4-6 Chapter 4 Instructions of Step Ladder Logic Step Instructions STL/RET

2 Step Instructions STL,RET

Mnemonic Function Circuit Step

[STL] Start step ladder 1

[RET] End step ladder RET 1

STL and RET are a pair of step instructions, which means starting and ending of step instructions.

Interpretation of instructions [STL](Step ladder) The instruction is to connect the master bus with the normally open contact. It is represented by the normally open contacts composed of two small rectangles. [RET](Return) Instruction of returning to master bar. ● The step instruction STL is the start of working step control for executing step point of internal devices. The initial state must start with S0-S9. [RET] is the end of the step point (S), also it must be ended with S0-S9. Then the program returns to the master bus. At the end of the step ladder logic, the instruction RET is required. In one PLC program, totaled 10 step flows in maximum can be written into S0~S9 and each step flow requires the instruction RET to end. Write the state ladder logic according to the following rules. SFC and ladder logic are exchangeable.

Programming and Actions Repeated use of state action and output ● Note: the state symbol S can not be used repeatedly. ● If the instruction RET is not written at the end of step flow, S20 compilation program of AP-PCLINK software can perform Y001 self-check and add automatically. When logic relation in SFC is correct, you can see the added instruction RET in the mnemonic S21 symbol and ladder logic. Y002 ● If the contact STL is connected, the relevant loops will act. If the contact STL is disconnected, the relevant loops won't act. After S22 one scanning cycle, the instruction will not be executed (skipping Y002 state) any more. ● As shown in the figure, the same coil (Y002) shall be output when programming between different states. At this time, S21 or

4-7 Chapter 4 Instructions of Step Ladder Logic Step Instructions STL/RET

S22 is active, the coil Y002 will be active in different step sequence. During the programming of ladder logic, the processing of dual-coil is quite complicated, so it is not recommended programming dual-coil. In addition, when SFC is used for programming, when programming the same output coil (Y002) for the state in the master program or vice versa, it shall be processed as the dual-coil of the ladder logic does. Please pay attention.

Output interlocking During state transfer, the two states are active at the same time instantly(one scanning cycle). Therefore, to avoid failure of simultaneous activation of a pair of outputs, interlocking can be set on PLC externally.

Besides, as shown in the right figure, it also requires setting interlocking on the corresponding program. Repeated use of timer In SFC chart, the timer coil can program the same software component of the same timer under different states as the output coil. However, it can not act under adjacent state(As shown in the right figure). If the same timer is set under adjacent state, the timer coil will not be inactive in case of state transfer, and the current value can not be reset.

Instructions applied for state Driving method of output

As shown in the figure, from bus in the state, once instruction LD or LDI is written, instruction not requiring contact shall not be programmed. Method in the following chart shall be used to modify such loop.

The instructions OUT and SET have the same functions for state (S) after the instruction

4-8 Chapter 4 Instructions of Step Ladder Logic Step Instructions STL/RET

STL, which will reset the transfer source. In addition, it has the function of holding. However, when the instruction OUT is used, it is used for transferring to separation state.

List of sequential control instruction in the state LD/LDI/LDP/LDF/OR/ORI/ORF/ORP/ ANB/ORB Instruction AND/ANI/ANDP/ANDF/ MPS/MRD/ MC/MCR Status INV/OUT/PLS/PLFSET/RST MPP Initial state/general state Available Available Unavailable Output Branching/ Available Available Unavailable processing merging Transfer state Available Unavailable Unavailable processing The instruction STL can not be used in interruption program and sub-program. In the instruction STL, the skipping instruction is not forbidden. However, the action is so complicated, so it is not recommended.

Symbol interpretation in the SFC Symbol Description Ladder-logic mode, indicates internal edition program is only general ladder logic L instead of step ladder program. Initial step point, represents the chart for initial step of SFC, with the available setting range of S0~S9.

General step point, with the available setting range of S10~S1023

Step point skipping is used for transferring the state of the step point to non-adjacent step point.

Transfer conditions of step point is state transferring conditions between two step points.

Selecting branching chart, is to transfer the state from the same step point to the corresponding step point under different transfer conditions.

4-9 Chapter 4 Instructions of Step Ladder Logic Step Instructions STL/RET

Selecting merging chart, is to transfer more than two different step point state to the same step point with the transfer condition. Parallel branching is to transfer the same step point to more than two step points with the same transferring condition. Parallel merging point, is to transfer more than two step points to the same step point with the same transfer condition when they are established simultaneously.

4-10 Chapter 4 Instructions of Step Ladder Logic Instruction Action and SFC Representation

3 Action and SFC Representation of Step Ladder Logic

Functions of instruction Sequential control programming of SFC is built in PLC of AP series. The SFC chart can be inverted into instruction table or ladder logic program, and vice versa. In SFC, each state can be regarded as a control working step. The input conditions and output control can be programmed according to the sequence. The biggest feature of the control is that when current working step is in operation, the previous working step does not work. The working steps operate one after another according to program to realize step control.

The step ladder logic instruction can be represented by the ladder logic. The action is shown as below:

If the SFC chart indicates step ladder logic loop in the above figure, it represents following figure

In the SFC chart, function of the equipments in each working step and the whole process are easy-to-understand. The sequential control design is easy, which could completely transmit

4-11 Chapter 4 Instructions of Step Ladder Logic Instruction Action and SFC Representation action even to the third person. Thus, it facilitates the maintenance, modification and troubleshooting. The SFC chart and step ladder logic instruction shall be programmed according to certain rules, which are exchangeable with the same content. Therefore, the familiarized ladder logic is recommended. When programming SFC chart, corresponding peripheral equipment and programming software are required.

4-12 Chapter 4 Instructions of Step Ladder Logic Instruction Action and SFC Representation

Actual representation of the instruction As mentioned above, the step ladder logic and SFC chart have the same content, which are represented by the following in practice. STL chart is represented in style of ladder logic, and SFC is based on state (working procedure) to represent the flow in mechanical way.

Programming equipment SFC chart can be programmed with personal computer (user’s software for AP series). The sequential control program programmed by SFC can be saved in AP PLC in the form of instruction.

4-13 Chapter 4 Instructions of Step Ladder Logic SFC Features

4 SFC Features

Simple action instance When mechanical action is filed for others’ reading, it shall be programmed in the form of single program in accordance with time sequence chart or structural chart. Please see the instance below:

Action (1) Press the State button, the trolley moves forwards. When the inching switch LS11 acts, it moves backwards. (LS11 is normally ON, when it moves forward at limit, it is OFF. It is the same for other inching switches. (2) When moving backwards, the inching switch LS12 acts. After stopping for 5 seconds, it moves forwards. After the inching switch LS13 acts, it moves backwards. (3) When the inching switch LS12 acts for a second time, drive motor of the trolley stops.

It is very difficult to correctly represent the complicated mechanic action with words like above actions do. The mechanical technicians and electric technicians must cooperate closely. The electric technician should design the program based on the action chart. Basically, the common PLC can't be programmed without action sequential control chart. However, the step action is very complicated for electric technicians, which required rich experience and designing time. Moreover, PLC chart seems pretty complicated from the third person, and such designer of sequential control should take responsibility for mechanical maintenance.

Processing of single flow Basic form of working step transfer is the control of single flow. In sequential control of single action, only single flow is adequate. With input conditions and operators, the following selective branching and parallel branching may be combined to make the complicated conditions

4-14 Chapter 4 Instructions of Step Ladder Logic SFC Features simple.

● In ladder circuit block(LAD0), the auxiliary relay M8002 with instant action can make the initial state S0 reset (ON) during switching from OFF to ON of PLC.

● For the mechanic initial working step is distributed with the initial state device, which is called S0~S9 in PLC.

● As for distributed state S02-S889 for the working steps, including the state for holding in case of power failure, it can keep the state.

● There are a lot of internal devices inside PLC, including timer, counter and auxiliary relay, which can be used randomly. Such timer T0 takes 0.1 second as unit action, as shown in the right figure. Therefore, when the setting value is K50, after the coil is driven for 5 seconds, the output contact acts. Selective processing and simultaneous processing of multiple working steps When executing one of multiple flows, it is called selective branching. When executing multiple flows simultaneously, it is called parallel branching.

4-15 Chapter 4 Instructions of Step Ladder Logic Preparation for SFC Programming

5 Prepared Knowledge for Programming SFC Flow

Separation of flow

SFC program has several initial states, each of OUT OUT which is a separated program. S3 S4 Take the right figure as an example. After the instruction STL affiliated to the initial state S3 is S20 S40 executed, the relevant programs of S4 are executed then. OUT In the program, the instruction except the S41 instruction STL can be applied to execute other state numbers. In the right figure, the initial state S3 includes the command OUT S41. The initial state S4 includes the S39 S59 instruction LD S39. Do not mix the instruction STL.

Restriction on number of branching loops One parallel branching or selective branching shall have no more than 10 loops. However, if there are several parallel branchings or selective branchings, total loop number of each initial state may not exceed 16. S4

1 2 3 4 5 6 7 10

OUT OUT RST OUT

OUT

1 2 3 4 5 6 7 8 9 16

It is not allowed to start to transfer or reset the separation state from or before merging . No op state must be set. Transferring and reset can only be executed from the branching.

4-16 Chapter 4 Instructions of Step Ladder Logic Preparation for SFC Programming

There is only condition for each node in AP SFC program. To write the program at the left side of the figure below in practice, method at the right side shall be applied

X004 X004 S30 Y000 S30 Y000

X000 X001 X000 X002 M0 X001 X003 M 0 X002 X003

S31 S31

Instructions MPS, MRD and MPP can not be used in transitional conditional circuit. The right method shall be used for programming.

Actions of ▽ and ↓

When state resetting is represented in the flow, it shall be represented with▽ . The symbol ↓ indicates transfer to upward state (repeat) or downward state (skipping), or transfer to state on other separated flow.

4-17 Chapter 4 Instructions of Step Ladder Logic Preparation for SFC Programming

State clearing and output forbidden Clearing of state range: X000 ZRSTP S 0 S 50

S 0

S 50

S 0

No step random output in operation:

Turn OFF all the output relays (Y) of PLC When special auxiliary relay M8034 is ON, the sequential control program continues to compute. However, the output relay(Y) is OFF.

M8034

4-18 Chapter 4 Instructions of Step Ladder Logic Preparation for SFC Programming

Special Relay To program SFC chart effectively, various special relays shall be employed with content described below: Device Name Function and purpose Operation It is the relay that shall be always ON during operation of PLC, which M8000 monitoring can be used as input state for driving programming and operation state (contact a) indication of PLC. The relay is active instantly (one scanning cycle) when PLC turns OFF Starting pulse M8002 to ON. It is used for resetting of starting setting or initial state of the (contact b) program. Driving the relay forbids transfer among all states. Under the M8040 Transfer disabled conditions of forbidding transfer, the programs in the state will still execute. Therefore, the output coil will not be off automatically. When any state is active, M8046 is automatically ON, which is M8046 STL state ON applicable for avoiding simultaneous starting or for action sign of working step with other flows. STL monitoring is Drive the relay, then the programming function can read the executing M8047 effective state and display.

Holding in Case of Power Failure Holding in case of power is used to keep its action with battery. During mechanical action in case of power failure, when power is recovered, such action can be continued, and such state can be used.

Functions of instruction RET The instruction RET is finally programmed after a series of instructions STL. Executing the instruction means completion of the step ladder logic loop. When expecting to interrupt a series of working steps and program the master program, the instruction RET is also required. The instruction RET can be programmed repeatedly. At the end of the instruction STL, if the instruction RET is not programmed, the software can add the instruction RET to the end of the program automatically. Notes for using detection contacts with rising edge and falling edge When using the detection contact for rising edge and falling edge of LDP, LDF, ANDP, ANF, ORP and ORF, the changed contacts when the state is cut off will be detected when the state is active for a second time. As for changed conditions in case of the state is cut off, if rising edge and falling edge are required to detect, please modify the program according to the chart below. After it is transferred to S42 through X001 falling edge, if X002 is falling, S3 is cut off, and

4-19 Chapter 4 Instructions of Step Ladder Logic Preparation for SFC Programming

X002 falling edge can not be detected. When S3 is active for a second time, it is detected. Therefore, when S3 acts for a second time, it is transferred to S42 immediately. S3 X001 M6 X001 X001 SET S42 M7 X001 S3

M6 SET S42 M7

4-20 Chapter 4 Instructions of Step Ladder Logic Pattern of SFC Flows

6 Pattern of SFC Flows

6.1 Skipping and Repeating Flows

It indicates the action mode combining the action mode of SFC single flow, selection branching and parallel branching. Skipping Transfer to the state below or out of the series is called skipping, which uses symbol ↓ to indicate the transferred target state.

S20 S20 S30 S40 S30 S40 S42 S22

S21 S21 S31 S41 S31 S41

S22 S22 S32 S42 S32 S42

S23 S23 S33 S43 S33 S43

Repeating Transfer to the above state is called repeating. The same as above, the symbol ↓ is used to indicate transferred target state.

4-21 Chapter 4 Instructions of Step Ladder Logic Pattern of SFC Flows

S 0 S 0 S60 S60

S50 S50 S61 S61

S51 S51 S62 S62

S52 S52 S63 S63 S60

6.2 Combined Flow of Branching and Merging

SFC chart with flow cross can't be programmed. Flow in the above chart shall be re-programmed according to the flow at the right side to realize reversal conversion from program to SFC chart based on instruction.

4-22 Chapter 4 Instructions of Step Ladder Logic Instance of Single Flow

7 Function of Initial Status

Use of Initial Status ● The initial state is located at the front most position of SFC chart, which is represented by S0-S9. ● If the initial state is driven by other state, other method shall be used for driving when the operation starts. Special auxiliary relay M8002 which only acts instantly is used to drive during switching of stop-operation of PLC in the cases shown in the figure. ● General state other than starting state shall be driven by STL of other state, and driving out of the drive shall not apply. ● The state driven by instructions other than STL is called initial state, which must be described in the front most of the flow. In addition, for the instruction STL corresponding to the initial state, it must be programmed before a series of instruction STL.

Function of Initial Status As the identified device for reversal change ● When reversal change is executed from instruction table to SFC chart, starting section of the flow shall be identified. Therefore, S0-S9 can be taken as initial state. If other numbers are used, reversal change can not be performed. ● In addition, for the instruction STL in the initial state, it must be programmed before a series of instruction STL. Lastly, RET instruction shall be programmed. When multiple processes are generated from it, they shall be separated from each other.

4-23 Chapter 4 Instructions of Step Ladder Logic Instance of Single Flow

8 Intermediate Status Program

8.1 General flow without branching and merging

The following chart is a representative state from SFC. Each state has the functions of driving load, specifying transfer destination and transfer conditions. When sequential control of relay is used to represent SFC, it is the step ladder chart below. It is programmed with SFC chart or step ladder chart. The programming sequence is driving processing of load first, then transfer processing can be performed. Of course, there is no driving processing for the status without driving load.

0 [STL] S 20 The instruction table is used to represent program in the above 1 OUT Y 010 chart, see the right chart. 2 LD X 010 The instruction STL is the normally open contact connected to 3 OR X 011 main bus. And then the coil is directly connected to auxiliary bus or 4 OUT Y 011 the contact is used to drive the coil. 5 LD X 000 Contact connected to the auxiliary bus uses the instruction 6 SET S 21 LD(LDI). If it returns to original bus bar, the instruction RET As for instructions SET and shall be used. The contact STL drives the state S, it will be RST, it is a 2-step automatically reset before the state S moves. instruction.

As for a string of SFC programs, several state programs shall be executed. Only if all the states are programmed, will it end the programming And the state sequential number can be

4-24 Chapter 4 Instructions of Step Ladder Logic Instance of Single Flow selected at your discretion. However, initial state is required before a series of STL instructions, and the instruction RET shall be written finally.

4-25 Chapter 4 Instructions of Step Ladder Logic Instance of Single Flow

8.2 General States with Skipping and Repeating

As shown in the chart above, the transfer of separation states, such as transfer to upward position (repeating), transfer to downward position (skipping) and transfer out of the flow, are as illustrated in [6 Patterns of SFC Procedure]. As shown below, instruction OUT is used for programming. The cross procedure in 6.1 is the same.

From S40, S52 is driven by X003, even if the instruction OUT is used, when S52 holds its action, the transfer source S40 will be reset automatically. As shown in the figure, it indicates resetting S65 through X007 from S65. From S65, although resetting of other state is the same, it it not transferring. Thus, S65 will not be reset.

4-26 Chapter 4 Instructions of Step Ladder Logic Instance of Single Flow

9 Program with Branching and Merging State

9.1 Selective Branching and Merging State

Instance of Selective Branching

Like the programming of general state, driving processing shall be executed, then transfer processing shall be executed. All the transfer processing shall be executed according to the sequence. Instance of Selective Merging

State drive processing before merging shall be executed first, then continue transfer processing of merging state according to the sequence. It becomes the rules of reversal inversion towards SFC. Pay attention to sequential numbers of the program, and the branching row and merging row can't be crossed.

4-27 Chapter 4 Instructions of Step Ladder Logic Instance of Single Flow

9.2 State of Parallel Branching and Merging

Instance of Parallel Branching

Like the programming of general state, driving processing shall be executed, then transfer processing shall be executed. All the transfer processing shall be executed according to the sequence. The maximum number of parallel branching is 8.

Instance of Parallel Merging

4-28 Chapter 4 Instructions of Step Ladder Logic Instance of Single Flow

9.3 Combination of Branching and Merging

As shown above, link directly when transferring from the merging to the branching, without intermediate state. It is recommended inserting a null state between them.

It shall be programmed as shown below: STL S20 STL S 20 STL S 20 STL S 20 LD X000 STL S 30 LD X000 STL S 30 SET S100 STL S 40 SET S102 LD X000 STL S 30 LD X000 STL S 30 SET S103 LD X001 SET S101 LD X001 STL S103 SET S100 STL S101 SET S102 STL S 40 LD S101 STL S102 LD X001 LD X002 SET S 50 LD S102 SET S 40 SET S100 SET S 60 SET S 40 STL S100 SET S 50 LD X002 SET S50 LD X003 SET S 50

LD X004 SET S60

4-29 Chapter 4 Instructions of Step Ladder Logic Instance of Single Flow

10 Instance of Single Flow

Instance of Water Spraying Control

1. Single operation (X001=OFF,X002=OFF). Press starting button, X000 will act. It acts as per the sequence according to Y000→Y001→Y002→Y003→Y007→Y000, and returns to standby state. Output is executed according to the sequence as per the 2-second timer. 2. Continuous operation (X001=ON), repeat actions Y001~Y007. 3. Step operation (X002=ON), press the starting button once, output actions as per the sequence.

Instance of Sparkling Loop M8002 SET S3

When PLC is operated, initial pulse (M8002) will drive state S3. After the state S3 is ON, it outputs Y000, meanwhile, the timer starts timing. 1 second later when the timing ends, it will be transferred to state S20. When state S20 is changed to ON, it outputs Y001, the timer starts timing. 1.5 seconds later, it will return to S3.

4-30 Chapter 4 Instructions of Step Ladder Logic Instance of Single Flow

Rotation Control of Cam Shaft

Limit switches X013 and X011 are set in 2 positions of the positive rotating angle, and limit switches X012 and X010 are set in 2 positions of the negative rotating angle. Press the starting button, execute positive rotating small→ negative rotation small → negative rotation big→ negative rotation big and etc., then it stops.

The limit switches X010~X013 are normally OFF. When the cam reaches the setting angle, it is ON.

●When M8047 acts, the action state monitoring is effective. After S0-S899 act and the instruction END is executed, M8046 acts. ● State point of SFC chart is held by the battery. In case of power failure during action, when pressing the starting button once again, it will continue acting. Before pressing the starting button, output actions below Y020 are totally forbidden.

4-31 Chapter 4 Instructions of Step Ladder Logic Instance of Single Flow

Instance of Sequential Start and Reverse Stop The motor starts from M1 to M4 and stops with the reverse sequence, which is controlled by the timer. Such SFC flow performs skipping based on single flow. M1 M Start M8002 Initial pulse X000 2s S 0 M2 Start button M X000 S20 SET Y000 Motor M1starts 3s Start K 20 M3 T0 M T 0 Press the stop X001 X001 ,Transfer to state S27 4s button S27 M4 S21 SET Y001 Motor M2starts M K 30 T1 T 1 Press the stop , S26 X001 X001 button Transfer to state S 22 S26 SET Y002 Motor M3starts

M4 K 40 M T2 Stop T 2 Press the stop Transfer to X001 4s , S25 X001 X001 button state M3 S25 M S23 SET Y003 Motor M4starts s Stop 3 X001 Stop M2 S 24 RST Y003 Motor M4stops M K 40 2s T 4 T4 M1 M S 25 RST Y002 Motor M3stops K 30 T 5 T5

S 26 RST Y001 Motor M2stops

K 20 T 6 T6

S 27 RST Y000 Motor M1stops

Y000

RET END S 0 The instance shows the SFC chart transfers towards the next state by skipping some flow and based on the conditions. It could also skip towards the previous state.

4-32 Chapter 4 Instructions of Step Ladder Logic Instance of Single Flow

The skipping flow in the previous page can be represented in selective branching and merging flows described below. Flowing direction must be from up to down, which can not be crossed except branching and merging.

M8002 Initial pulse S 0 X000 Start button S20 SET Y000

K 20 T0 T 0 X001 Stop X001 S21 SET Y001

K 30 T1 T 1 X001 X001 Stop S 22 SET Y002

K 40 T2 T 2 X001 X001 Stop S23 SET Y003 S 30 S 31 S 32 X001 Stop S 24 RST Y003

K 40 T 4 T4 S 30

S 25 RST Y002

K 30 T 5 T5 S 31

S 26 RST Y001

K 20 T 6 T6 S 32

S 27 RST Y000

Y000 RET END S 0 For instance, when the state S20 acts, if X001 is active, the state S32 acts, then the contacts act, which skips to the state S27 directly. There should be more than one state in the branching; therefore, null state shall be set.

4-33 Chapter 4 Instructions of Step Ladder Logic Selective Branching/Merging

11 Instance of Selective Branching and Merging Flow

Action of Selective Branching

Instance of Selective Branching The following chart is the machine to separately convey big and small balls with the transmission points. The top left is the origin, and sequence of actions is descending, absorption, ascending, rightward moving, releasing, ascending and leftward moving. In addition, the mechanical arm descends, when the electromagnet presses the big ball, the lower limit switch LS2 is OFF; when pressing the small ball, LS2 is ON.

4-34 Chapter 4 Instructions of Step Ladder Logic Selective Branching/Merging

For such SFC chart for selecting size or judging acceptance or not, the following branching and merging SFC chart can be used to represent. For例如以 example,M8002 use M8002驅動初始脈衝 to drive the initial pulse S 0 Sequence各個操作順序 of each operation

X026 啟動Start

Y007 原點位置Origin position(Upper( 上限、左限、釋放 limit, left) limit, release)

S 21 Y000 下降Fall

T 0 K20 表示It representsX002的觸點 the contact(常閉觸點 of X002(normally) closed contact) T0 T0 Lower X002 未達到下限 limit下限(小球)(Small ball) X002 Lower limit is not reached

SET Y001 S 22 SET Y001 吸附Absorptio S 25 吸附Absorption

T1 K 10 T1 K 10 T 1 T 1 Rise S 23 Y002 上升Rise S 26 Y002 上升 ·If 若為小球時( it is small ball(X002=ON),X002=ON)左 the X003 Upper上限 limit X003 上限Upper limit left側流程有效;若為大球 flow is valid; for big ball, the right時,則右側的流程有效 flow is valid. ? X004 X005 S 24 Y003 右行Move right S 27 Y003 右行Move right

X004 右 小盒子 X005 Right(Big box) Rig(ht(Small) 右(大盒子)

S 30 Y000

X002 下限Lower limit ·若為小球時,X004動作,若為大球時,X005動作。 然後向匯合狀態If it is small ball,S30 X004轉移。 acts; for big ball, X005 acts, and then transfer S 31 RST Y001 to the merging state S30.

T2 K 10 T2

S 32 Y002 上升Rise · 若驅動後面提到的特殊輔助繼電器If the following auxiliary relay M8040M8 is 0 4driven, 0 ,則禁止 all the state 所有的狀態轉移? 在狀態S24、S 27與S33中,右移 Upper limit 輸出 Y003,以及左移輸出Y004中各自串聯有相? X003 上限 transfer will be prohibited. In the states of S24, S27 and S33, 的互鎖觸點。 X001 the output of moving right Y003 and output of moving left S 33 Y004 左行Move left Y004 have relevant interlocking contacts in series connection. X001 左限Left limit

S 0 RET END

4-35 Chapter 4 Instructions of Step Ladder Logic Parallel Branching/Merging

12 Instance of Parallel Branching and Merging Flow

● Branches with several flows executed simultaneously are called parallel branching. ● As shown in the figure, after S20 acts, X000 is on, state S21, S24 and S24 will be effective simultaneously and the flows start. ●After all the flows are completed, when X007 is ON, merging state S30 acts and state S23, S26 and S29 do not act. ● Such merging is also called waiting merging. (Flows completing earlier shall until all the flows are completed, then merging is continued, and it continues acting).

For instance: parts A, B and C are processed separately, which are assembled after processing. This is a parallel branching and merging flow.

4-36 Chapter 5 Representation and Use of Application Instructions Table of Contents

Chapter 5 Representation and Use of Application Instructions ...... 5-2 1 Representation and Execution Form of Application Instructions ...... 5-2 2 Use Data in the Application Instruction ...... 5-8 3 Change Operand with Index Register ...... 5-11 4 Specification of Constants K, H and E (Decimal /Hexadecimal/Real Number) Specifying ...... 5-14

5-1 Chapter 5 Representation and Use of Application Instructions Representation and Execution Form

Chapter 5 Representation and Use of Application Instructions

The chapter introduces application instructions and programming method of AP PLC. In general, one basic instruction can only finish one specified operation, while one application instruction can finish one series of operations, which is equal to one sub-program. therefore, function of application instruction is more powerful. The basic instructions are corresponding to the ladder symbols. The application instruction employs ladder logic, together with the auxiliary marks, to represent what the instruction is to do. Times of application instruction in the whole program are restricted.

1 Representation and Execution Form of Application Instructions

Instructions and operands ● The application instructions of PLC can specify the function numbers of F00-F□□□, and the instructions can be represented by the auxiliary marks. For instance, F4 is MEAN, indicating "mean value". ●Application instructions use the function number and following auxiliary mark to form one complete instruction.

X000 S· D· n MEAN D100 D150 K5

● MEAN: An auxiliary mark of the instruction indicates calculating the mean value. S.: Source operands, called source for short, after executing the instructions, operand of the content will not be changed. Under the conditions of changing device number with index, add “•” [S• ] to represent. When there is more than one operand, represent with [S1• ], [S2•] and etc. D.: Destination operand, called destination for short, after executing the instructions, operand of the content will be changed. Like the source, index decoration shall apply. When there is more than one operand, represent with [D1•], [D2•] and etc. n: other operands, which are used to represent constant or make supplementary interpretation for the source and destination. If it is used to represent constants, decimal system figure is followed after K and hexadecimal system figure is followed and H.

5-2 Chapter 5 Representation and Use of Application Instructions Representation and Execution Form

● Program step: the step for executing the program. Generally speaking, the function number and auxiliary mark occupy one step respectively. Each operand occupies 2-4 steps (2 steps for 16-bit operand and 4 steps for 32-bit operand).

Available Devices for Operands ● X, Y, M and S bit devices are available. ● Combine these devices, represent with KnX , KnY , KnM , KnS and other forms as data for processing. (Refer to the next section under this Chapter Use of Bit Device) ● Registers that can process the current value of the data register D, W, timers T or counter C. The data register D , W is 16-bit. When 32-bit data is processed, a pair of data registers can be used. For instance: when the data register D0 is specified as operand of 32-bit instruction, 32-bit data (D0 and D1) is processed (D1 is high 16-bit and D0 is low 16-bit). Current registers of T and C can be used as general registers; however, the device of 32-bit counter can process 32-bit data, which can not be used for operand of 16-bit instructions. Form and Execution of the Instructions Of PLC under AP series, the application instructions are divided into 16-bit instruction and 32-bit instruction based on the data to be processed. In addition, it has features of continuous executing and pulse executing and etc. based on the execution forms of the instructions, The application instruction can be used together or independently. ● In application instruction of data processing, it is divided into 16-bit and 32-bit based on the bit length of the data. X000 The decimal figure 100 is sent to the hexadecimal system data MOV K100 D10 register D10. X001 DMOV D20 D22 Content of (D21, D20) is sent to (D23, D22).

● As for function instruction with the symbol (D), it can process 32-bit data. ●32-bit data is comprised of 2 adjacent registers. ● One device of the 32-bit counter is 32-bit, and it can not be used as 16-bit operand.

Pulse execution/continuous execution instructions Pulse execution type X000 MOVP D10 D12

Under pulse execution, the instruction MOV executes data transmission when X000 is

5-3 Chapter 5 Representation and Use of Application Instructions Representation and Execution Form

OFF→ON. To shorten scan time, pulse execution instruction must be used as much as possible. The symbol P represents the pulse execution for the instruction. F24 (INC), F25 (DEC) and etc. shall be in accordance with the instructions. If continuous execution instruction is employed, each scan cycle and source content will change.

Continuous execution type X001 MOV D10 D12

The above figure is continuous execution instruction, PLC works in circulating scan. If the execution condition X001 is ON, the above instruction is repeated once in each scan cycle. When the drive inputs X0 and X1 are OFF, the instructions out of special symbols are not executed and the destinations do not change.

Processing of symbols General symbols ■ The following symbols will act according to the types of application instructions. For example: M8020: zero symbol M8022: carrying symbol M8021: borrowing symbol M8029: execution ends When the instructions are ON, the symbols will be active or inactive accordingly; for OFF or error, it will not change. When there are too many instructions affecting the symbols, every time executing the instructions, the active/inactive state will be changed. Please refer to the following instance of symbol program. ■ Instance of program with multiple symbols (standard case of executing results). When there are multiple application instructions for the same symbol action, please write contact point of the symbol after the instructions.

5-4 Chapter 5 Representation and Use of Application Instructions Representation and Execution Form

M8000

DSW X010 Y010 D0 K1 Read the value of digital switch

M8029 Action finishing flag of DSW is taken as the MUL D0 K10 D20 triggering point to increase the number 10 times.

M8029 as the finishing flag of DSW acts.

X010 SET M0

M0 D PLSY starts

DPLSY K1000 D20 Y000 After the number SW×10, output pulse to Y100 with

M8029 as the frequency of 1KHZ. finishing flag Of M8029 DPLSY acts. RST M0 After setting the pulse output, finishing flag of D PLSY Is taken As the triggering point to reset M0.

5-5 Chapter 5 Representation and Use of Application Instructions Representation and Execution Form

M8029

Execution result M8000 As for applied instructions employing the finishing DSW X010 Y010 D0 K1 symbol mark, as shown in the left figure, The finishing flag will be executed. If It Is summarized M8000 into one for programming, it will be difficult to judge which instruction is taken to control the SET M0 symbol mark, moreover, it will fail to obtain the symbol flag corresponding to each instruction. M0 DPLSY K1000 D20 Y000

M8029

Execution result

《Symbol of computation errors》 In case of errors in structure of application instructions, available devices, number range and etc., it may lead to error in computation and the following symbol bit will act and record the error information.

In case of errors in computation, M8067 will act and hold, as well as save the error M8067 code in D8067. In case of other new errors, D8067 will update new error code. D8067 When the error is fixed, M8067 will be OFF, and D8067 will be cleared when the PLC is switched from STOP→RUN.

《Symbol for extended functions》 In some application instructions, the inherent special auxiliary relay determined by the instruction can be used for function extension. The following example shall apply: X000 W hen X000 is active, the instruction will exchange X C H P D 10 D 20 the content of D10 and D11.

X000 Function extension symbol for XCH M 8160 W hen M8160 before the instruction XCH is driven, and the computation object and result specify the same element, it w ill exchange the X C H P D 10 D 10 high 8- bit and low 8-bit.

M8000 Same No. To return normal instruction, XCH M 8160 M 8160 shall be inactive.

In addition, when the instruction for interrupting program needs the symbol for function

5-6 Chapter 5 Representation and Use of Application Instructions Representation and Execution Form extension, write the DI instruction (interruption inhibition) before driving the symbol for function extension, and write the instruction EI (interruption permission) after inactivation of the symbol for function extension.

Restriction of simultaneous driving of the instructions Even if some instructions in application instruction can be programmed for several times, there are restrictions on action points. Driving restriction for the high-speed compare instructions F53 (DHSCS),F54 (DHSCR),F55 (DHSZ). Note: The maximum points for above 3 instructions are as below: AP100 series: The 3 instructions can use a maximum of 12 compare points simultaneously. AP200 series: Each high-speed input for the 3 instructions can use a maximum of 12 compare points, so they use 12×6 compare points at most. AP300 series: Each high-speed input for the 3 instructions can use a maximum of 12 compare points, so they use 12×10 compare points at most. Driving restriction for the pulse instructions Y points of each high-speed output can be only driven by one of the following instructions. F57 (PLSY),F58 (PWM),F59 (PLSR),F156 (ZRN),F157 (PLSV),F158 (DRVI), F159 (DRVA),F204 (PTPO),F205 (CLLM),F206 (VSPO),F207 (ICF),F208 (CSFO). 2 instructions F72 (DSW),F74 (SEGL) 1 instruction F52 (MTR),F60 (IST),F62 (ABSD),F68 (ROTC),F69 (),F70 (TKY),F71 (HKY),F75 (ARWS),F80 (RS),F87 (MBUS),F191 (RMIO),F200 (PPMI),F201 (PPMA). For more details, please refer to Chapter 6 Instruction Interpretation.

5-7 Chapter 5 Representation and Use of Application Instructions Use Data

2 Use Data in the Application Instruction

Use of bit element ● Only two states are available for X, Y, M and S, namely, ON/OFF. The element which is represented with binary system is called bit element. T, C, D and other devices for data processing are called character element. Even if it is a bit element, it can be used to process data by combining the bit elements. Under the circumstances, it is represented with bit Kn and starting device number. ● 4 bit elements are used as the unit. For instance: n in KnM10 is the number of units, which is K1~K4 for 16-bit data, and K1~K8 for 32-bit data. For instance: K2M0 is M0~M7, which is 2-bit data. Symbol bit, 0=positive, 1=negative 0 111111110 0 0 0 0 0 0 D0 Low bit Send No change 0 1 0 1 0 1 0 1 M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0 Symbol bit, 0=positive, 1=negative D1 Low bit 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 ● When 16-bit data is sent to specified value of K1M0~K3M0, the high-bit data (namely 4 bits in maximum) will not be sent according to insufficient specified data length. The case is the same for 32-bit data. ● In 16-bit (or 32-bit) computation, when the bit element is for specified number of bitK1-K3 (K1-K7), if the high bit is insufficient, add 0 for processing. In this case, the highest bit is 0, so the data is processed as positive.

M0 BIN K2X004 D0

● The specified number of bit element can be specified freely. It is suggested that for X and Y, the lowest bit number shall be set 0 (X000, X010, X020…Y000, Y010 and Y020); for M and S, multiple of 8 is ideal. To avoid confusing, it shall be set M0, M10, M20… and etc.

Attached Notes 《Specifying of continuous characters》 A series of data registers starting from D1 are D1, D2, D3, D4 and etc Through specifying bit, in the word situation, it can be used for a series of word processing.

5-8 Chapter 5 Representation and Use of Application Instructions Use Data

See the followings: K1X000 K1X004 K1X010 K1X014…,K2Y010 K2Y020 K2Y030… K3M0 K3M12 K3M24 K3M36…,K4S16 K4S32 K4S48… Namely, do not skip the device. Use the devices according to unit of the bit. However, for 32-bit computation, if K4Y000 is used, the high 16-bit is 0. When 32-bit data is required, please specify K8Y000.

Use of floating-point number computation In PLC, integral of PLC employs binary system. In division computation of integral, for instance, 40/3=13 and 1. In evolution computation of integral, decimal point is ignored. To perform the computation more precisely, floating-point number computation is used in PLC of TP03 series.

● The floating-point number computation is valid for the following instructions: F49 (FLT),F110 (DECMP),F111 (DEZCP),F118 (DEBCD),F119 (DEBIN),F120 (DEADD),F121 (DESUB),F122 (DEMUL),F123 (DEDIV),F124 (DEXP),F125 (DLOGE),F126 (DLOG10),F127 (DESQR),F128 (DENEG),F129 (INT),F130 (DSIN), F131 (DCOS),F132 (DTAN),F133 (DASIN),F134 (DACOS),F135 (DATAN),F136 (DRAD),F137 (DDEG).

Floating-point number of decimal system ● Binary floating-point number is hard for user to judge, therefore, it shall be converted into decimal floating-point number. ● A pair of data registers with continuous numbers can be used to process floating-point number under decimal system. The smaller number is the mantissa section and the bigger number is the index section. For example: When the data registers (D1, D0) are used, the data is written into D0 and D1 by the instruction MOV. Floating-point value under decimal system=「Mantissa D0」×10[Index D1] Mantissa D0=±(1,000~9,999) or 0 Index D1= - 41~ +35 The highest bits of D0 and D1are the bits for positive and negative symbols, which are processed as a complement code for 2. Besides, in Mantissa D0, for instance, 100 does not exist. When it is 100, it becomes 1000×10 1 (Mantissa 1000, index-1). Processing range of decimal floating-point is stated below:

5-9 Chapter 5 Representation and Use of Application Instructions Use Data

Minimum absolute value 1175494×10-44 Maximum absolute value 3402823×1032 ●Decimal floating-point number is valid in the following instructions. Binary floating-point number→ Decimal floating-point number: F118(DEBCD) Decimal floating-point number→ Binary floating-point number: F119(DEBIN)

Binary floating-point number Binary floating-point number is a pair of data registers using continuous numbers, such as situations (D11,D10), with results below: D11(b15~b0) D10(b15~b0)

27 26 25 21 20 2-1 2-2 2-3 2-21 2-22 2-23 S E7 E6 E5 E1 E0 A22 A21 A20 A2 A1 A0 b31 b30 b29 b28 b24 b23 b22 b21 b20 b2 b1 b0 Index section 8 Index section 8 bit bit

E0~E7=0 or 1 A0~A22=0 or 1 Mantissa section b0~b31=0, it is 0 symbol(0:positive, 1:negative) Binary floating-point number=±(20+A22×2-1+A21×2-2+……+A0×2-23)×2(E7×27+E6×26+…+E0×20)/ 2127 For example:A22=1,A21=0,A20=1,A19~A0=0 E7=1,E6~E1=0,E0=1 Binary floating-point number=±(20+1×2-1+0×2-2+1×2-3+……+0×2-23)×2(1×27+0×26+…+1×20)/2127 =±1.625×2129/2127=±1.625×22 The positive and negative symbols are determined by b31, and complement code can not be used.

5-10 Chapter 5 Representation and Use of Application Instructions Change Operand with Index

3 Change Operand with Index Register

Available application instructions In interpretation of application instructions, see the following figure for the operand of index decoration. Add the mark “•” on the source S and destination D to distinguish the operand without change functions.

Index change available

S· D·

MOV K100 D10

Instance for changing with index As for structure and function of the index register, please refer to [2-9-2 index register] for more information.

Number decoration of index register

Change of 32 bit instruction operand. For the instruction DMOV is 32 bit instruction, therefore, the index register for the instruction shall be specified as 32 bit. In the 32 bit instruction side Z(Z0-Z15) of the 32 bit instruction is specified. Including side V(V0-V15). which is taken as actions of the 32 bit register *1: even data written in Z0 does not exceed 16 bits(0-32767), and V and Z shall be rewritten with the 32 bits instruction . If only size Z is written .and other data is left on side V it may lead to great computation error.

Change of 16 bit instruction operand. Send content of K0 or K10 to the index register V0

When X0 is active and V0=0(D0+0=0), content of K500 is

send to D0 , If V0=10(D0+10=D10), content of K500 is sent

to D10

5-11 Chapter 5 Representation and Use of Application Instructions Change Operand with Index

Decoration of the constant K

Change of the content is the same as the device number If X005 is On , if V5=0,(K6+0=K6) content of K6 is moved to D10 If V5 =20 (K6+20=K26) content of K26 is moved to D10

Decoration of input/output relay (octal bit element number) When X,Y,KnX and Kny and other octal system device number is executed for index change . content in the change register of corresponding device number shall be plus after octal system conversion.

See the left figure. output Y7-Y0 with the instruction MOV to change it into X7-X0,X17-X10 and X27-X20

The conversion of 0,8,16 is by octal system conversion through (X0+0=X0), (X0+8=X10) and (X0+16=X20), which is the then plus the device number, so as to change the input terminal block.

Instance of displaying the current value of the timer

5-12 Chapter 5 Representation and Use of Application Instructions Change Operand with Index

Decoration of instructions with restricted times of use

Pulse width determined by content of D10 is output to Y0 or Y1

Such switching is controlled by On/Off of X010

If the target device number is decorated with index registers, the program can be used to change the target device number. As for instructions with restricted times of use, such method has the same effect with programming the same instruction for several times. The instruction F58 can execute the programming instruction for one time only. Without driving several outputs simultaneously, the controlled target can be changed by changing the output numbers. In addition, during the instruction executing, even if Z is changed, the above switching is invalid. To make switching valid, please set condition of the driving instruction OFF one time.

Notes ●The 16-bit counter with index change can not be used as 32-bit counter. As results of index change, when 32-bit counter is required, please add Z0-Z15 after the counter C200. ●"n" in Kn of V and Z or used for bit specifying, can not be decorated (K4M0Z0 is valid and K0Z0M0 is invalid). ● LD, AND, OUT and other PLC basic control instructions, as well as the step logic instructions can't be changed with the index.

5-13 Chapter 5 Representation and Use of Application Instructions Specify Constants

4 Specification of Constants K, H and E (Decimal

/Hexadecimal/Real Number) Specifying

When processing constants, the sequential control program uses constant K (decimal), H (hexadecimal) or E (floating point). In peripheral equipment for programming, add K to a decimal number, H to hexadecimal number and E to a floating point (real number) for operations associated with numeric values in instructions. (Examples: K100 (decimal number), H64 (hexadecimal number) and E1.23 or E1.23+10) (real number))

Constant K (decimal number) "K" is the symbol used to represent integral of decimal system. It is mainly used to specify the set value of timers and counters, or numeric values as operands in application instruction. (Example: K1234) The decimal constant specification range is as follows: ●When word data (16 bits) is used K-32768~K32767 ●When double data (32 bits) is used K-2147483648~K2147483647

Constant H (hexadecimal number) "H" is the symbol used to represent number of hexadecimal system. It is mainly used to specify numeric values a operands in application instructions. (Example: H1234) When using digits 0~ 9, the bit status (1 or 0) of each bit is equivalent to the BCD code, so BCD data can be specified also. (Example: When H1234 specifying data with BCD, specify each digit of hexadecimal number from 0 to 9.) The hexadecimal constant specification range is as follows: ●When word data (16 bits) is used H0~HFFFF (H0~ H9999 in the case of BCD data) ●When double data (32 bits) is used H0~HFFFFFFFF (H0~H99999999 in the case of BCD data)

Constant E (real number) "H" is the symbol used to represent real number (floating point data). It is mainly used to specify numeric values a operands in application instructions. (Example: E1.234 or E1.234+3) The real number setting range is: -1.0×2128~ -1.0×2-126,0,1.0×2-126~ 1.0×2128 In a sequence program, a real number can be specified in two methods, “normal expression” and “exponent expression”. ● Normal Specify a numeric value as it is. For example: specify “10.2345” in the format of expression “E10.2345”

5-14 Chapter 5 Representation and Use of Application Instructions Specify Constants

● Specify a numeric value in the format “(numeric value) of ×10n. For example: Exponent specify “1234” in the format of “E1.234+3”. expression “+3” in “E1.234+3” indicates n power to 10 (+3 mean 103).

5-15 Chapter 6 Interpretation of Application Instructions List of application instructions and reading instruction

Chapter 6 Interpretation of Application Instructions 1 List of application instructions and reading instruction 1.1 List of application instructions (Listed by function No.) Instructio Application instruction 16/32 Step P n type No. Symbol Function Bit 16bit 32bit 00 CJ Conditional jump 16 √ 3 — 01 CALL Call sub-program 16 √ 3 — 02 SRET Subroutine return *1 1 —

Program flow 03 IRET Interruption return *1 1 — 04 EI Enable interruption *1 1 — 05 DI Disable Interruption *1 1 — 06 FEND First end *1 1 — 07 WDT Monitor timer *1 √ 1 — 08 FOR Start a for/next loop 16 3 — 09 NEXT End a for/next loop *1 1 — 10 CMP Compare 16/32 √ 7 13 11 ZCP Zone compare 16/32 √ 9 17 Transmit the constant to the memory, one word

Data Transmit the constant to the

Data transmission and compare memory, two words

transfer Transmission from memory to 12 MOV 16/32 √ 5 9 memory, one word Transmission from memory to memory, two words Non-bit or word/Special data range 13 SMOV Shift move 16 √ 11 — 14 CML Compliment 16/32 √ 5 9 15 BMOV Batch moving 16 √ 7 — 16 FMOV Fill move 16/32 √ 7 13 17 XCH Exchange 16/32 √ 5 9 18 BCD Conversion of BIN→BCD 16/32 √ 5 9 19 BIN Conversion of BCD→BIN 16/32 √ 5 9 o metic logic p and 220 ADD Addition 16/32 √ 7 13 erat 21 SUB Subtraction 16/32 √ 7 13

6-1 Chapter 6 Interpretation of Application Instructions List of application instructions and reading instruction

Instructio Application instruction 16/32 Step P n type No. Symbol Function Bit 16bit 32bit 22 MUL Multiplication 16/32 √ 7 13 23 DIV Division 16/32 √ 7 13 24 INC Increment 16/32 √ 3 5

logic operations 25 DEC Decrement 16/32 √ 3 5 Arithmetic and 26 AND Word and 16/32 √ 7 13 27 OR Word or 16/32 √ 7 13 28 XOR Word exclusive or 16/32 √ 7 13 29 NEG Negative 16/32 √ 3 5 30 ROR Rotation right 16/32 √ 5 9 31 ROL Rotation left 16/32 √ 5 9 32 RCR Rotation right with carry 16/32 √ 5 9 Rotation and shift 33 RCL Rotation left with carry 16/32 √ 5 9 34 SFTR Bit shift right 16 √ 9 — 35 SFTL Bit shift left 16 √ 9 — 36 WSFR Word shift right 16 √ 9 — 37 WSFL Word shift left 16 √ 9 — 38 SFWR Shift register write 16 √ 7 — 39 SFRD Shift register read 16 √ 7 — 40 ZRST Zone reset 16 √ 5 — 41 DECO Decoder 16 √ 7 — 42 ENCO Encoder 16 √ 7 — Data processing 43 SUM Sum of active bits 16/32 √ 5 9 44 BON Check specified but status 16/32 √ 7 13 45 MEAN Mean value 16/32 √ 7 13 46 ANS Timed annunciator set 16 7 — 47 ANR Annunciator reset 16 √ 1 — 48 SQR Square root of BIN 16/32 √ 5 9 49 FLT Float point of BIN integer→binary 16/32 √ 5 9

High speed counting 50 REF Input/Output refresh 16 √ 5 — 52 MTR*2 Matrix input 16 9 — processing 53 HSCS High speed counter set 32 — 13 54 HSCR High speed counter reset 32 — 13 55 HSZ High speed counter zone compare 32 — 17 56 SPD Speed detect 16 7 —

6-2 Chapter 6 Interpretation of Application Instructions List of application instructions and reading instruction

Instructio Application instruction 16/32 Step P n type No. Symbol Function Bit 16bit 32bit 57 PLSY Pulse Y output 16/32 7 13 58 PWM Pulse width modulation 16 7 — 59 PLSR Ramp pulse output 16/32 9 17 60 IST*2 Initialize state 16 7 — 61 SER Search data 16/32 √ 9 17 62 ABSD Absolute drum 16/32 9 17 Handy instruction 63 INCD Incremental drum 16 9 — 64 TTMR Teaching timer 16 5 — 65 STMR Special timer 16 7 — 66 ALT Alternate state 16 √ 3 — 67 RAMP Ramp signal 16 9 — 68 ROTC Rotary table control 16 9 — 69 SORT Sort data 16 11 — 70 TKY Ten key input 16/32 7 13 71 HKY Hexadecimal key input 16/32 9 17

/ fprpea eie I/O of peripheral devices 72 DSW Digital switch 16 9 — 73 SEGD 7-section decoding 16 √ 5 — Hour and minute display of 7-section 74 SEGL 16 7 — code 75 ARWS Arrow switch 16 9 — 76 ASC ASCII code conversion 16 11 — 77 PR ASCII code print 16 5 — 78 FROM*3 Read BFM(buffer memory) 16/32 √ 9 17 79 TO*3 Write into BFM(buffer memory) 16/32 √ 9 17 80 RS RS communications 16 11 — External serial devices 81 PRUN Octal code bit sending 16/32 √ 5 9 82 ASCI HEX conversion into ASCII 16 √ 7 — 83 HEX ASCII conversion into HEX 16 √ 7 — 84 CCD Check code 16 √ 7 — 87 MBUS MBUS communication 16 11 — 88 PID PID operation 16 9 — Convenien communic 90 COIW Single coil write 16 9 — ation

t 91 MCIR Coil read 16 11 — 92 MCIW Multi-coil write 16 11 —

6-3 Chapter 6 Interpretation of Application Instructions List of application instructions and reading instruction

Instructio Application instruction 16/32 Step P n type No. Symbol Function Bit 16bit 32bit 93 REGW Single register write 16 9 — 94 MRGR Register read 16 11 — 95 MRGW Multi-register write 16 11 —

FLASH 100 STORE FLASH storage 16 √ 7 — read/write 101 LOAD FLASH data read 16 √ 7 — 110 ECMP Binary float compare 32 √ — 13 111 EZCP Binary float zone compare 32 √ — 17 112 EMOV Movement of floating-point number 32 √ — 9 Binary floating-point numbers 118 EBCD 32 √ — 9 → Decimal floating points Decimal floating-point numbers 119 EBIN 32 √ — 9 →Binary floating points Addition of binary floating-point 120 EADD 32 √ — 13 numbers Subtraction of binary floating-point 121 ESUB 32 √ — 13 numbers Multiplication of binary floating-point 122 EMUL 32 √ — 13 numbers Division of binary floating-point 123 EDIV 32 √ — 13

Floating point operation operation point Floating numbers Exponent arithmetic computation of 124 EXP 32 √ — 9 binary floating-point numbers Natural logarithm computation of binary 125 LOGE 32 √ — 9 floating-point numbers Common logarithm computation of 126 LOG10 32 √ — 9 binary floating-point numbers Square root of binary floating-point 127 ESQR 32 √ — 9 numbers NEG computation of binary 128 ENEG 32 √ — 5 floating-point numbers Binary floating-point numbers →BIN 129 INT 16/32 √ 5 9 integer 130 SIN Float-point sine computation 32 √ — 9 131 COS Float-point cosine computation 32 √ — 9 132 TAN Float-point tangent computation 32 √ — 9 133 ASIN Float-point arc sine computation 32 √ — 9 134 ACOS Float-point arc cosine computation 32 √ — 9 135 ATAN Float-point arc tangent computation 32 √ — 9 136 RAD Degree - RAD 32 √ — 9 137 DEG RAD - Degree 32 √ — 9 Data SWAP Float to scientific 147 16/32 √ 3 5 operation

6-4 Chapter 6 Interpretation of Application Instructions List of application instructions and reading instruction

Positioning 156 ZRN Zero return 16/32 9 17 157 PLSV Pulse V 16/32 7 13 158 DRVI Drive to increment 16/32 9 17 159 DRVA Drive to absolute 16/32 9 17 160 TCMP Time compare 16 √ 11 — Time computation 161 TZCP Time zone compare 16 √ 9 — 162 TADD Time addition 16 √ 7 — 163 TSUB Time subtraction 16 √ 7 — 166 TRD Read RTC data 16 √ 3 — 167 TWR Write RTC data 16 √ 3 — Peripheral 170 GRY Binary→Gray code 16/32 √ 5 9 devices 171 GBIN Gray→Binary code 16/32 √ 5 9 188 CRC Cyclical redundancy check 16 √ 7 — Peripheral 191 RMIO*2 Remote I/O connection 16 3 — communic DTLK2* ation 193 Data link 2 16 7 — 2 PPMI*3 Dual-axis relative point-to-point 200 32 — 21 movement PPMA*3 Dual-axis absolute point-to-point 201 32 — 21 movement 202 CWI*4 Dual-axis relative circular interpolation 32 — 21 203 CWA*4 Dual-axis absolute circular interpolation 32 — 21 204 PTPO*3 Single-axis pulse output by table 32 — 13

Pulse output 205 CLLM*3 Closed loop locating management 32 — 21 206 VSPO*3 Pulse V 32 — 21 207 ICF*3 Change frequency immediately 32 — 13 208 CSFO*3 Cut speed and follow output 16 9 — 209 SLCH*4 Select channel 16 3 — 210 LINI*4 Tri-axis relative linear interpolation 32 — 17 211 LINA*4 Tri-axis absolute linear interpolation 32 — 17 212 CIMI*4 Dual-axis relative oval interpolation 32 — 13 213 CIMA*4 Dual-axis absolute oval interpolation 32 — 13

comparison 224 LD LD (S1·)=(S2·) 16/32 5 9 Contact 225 LD (S1·)>(S2·) 16/32 5 9 226 LD (S1·)<(S2·) 16/32 5 9 228 LD (S1·)≠(S2·) 16/32 5 9

6-5 Chapter 6 Interpretation of Application Instructions List of application instructions and reading instruction

229 LD (S1·)≤(S2·) 16/32 5 9 230 LD (S1·)≥(S2·) 16/32 5 9 232 AND AND (S1·)=(S2·) 16/32 5 9 233 AND (S1·)>(S2·) 16/32 5 9 234 AND (S1·)<(S2·) 16/32 5 9

Contact comparison 236 AND (S1·)≠(S2·) 16/32 5 9 237 AND (S1·)≤(S2·) 16/32 5 9 238 AND (S1·)≥(S2·) 16/32 5 9 240 OR OR (S1·)=(S2·) 16/32 5 9 241 OR (S1·)>(S2·) 16/32 5 9 242 OR (S1·)<(S2·) 16/32 5 9 244 OR (S1·)≠(S2·) 16/32 5 9 245 OR (S1·)≤(S2·) 16/32 5 9 246 OR (S1·)≥(S2·) 16/32 5 9 *1:The instruction doesn't include operand, or distinguish 16-bit and 32-bit. *2:AP100 1.2 and above versions are supported. *3:AP200 1.0 and above versions are supported. *4:AP300 1.0 and above versions are supported.

6-6 Chapter 6 Interpretation of Application Instructions List of application instructions and reading instruction

1.2 How to understand the instruction description

① ②

F ADD Addition S1· S2· D· 20 D P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * * * * * * * * * ③ Note: AP300 series supports data register W. Instruction Format ADD S1· S2· D· ④ S1· :Augend. S2· :Addend. D· :Sum. Function S1• plus S2• with symbols, and the result is stored in D1. ⑤

①Function number and instruction symbol of application instructions

Function number F Instruction symbol (○ADD○ : → ADD ← (FUN 20) 20 DP ○represents D or P)

The symbol reading instruction: The square on upper right indicates The square on upper left whether the instruction is available for indicates whether the instruction is continuous execution type. The square available for 16 bit. The square in in solid line indicates it is available for solid line indicates it is available continuous execution type, while the for 16 bit, while the square in square in dotted line indicates it is dotted line indicates it is unavailable for continuous execution unavailable for 16-bit. ADD type. The square on lower left DP The square on lower right indicates indicates whether the instruction is whether the instruction is available for available for 32 bit. The square in pulse type. The square in solid line solid line indicates it is available indicates it is available for pulse type, for 32 bit, while the square in while the square in dotted line indicates dotted line indicates it is it is unavailable for pulse type. unavailable for 32-bit. The letter in the square indicates it shall be added before/after the instruction symbol when using the function instruction corresponding to the square (The square on the left represents the letter is added before the instruction symbol, while the square on the right represents the letter is added after the instruction symbol). No letter in the square indicates it can be used without letter directly.

6-7 Chapter 6 Interpretation of Application Instructions List of application instructions and reading instruction

Instance of instruction symbol: The simple symbols are explained as below(“□” indicates functional number, “○” represents instruction symbol);

F In this instance, instruction CJ can be used in two methods, CJ namely: CJ (16-bit continuous execution instruction), CJP(16-bit 00 P pulse execution instruction).

In this instance, instruction SRET can be used in one method, F namely SRET(independently continuous execution instruction). SRET 02 This instance is about the independent instruction irrelevant to 16-bit and 32-bit instruction.

F In this instance, instruction WDT can be used in two methods, WDT namely: WDT(independent continuous execution instruction), 07 P WDTP(independent pulse execution instruction).

F In this instance, instruction FOR can be used in one method, FOR 08 namely FOR(16-bit continuous execution instruction).

In this instance, instruction CMP can be used in four methods, F namely: CMP(16-bit continuous execution type), DCMP(32-bit CMP 10 D P continuous execution type), CMPP(16-bit pulse execution type), DCMPP(32-bit pulse execution type).

In this instance, instruction AND can be used in four methods, F W namely:WAND(16-bit continuous execution type), DAND(32-bit AND 26 D P continuous execution type), WANDP(16-bit pulse execution type), DANDP(32-bit pulse execution type).

F In this instance, instruction HSCS can be used in one method, HSCS 53 D namely DHSCS(32-bit continuous execution instruction).

F In this instance, instruction PLSY can be used in two methods, PLSY namely: PLSY(16-bit continuous execution instruction), 57 D DPLSY(32-bit pulse execution instruction).

F In this instance, instruction STORE can be used in one method, STORE 100 P namely STORE(16-bit pulse execution instruction).

F In this instance, instruction ECMP can be used in two methods, ECMP namely: DECMPJ(32-bit continuous execution instruction), 110 D P DECMPP(32-bit pulse execution instruction).

6-8 Chapter 6 Interpretation of Application Instructions List of application instructions and reading instruction

②Instruction name and operand

Addition S1· S2· D·

In this instance, the instruction name is "addition" with three operands including S1·, S2·and D· “·” indicates the operand can be decorated by index. The operand without “·” can't be decorated by index.

③Device that can be specified by instruction operand

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * * * * * * * * * Note: AP300 series supports data register W.

“*”:It indicates the element can be specified. Thus: 1. Operands S1·and S2· can specify all character devices, but can't specify the bit elements. 2. Operand D· can specify all character devices except K, H and KnX, but can't specify the bit elements.

Device overview: 《Bit element》 《Character element》 X :Input relay(X) K :Integer of decimal system Y :Output relay(Y) H :Integer of hexadecimal system M :Auxiliary Relay(M) KnX :Bit specifying *1 of input relay (X) S :Status relay(S) KnY :Bit specifying *1 of output relay (Y) KnM :Bit specifying *1 of auxiliary relay (M) KnS :Bit specifying *1 of status relay (S) T :Current value of timer(T) C :Current value of timer(C) D Data Register W :Data Register*2 V、Z :Index register *1:When specifying Kn, please note that the range of value n for 16-bit instruction is K1~K4,

6-9 Chapter 6 Interpretation of Application Instructions List of application instructions and reading instruction and K1~K8 for 32-bit instruction. *2:AP300 series supports data register W. ④Instruction format and operand instruction

Instruction Format ADD S1· S2· D·

S1· :Augend. S2· :Addend. D· :Sum.

The instruction is written in above format. The operands S1·, S2· and D· are augend, addend and sum respectively.

⑤Description of instruction function

Function S1• plus S2• with symbols, and the result is stored in D1.

It is a brief introduction on the instruction function.

6-10 Chapter 6 Interpretation of Application Instructions Program flow

2 F00~F09 Program Flow

Program flow Function No. Mnemonic Name Page F00 CJ Conditional jump 6-12 F01 CALL Sub-program call 6-15 F02 SRET Sub-program return 6-15 F03 IRET Interruption return 6-17 F04 EI Interruption permitted 6-17 F05 DI Interruption inhibited 6-18 F06 FEND Main program end 6-23 F07 WDT Timer 6-24 F08 FOR Cycle loop start 6-26 F09 NEXT Cycle loop end 6-26

6-11 Chapter 6 Interpretation of Application Instructions Program flow

F00 CJ Conditional jumping F CJ Conditional jump P· 00 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z P· Instruction Format CJ P·

P· :destination symbol of conditional jump Function The instruction is executed to jump the program to the destination symbol. When PLC is used, if some program does not need to be executed every time, such instruction can be used to shorten the time of executing. For example: X000 CJ P0

Range of point (P) for AP series is: P0~P127. Of them, P63 refers to END, and do not program it. Otherwise, it may lead to error. Pointer number can be changed by index. As shown below: X000 CJ P0Z0

It is jumped to (0+ (Z0)) for execution.

Below is the description of the element actions during the execution of conditional jumping: 1. 1. Y, M and S keep the state before jumping. 2. 10ms and 100ms timers will suspend timing. 3. Timer T192~T199 (T196~T199 for AP100) or T246~T249 for executing subprogram will continue timing, and the output contact will act normally 4. High-speed counter during timing will continue counting and the output contact will act normally. 5. General counter will stop counting. 6. If clear instruction for the accumulative counter and timer is driven before jumping, it will stay in cleared status during jumping execution. 7. General application instructions will not be executed.

6-12 Chapter 6 Interpretation of Application Instructions Program flow

8 . The following application instructions will continue to be executed, including F53 (DHSCS)、F54 (DHSCR)、F55 (DHSZ)、F56 (SPD)、F57 (PLSY)、F58 (PWM)、F200 (PPMI)、F201 (PPMA)、F204 (PTPO)、F205 (CLLM)、F206 (VSPO)、F207 (ICF) and F208 (CSFO).

For example:

X000 CJ P8 If X000 is “ON”, it will jump to

X001 the next step of symbol P8. Y001 X002 M1 X003 S1 X004 T1 K10 X005 RST T246 X006 T246 K1000 X007 RST C0 X010 C0 K20

X011 MOV K3 D0 X000 If X000 is “OFF”, it will jump to P8 CJ P9 the next step of symbol P9. X012 Y001

X013 P9 RST T246

RST C0

6-13 Chapter 6 Interpretation of Application Instructions Program flow

The following table describes results of state change of the element during jumping: State of contact before Action of contact during Action of coil during Device jumping jumping jumping X001、X002、X003 X001、X002、X003 Y001、M1、S1 OFF OFF ON Y、M、S X001、X002、X003 X001、X002、X003 Y001、M1、S1 ON ON OFF X004 OFF X004 ON The timer does not act. 10ms,100ms Timing will be stopped, Timer X004 ON X004 OFF and it will be continued after X0 OFF. X005、X006 OFF X006 ON The timer does not act. Timing will be stopped, 1ms timer X005 OFF、X006 ON X006 OFF and it will be continued after X0 OFF. The counter does not X007、X010 OFF X010 ON count. Counter Counting will be X007 OFF、X010 ON X010 OFF stopped, and it will be continued after X0 OFF. Application instruction X011 OFF X011 ON is not executed. Application The jumped application instruction X011 ON X011 OFF instruction is not executed.

● Y001 becomes dual-coil, but the status of Y001 is controlled by X001 when X000=OFF. Y001 acts in accordance with X012 when X000=ON. The conditional jumping makes the same coil into more than 2 programs either in or out of the jumping even if it is segmented program. Thus, it is also treated as the general dual-coil. ● When reset instructions of the accumulated timer and counter is out of the jumping, reset of the timing coil and counting coil (contact recovery and clearing of the current value) are valid.

6-14 Chapter 6 Interpretation of Application Instructions Program flow

F01 (CALL)Call sub-program F CALL Call sub-program P· 01 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z P· Instruction Format CALL P·

P· :The destination symbol of the called sub-program. Function The instruction is sued to call the sub-program. Note:1. Range of point (P) for AP series is: P0~P127. Of them, P63 refers to END, which can not be used as pointer of FNN01 (CALL). 2. Pointer number can be changed by index.

F02 SRET Sub-program return F SRET Subroutine return 02

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z

Instruction Format SRET

Function The instruction is sued to return the sub-program. No device is applicable to the sub-program return.

6-15 Chapter 6 Interpretation of Application Instructions Program flow

Example 1:

● When X000 is ON, the instruction X000 CALL P10 CALL is executed, and it is executed after jumping to P10. Execute the Main program sub-program here. When the instruction SRET is executed, it is FEND returned to the original step sequence. Mark P 10 Routine The pointer program shall be written sub- after the instruction FEND. program ● When it is used with the instruction SRET CJ, the same pointer number P can not be used. END

Example 2: ● After X001=OFF→ON, the X001 instruction CALL P P11 is executed CALL P P11 one time, it jumps to P11. FEND ● In the sub-program of P11, if the Mark P11 instruction CALL P12 is executed, Routine sub-program of P12 is executed. After sub- CALL P12 program executing the instruction SRET, it returns to sub-program of P11 to SRET 1 execute the instruction SRET. Lastly, it Mark P12 Routine will return to the main program. sub- ● There are 16 layers of nesting in SRET 2 program maximum. END

● Timer in the sub-program employs T192~T199(T196~T199 for AP100) or T246~T249.

6-16 Chapter 6 Interpretation of Application Instructions Program flow

F03 IRET interruption return F IRET Interruption return 03

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z

Instruction Format IRET

Function If interruption occurs when processing the main program (Input, timer, and counter), it will jump to the interruption(I) program, and then return to the main program with instruction IRET.

F04 EI interruption enabled F EI Enable interruption 04

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z

Instruction Format EI

Function This instruction is used to change the PLC into the state of interruption enabled.

6-17 Chapter 6 Interpretation of Application Instructions Program flow

F05 DI interruption disabled F DI Disable Interruption 05

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z

Instruction Format DI

Function This instruction is used to disable the interruption. Note:The above 3 instructions are single instructions without driving contacts.

● Normally, the PLC is under interruption disabled. If interruption is required, the instruction FNN04 (EI) can be used to enable interruption. ● The index for interruption (I***) must be marked and programmed after the instruction FEND. ● Types of interruption: 1. Input interruption of external signal 2. Interruption of timer 3. Interruption of high-speed counter

They are described as below 《Input interruption of external signal》 X000~X005 、X010~X013 input signals are employed to execute interruption program. As the processing of the externally input signal is not affected by the computation cycle of the controller, it is applicable for picking up the adjustment control and short time pulse. See the following table for number and action of interruption pointer of 6 points. I*0* │└─> 0:Interruption of falling edge 1:Interruption of rising edge └──> X000~X005are corresponding to 0~5 Pointer number Instruction of Input Interruption Interruption disabling of rising edge of falling edge interruption X000 I001 I000 M8050 X001 I101 I100 M8051 X002 I201 I200 M8052 X003 I301 I300 M8053

6-18 Chapter 6 Interpretation of Application Instructions Program flow

X004 I401 I400 M8054 X005 I501 I500 M8055 X010 IA00 IA01 M8080 X011 IB00 IB01 M8081 X012 IC00 IC01 M8082 X013 ID00 ID01 M8083 ● The pointer number can not be used repeatedly. As for the same output, the numbers corresponding to the rising edge interruption and falling edge interruption can not be used for the input. ● If M8050~M8055、M8080~M8083 is ON, interruption to corresponding input is disabled. When the host is powered or switched from STOP→RUN, M8050~M8055、M8080~M8083 is ON.

Example: The interruption processing must be executed for the latest input information.

EI

FEND M8000 REF X010 K8 I 101 X010 SET Y001 X010 RST Y001

IRET

END

As shown in the figure, if user needs to enter program I101, it requires enabling interruption EI and M8051=0. When the rising edge of X001is ON,interruption program and input refreshing are executed. Set Y001 ON/OFF according to the ON/OFF state of X010.

《Interruption of timer》 It is not affected by scan cycle of the controller. PLC executes the interruption sub-program within an interval of 3ms~99ms. Timer interruption is mainly applicable to the situations of long computation cycle of the main program. It requires processing the specific program at high speed, or executing the program with an interval.in the sequential control scan. See the following table for number and action of interruption pointer of 3 points.

I*** Pointer Instruction of Interruption cycle │└─> 3~99(ms) number disabling

6-19 Chapter 6 Interpretation of Application Instructions Program flow

└──> 6,7,8 interruption I6** **:Integer of 3~99 M8056 I7** indicates the M8057 I8** interruption interval. M8058

● Pointer numbers (I6, I7, I8) can't be used repeatedly. ● Set M8056~M8058 as On, then interruption is disabled for corresponding timer. When the host is powered or switched from STOP→RUN, M8056~M8058 is set as On. ● It the timer is used for interruption, it requires enabling interruption EI and setting the corresponding M8056~M8058 as 0. Then the interruption sub-program will be executed every 3ms~99ms.

For example: 1 is added on each 10ms, and compare with setting values.

Program step 0 EI

X000 SET M3

FEND

Interruption M3 indicator I610 INC D0 X000 LD= K1000 D0 RST M3

IRET

END

● 1 is added on current value of D0 every 10ms. ●When current value of D0 reaches 1000, M3 will be reset.

《 Interruption of high-speed counter》 When the high-speed counter is used for the interruption of current value, it should be used with the comparison setting of FUN53 (DHSCS). When current value of the high-speed counter reaches specified values, the sub-program is interrupted. See the following table for number and action of interruption pointer of 6 points. I0*0 Pointer number Instruction of

6-20 Chapter 6 Interpretation of Application Instructions Program flow

└─> 1~6 disabling interruption I010 I020 I030 M8059 I040 I050 I060 ● Set M8059 as On, then interruption is disabled for corresponding timer. When the host is powered or switched from STOP→RUN, M8059 is set as On. ● If the high-speed counter is used for the interruption, it requires enabling interruption EI, as well as M8059=0.

For example:

Program EI step 0

M8000 C235 K2,147,483,647

D HSCS K1000 C235 I010

Specify interruption indicator number

FEND Interruption indicator I010 Interruption program

Interruption IRET return

END ● For the coil driving the high speed counter, it is used to specify the interruption pointer in the instruction FUN53(DHSCS). ● When current value of C255 varies from 999~1000, interruption sub-program is executed. ● As for current values of the high speed counter, if active/inactive control can be done for the output relay or auxiliary relay, the instructionsFUN53(DHSCS) , FUN54(DHSCR) , FUN55(DHSZ) can be used to simplify the program.

Multi-interruption input ● In case of multiple interruptions, the earlier interruption shall take the priority. In case of

6-21 Chapter 6 Interpretation of Application Instructions Program flow simultaneous occurrence, the smaller pointer number shall take the priority. ● During execution of interruption program, other interruptions are not allowed. However, interruption information during the period shall be kept, and it will be executed after the routine program is processed, with 8 interruptions in maximum. Pulse width of input interruption ●To execute input interruption with external signal, ON or OFF signal with pulse width more than 25us shall be input. Recovery of input and output ● When controlling the input relay and output relay during interruption processing, the recovery instruction FUN (REF) of output relays can be used. By obtaining the latest input information or outputting computation results immediately, it achieves high-speed control without affecting the computation cycle of the controller. Notes ●As the number of input relay for interruption pointer, please do not use the same number of the application instructions for high speed counter and pulse density with the same input range ● For the sub-program and the interruption program, please employ the timer T192~T199(T196~T199 for AP100) in the routine program. If general timer is used, timing can not be performed. When 1ms accumulated timer is used, pay attention to it.

6-22 Chapter 6 Interpretation of Application Instructions Program flow

F06 FEND main program end F FEND First end 06

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z

Instruction Format FEND

Function This instruction is a single instruction without driving contact, which indicates the end of main program. The instruction has the same effect with the instruction END, which executes output processing, input processing, refreshing of monitor timer and returning to step 0 of the program.

Main program Main program X010 X011 CJ P20 CJ P21 X010=OFF Main program Main program X011=OFF

FEND FEND X010=ON X011=ON

P20Main program P21 Main program

FEND I000 Interruption program

END END

● The instructions CALL and CALL P must be written after the instruction FEND, with the instruction SRET to end the sub-program. The interruption program must be written after the instruction FEND, with the instruction IRET to end the interruption program. ● After executing the instructions CALL and CALL P and before executing the instructions SRET and IRET; or after executing the instruction FOR and before executing the instruction NEXT; if the instruction FEND is executed, it may lead to program error. ●If multiple FEND instructions are used, the sub-program and interruption program shall be written between the last FEDN and END instructions.

6-23 Chapter 6 Interpretation of Application Instructions Program flow

F07 WDT monitor timer F WDT Monitor timer 07 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z

Instruction Format WDT

Function The instruction is used for refreshing the monitor timer to avoid error of the controller due to the delay of the scan cycle. If the scan time exceeds a certain value, PLC will stop working. Under this s circumstance, it should insert the instruction WDT in the appropriate program step to refresh the value of the timer. The value of monitor timer is set by D8000, with the range of 200ms~1600ms. For example: X000 WDT P One scan X000 WDT Each scan

125ms program 250Ms program WDT

END 125ms program END

If value of the monitor timer is set at 200ms, when scan time of the program is 250ms, it is divided into two parts. Insert WDT into it, and then the first part and second part of the program is less than 200ms. ● time of the monitor timer can be changed by changing content of D8000, as shown in the following figure:

6-24 Chapter 6 Interpretation of Application Instructions Program flow

M8002 MOV K300 D8000

WDT

● When the system is connected to many positioning, cam switch, ID interface, link, analog quantity and other special extended equipments, when the controller runs, initialization time of the buffing storage device will be extended to cause delay of the scan time. Besides, when executing sending data to several buffing storage devices, the time will be delayed. Under this circumstance, it may cause error of timeout monitor timer. At this time, input the above program near the starting step to extend time of the monitor timer.

6-25 Chapter 6 Interpretation of Application Instructions Program flow

F08 FOR cycle start F FOR Start a for/next loop S· 08

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * Note:AP300 series supports data register W. Instruction Format FOR S·

S· :Cycles. Function Please refer to the description in function NEXT.

F09 NEXT cycle end F NEXT End a for/next loop 09

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z

Instruction Format NEXT

Function This instruction is a single instruction without driving contact, which should be used with FUN08(FOR). After the instruction executes the instruction between FOR and NEXT for n times (specifying by the instruction FOR), then steps after NEXT can be processed. It is valid when n=1~32,767, when n= -32,767~0, it is processed as 1.

6-26 Chapter 6 Interpretation of Application Instructions Program flow

For example:

FOR K4

FOR D0Z0

X010 CJ P22

C FOR K1X000 AB

NEXT 1 P22 NEXT 2

NEXT 3

●After [C] program is executed for 4 times, it is moved to program after the instruction ③ of NEXT; if [C] program is executed once only, content of the data register D0Z0 is 6, and the [B] program is executed for 6 times; the instruction CJ can be used to skip program between FOR~NEXT, for example when X010=ON. ●There are 16 layers of nesting. FOR~NEXT must be in pair, otherwise, it may lead to error. ●Too many cycles may lead to delay of the scan cycle, which may cause error of the monitor timer and please pay attention.

6-27 Chapter 6 Interpretation of Application Instructions Data moving and compare

3 F10~F19 Data Moving and Compare

Data moving and compare Function No. Mnemonic Name Page F10 CMP Compare 6-29 F11 ZCP Zone compare 6-30 F12 MOV Data moving 6-31 F13 SMOV Bit moving 6-32 F14 CML Contrary moving 6-33 F15 BMOV Block moving 6-35 F16 FMOV Multi-point moving 6-36 F17 XCH Exchange 6-37 F18 BCD Conversion of BIN→BCD 6-38 F19 BIN Conversion of BCD→BIN 6-39

6-28 Chapter 6 Interpretation of Application Instructions Data moving and compare

F10 CMP Compare F CMP Compare S1· S2· D· 10 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * * * Note:AP300 series supports data register W. Instruction Format

CMP S1· S2· D·

S1· : Comparison value 1, S2· : Comparison value 2. D· :Comparison result, occupy continuous 3 points. Function The instruction is used to compare the content of operand S1· and S2·, and then save the comparison result in D·, For example: X001 CMP K20 D10 M10

When K20>current value of D10, M10=ON,M11=OFF,M12=OFF When K20=current value ofD10, M11=ON,M10=OFF,M12=OFF When K20

●Compare S1•/S2• with the integers with symbols. ● The destination address occupies the following two. If Y001 is specified, Y002 and Y003 will be occupied automatically. ●The 32-bit instruction destination operand can not specify V, and it can only specify Z. When Zn is specified, (Vn, Zn) make up 32-bit data. (The same for the following application instruction if there is no special interpretation). ● When the instruction is not executed, the destination data is not affected. ● To clear the comparison results, the reset instruction or overall instruction shall be used(as shown below).

Reset Instruction of reset instruction: all: X000 X000 RST M0 ZRST M0 M2

RST M1

RST M2

6-29 Chapter 6 Interpretation of Application Instructions Data moving and compare

F11 ZCP zone compare F ZCP Zone compare S1· S2· S· D· 11 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * S· * * * * * * * * * * * * D· * * * Note:AP300 series supports data register W. Instruction Format

ZCP S1· S2· S· D·

S1· :Lower limit of zone comparison . S2· :Upper limit of zone comparison. S· :Comparison value. D· :Comparison result, occupy continuous 3 points. Function The instruction is used to compare the comparison value S•, and the lower limit value S1• and upper limit value, and then the comparison result is stored in D•. When the lower limit value S1•> upper limit value S2•, and the lower limit S1• can be used for comparison of upper and lower limits. For example:

X001 ZCP K20 K200 C10 M10

When current value of C10

When K20≤ current value of C10≤ K200, M11=ON, M10=OFF, M12=OFF When current value of C10>K200, M12= ON, M10=OFF, M11=OFF

●Data of S1•, S2• and S0• shall be compared by integers with symbols. ● S1·≤S2·is required. WhenS2·<S1·, S2• is computed as S1•. ● The destination address occupies the following two. If M0 is specified, M1 and M2 will be occupied automatically. ● When the instruction is not executed, the destination data is not affected. ●To clear the results, the instructions RST or ZRST are used (As shown in F10 CMP data compare)

6-30 Chapter 6 Interpretation of Application Instructions Data moving and compare

F12 MOV data moving F MOV Move S· D· 12 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format MOV S· D·

S· :Data source. D· :Destination address of data moving Function The instruction is used to send the content of S• to D• directly. When the instruction is not executed, content of D• will not be changed. The 32-bit instruction employs DMOV instruction, and the operand occupies 2 characters automatically.

Instance of moving 16-bit data: When the instruction is executed, 4 bits of X10-X13 are sent to Y10~Y13, with the program as below: X000 MOV K1X010 K1Y010

It has the same function with the following sequential control program. X010 Y010 X011 Y011 X012 Y012 X013 Y013

6-31 Chapter 6 Interpretation of Application Instructions Data moving and compare

F13 SMOV bit moving F SMOV Bit moving S· m1 m2 D· n 13 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * m1 * * m2 * * D· * * * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format

SMOV S· m 1 m 2 D · n

S· :Data source. m1 :Start bit number of data source. m2 :Number of sent data source m1/ m2/ n:1~4. D· :Destination address of data moving n :Start number of bit of destination address Function BCD value if the data source sends data from its low m2 bit since the m1 bit to the m2 bit since the n bit of D. For example: SM O V D 10 K 4 K 2 D 20 K 3 When M8168=OFF: The 4th bit The 3rd bit The 2nd bit The 1st bit BIN code of D10 For source data D10, Send its BCD code converted from 103 102 101 100 converted value of D10 BCD from the low 2 bits of the 4th bit to the 3rd bit of 103 102 101 100 D20. Error will

BCD code of D20 occur if the BCD

value of D10 is BIN code converted beyond 0~9,999. automatically When M8168=ON: BIN code of D10 BCD code conversion is not executed. 4 bits

6-32 Chapter 6 Interpretation of Application Instructions Data moving and compare

BIN code of D20 are taken as one unit for bit moving.

F14 CML contrary moving F CML Compliment S· D· 14 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format CML S· D·

S· :Data source. D· :Destination address of data moving Function The instruction is to send the content of S·to D contrarily (0→1, 1→0). If the content is the constant K, K will be converted into BIN value automatically. For example:

X000 CML D10 K1Y000

D10 1 0 1 0

Unchanged 0 1 0 1 Y0 17 16 15 14 13 12 11 10 7 6 5 4 3 2 1 0

6-33 Chapter 6 Interpretation of Application Instructions Data moving and compare

X001 X001 M0 M0

X002 X002 M1 M1

X003 X003 M2 M2

X004 X004 M3 M3

The two figures above equal the following program: M8000 CML K1X001 K1M000

6-34 Chapter 6 Interpretation of Application Instructions Data moving and compare

F15 BMOV batch moving F BMOV Block move S· D· n 15 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * D· * * * * * * * n * * * * Note:AP300 series supports data register W. Instruction Format BMOV S· D· n

S· :Start address of data source D· :Destination address of data moving n :Length of moving block(n≤512). Function With the instruction, the data of point n starting with device specified by the starting address of source is transmitted to device of point n starting with devices specified by destination address. (If it exceeds range of device number, it will be transmitted within the possible scope). Instance:As shown in the figure below, when the number range overlaps, to avoid rewriting the source data before moving, the transmission method varies with the overlapping of the number, As shown in the figure, the data is automatically transmitted as per the sequence 1~3.

X000 D20 1 D19 BMOV D20 D19 K3 D21 2 D20 D22 3 D21 X000 BMOV D20 D21 K3 D20 3 D21 D21 2 D22 D22 1 D23

When M8024 is set ON, the moving direction will be contrary when executing the instruction. M8024=ON X000 D5 1 D10 M8024 D6 2 D11 D7 3 D12 BMOV D5 D10 K3 X000 M8024=OFF 1 M8024 D5 D10 D6 2 D11 D7 3 D12

6-35 Chapter 6 Interpretation of Application Instructions Data moving and compare

F16 FMOV multi-point moving F FMOV Fill move S· D· n 16 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format FMOV S· D· n

S· :Start address of data source D· :Destination address of data moving n :n≤512 Function It is the multi-point moving instruction for the same data. Content of S• is sent to the device beginning with n specified by D•. Content of device at point n is the same. When it is beyond range of the destination device, it will be moved to possible range. For example: X000 FMOV D1 D10 K3

Execution D1——————>D10 results: D1——————>D11 D1——————>D12

《Notes》 The destination operand D· in 16-bit and 32-bit instruction can not specify V and Z.

6-36 Chapter 6 Interpretation of Application Instructions Data moving and compare

F17 XCH exchange F XCH Exchange D1· D2· 17 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z D1· * * * * * * * * * D2· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format XCH D1· D2·

D1· : Exchange data 1. D2· : Exchange data 2. Function The instruction is to exchange the destination data specified by D1· and D2·. Note: The instruction generally uses the pulse type instruction XCHP. For example: X000 XCHP D10 D20

D10 100 10 D20

D20 10 100 D10

Please note that, when continuous execution instruction is used, data exchange is performed during each scan cycle. ●When M8160= ON, D1•, D2• are the same destination address, it will exchange the low 8-bit and high 8-bit content of the 16-bit data in the destination device. That is the same for the 32-bit instruction. The execution function is the same as the instruction F147(SWAP). ●When M8160= ON, D1•, D2• are different, the error mark M8067 will be set as 1, and D8067 writes in error code. The instruction will not be executed.

6-37 Chapter 6 Interpretation of Application Instructions Data moving and compare

F18 BCD BIN→BCD Conversion F BCD Conversion of BIN→BCD S· D· 18 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format BCD S· D·

S· : Data source. D· : Storage location. Function The instruction is used to convert the data source S• from BIN to BCD, which is stored in D•. Note: For 16-bit instruction, if the conversion result exceeds 0-9999, it is error. For 32-bit instruction, if the conversion result exceeds 0~99,999,999, it is error.

In case of error, M8067= ON, D8067 writes in error code. The instruction will not be executed.

6 7 8 9

BCD ? BIN F19

PLC

BIN ? BCD F18

Arithmetic operation, increasing, decreasing and other instructions are executed in BIN in PLC. When PLC reads data of external BCD digital switch, the conversion sending instruction FUN19(BCD→BIN) is used. When it outputs to BCD seven-section display, the conversion sending instruction FUN18 (BIN→ BCD)is used.

6-38 Chapter 6 Interpretation of Application Instructions Data moving and compare

However, for the special instructions such as FUN72(DSW) , FUN74(SEGL) , and FUN75(ARWS), it will execute BCD/BIN conversion automatically.

F19 BIN BCD→BIN conversion F BIN Conversion of BCD→BIN S· D· 19 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format BIN S· D·

S· : Data source. D· : Storage location. Function Content of data source S• (BCD: 0~9,999 or 0~999,99,999) is converted into BIN format, and the result is stored in D•. If S• is not BCD code, error will occur, M8067= ON, and D8067 writes in error code. The instruction will not be executed.

●The 10 positions on the BCD digital switch are corresponding to 0~9 of decimal system. Through the internal coding, the output of the digital switch is 4 binary numbers converted from the decimal number corresponding to the current position. To read the setting value of BCD digital switch in PLC, BIN instruction is used. If the data source is not BCD value, error will occur. ● The constant K is converted into binary system automatically, so it can not be the device for the instruction.

6-39 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations

4 F20~F29 Four Arithmetic Operations

Arithmetic and logic operations Function No. Mnemonic Name Page F20 ADD Addition computation 6-41 F21 SUB Subtraction computation 6-43 F22 MUL Multiple computation 6-44 F23 DIV Division computation 6-46 F24 INC Increasing computation 6-47 F25 DEC Decreasing computation 6-47 F26 AND WAND computation 6-49 F27 OR WOR computation 6-49 F28 XOR WXOR computation 6-50 F29 NEG NEG computation 6-51

6-40 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations

F20 ADD addition computation F ADD Addition S1· S2· D· 20 D P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format ADD S1· S2· D·

S1· :Augend. S2· :Addend. D· :Sum. Function S1• plus S2• with symbols, and the result is stored in D1. Note:If the computation result is 0, M8020 is set as 1. If the computation result is smaller than the minimum value,

M8021is set as 1. Bit Flag Zero M8020 If the computation result is larger than the maximum value, Borrow M8021 M8022 is set as 1. Carry M8022

Result of 16-bit computation is between -32,768 ~ +32,767. Result of 32-bit computation is between-2,147,483,648 ~ +2,147,483,647.

● The two data sources are added in BIN and sent to the destination data zone. The highest bit of the data is the positive (0) or negative (1) symbol bit, therefore, algebraic addition shall apply. (5+(﹣8)=﹣3) ● When the computation result is 0, the zero flag sign acts. When the computation result exceeds 32,767(16-bit computation) or 2,147,483,647(32-bit computation), the carrying flag sign will act. If the computation result is smaller than -32,768(16-bit computation) or -2,147,483,648(32-bit computation), the negative flag sign will act. (Refer to FUN21 SUB for the action of flag sign) ● For 32-bit computation, lower 16-bit element of character element shall be specified and upper word of specified number is used. To avoid repeated number, even number is used for specifying elements. ● Please specify the same number for the data source and destination data zone. If the continuous execution instruction (ADD,D ADD) is used, the addition result of each scan time is changing.

6-41 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations

Please pay attention to it. X000 ADD P D1 K1 D1

● See the sequential control program in the above figure, when X000 is changed from OFF-ON, 1 is added on value of D1, which is similar to the function of instruction FUN24 INC P.

6-42 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations

F21 SUB subtraction computation F SUB Subtraction S1· S2· D· 21 D P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format SUB S1· S2· D·

S1· :Minuend. S2· :Subtrahend D· :Difference. Function It is to subtract the data of S1· and S2· in BIN, and store the result in D·. For the highest bit of the data in S1·, S2· and D·, 0 represents positive, 1 represents negative, and algebraic subtraction is executed. For example: X000 SUB D1 D2 D3

● When X000 is ON, content of minuend D1 minus content of subtrahend D2 in algebraic means, and the difference is stored in D3. ● As for the flag action, specifying method of 32-bit computation element, difference of the continuous execution and pulse execution , it is the same as the instruction ADD in previous page. ● The flag actions and relation of positive/negative values are shown as below Zero mark Zero mark Zero mark

-2? -1? 0? -32,768 -1? 0? 132,767? 0? 1? 2

Borrowin Carrying g mark The highest The highest mark bit is 1 bit is 0 Zero mark Zero mark

-2? -1? 0? -2,147,483,648 -1? 0? 1 2,147,483,647? 0? 1? 2

Borrowin Carrying Zero mark g mark mark

6-43 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations

F22 MUL multiple computation F MUL Multiplication S1· S2· D· 22 D P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format MUL S1· S2· D·

S1· :Multiplicand. S2· :Multiplicator. D· :Product. Function It is to multiply the data of S1· and S2· in BIN, and store the result in D·. For the highest bit of the data in S1·, S2· and D·, 0 represents positive, 1 represents negative, and algebraic multiplication is executed.

《16-bit computation》 X000 MUL D0 D2 D4

● The product computed from specified content of the data bit is stored in specified device (the lower side), meanwhile, it occupies the last device to make up 32-bit data. See the above figure, when D0)=8,(D2)=9, (D5,D4)=72. ●The highest bit of the result is the symbol bit for positive (0) and negative (0). ● When D• is bit element, it could execute bit specifying for K1~K8. When K4 is specified. only the low 16-bit of the product can be obtained. 《32-bit computation》 X000 DMUL D0 D2 D4

● See the figure above: (D1,D0)=8,(D3,D2)=9 时,(D7,D6,D5,D4)=72. ● For 32-bit computation, if the64-bit computation result storage element is bit, the result is only stored in the lower 32-bit. There is no result of high 32-bit. Thus, the character element can be

6-44 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations used for computation. ● When character element is used, the computation result is stored as 64-bit data, therefore. Thus, the result can not be viewed. ● D• can not specify Z and V elements.

6-45 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations

F23 DIV division computation F DIV Division S1· S2· D· 23 D P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format

DIV S1· S2· D·

S1· :Dividend. S2· :Divisor . D· :Quotient. Function It is to divide the data of S1· and S2· in BIN, and store the result in D·. For the highest bit of the data in S1·, S2· and D·, 0 represents positive, 1 represents negative, and algebraic division is executed.

《16-bit computation》 X000 DIV D0 D2 D4

● See the figure above: D0 is the dividend, and D2 is divisor. D4 stores the quotient by the computation and D5 stores the residual by the computation. 《32-bit computation》 X000 DDIV D0 D2 D4

● See the figure above: (D1,D0) is the dividend, and (D3,D2) is divisor. (D5,D4) stores the quotient by the computation and (D7,D6) stores the residual by the computation. ● D• can not specify Z and V elements. Note:1. When the divisor is 0, it may cause error and the instruction will not be executed D8067=6706. 2. When D• is specified as bit element, residual can not be obtained. 3. The highest bit of the quotient and residual is the symbol bit for positive (0) and negative (0). The quotient is negative when any of the dividend and divisor is negative; The residual is negative when the dividend is negative.

6-46 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations

F24 INC increasing computation F INC Increment D· 24 D P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format INC D·

Function Every time the instruction is driven, 1 is added to D· Note: The instruction is of pulse instruction in general. Otherwise, when the instruction is executed, 1 is added on each scan cycle D•. Please pay attention to it. For 16-bit computation, if 1 is added to +32,767, it becomes -32,768, and the flag does not act. For 32-bit computation, if 1 is added to +2,147,483,647, it becomes -2,147,483,648, and the flag does not act.

F25 DEC decreasing computation F DEC Decrement D· 25 D P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format DEC D·

Function Every time the instruction is driven, 1 is subtracted from D· Note:The instruction is of pulse instruction in general. Otherwise, when the instruction is executed, 1 is subtracted from each scan cycle D•. Please pay attention to it. For 16-bit computation, if 1 is subtracted from ﹣32,768, it becomes ﹢32,767, and the flag does not act. For 32-bit computation, if 1 is subtracted from ﹣ 2,147,483,648, it becomes ﹢ 2,147,483,647, and the flag does not act.

6-47 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations

For example: X010 MOV P K0 Z0 M1

X011 BCD P C0Z0 K4Y000

INC P Z0

CMP K10 Z0 M0

● Input reset X010 is used to clear Z0 in advance. ● When current values of the counters C0~C9 are converted for BCD, it is output to K4Y000. ●When X011 is ON one time, it outputs current values of C0, C1…C9.

6-48 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations

F26 AND WAND computation F W AND WAND computation S1· S2· D· 26 D P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format

WAND S1· S2· D·

S1· :Data source 1. S2· :Data source 2. D· :Computation result. Function Conduct WAND computation for the data in S1· and S2·. (WAND:16-bit instruction; DAND:32-bit instruction. ) If the same bit of two operands is 1 during the computation, the logic result of the bit is 1. Otherwise, it is 0.

F27 OR WOR computation F W OR WOR computation S1· S2· D· 27 D P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format WOR S1· S2· D·

S1· :Data source 1. S2· :Data source 2. D· :Computation result. Function Conduct WOR computation for the data in S1· and S2·. (WOR:16-bit instruction;

6-49 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations

DOR:32-bit instruction ) If the same bit of either of two operands is 1 during the computation, the logic result of the bit is 1. Otherwise, it is 0.

F28 XOR WXOR computation F W XOR WXOR computation S1· S2· D· 28 D P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format WXOR S1· S2· D·

S1· :Data source 1. S2· :Data source 2. D· :Computation result. Function Conduct XWOR computation for the data in S1· and S2·. (WXOR:16-bit instruction; DXOR:32-bit instruction) If two operands are the same during the computation, the logic result of the bit is 0. Otherwise, it is 1.

6-50 Chapter 6 Interpretation of Application Instructions Arithmetic and logic operations

F29 NEG NEG computation F NEG Negative D· 29 D P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format NEG D·

Function Reverse each bit of the content specified by D•, 1 is added on them, and the result is stored in D•. ● The instruction is of pulse instruction. The execution of continuous execution instruction will be after each scan cycle. Please pay attention to it. ● When the instruction is used, the absolute value corresponding to negative BIN value shall be obtained. Note:After computation of-32,768, it is still -32,768.

Example 1:Absolute value processing of negative value M8000 BON D10 M0 K15 M0 NEG P D10

When 15th bit of D10 is 1, M0 is set ON. When M0 is ON, apply complement code instruction for D10. Example 2:Absolute value processing of subtraction X000 CMP D10 D20 M10 M10 SUB D10 D20 D30 M11

M12 SUB D20 D10 D30

Even if complement code is not used for the above loop, (D30) represents absolute value of the difference in subtraction.

6-51 Chapter 6 Interpretation of Application Instructions Rotation and shift

5 F30~F39 Rotation and Shift

Rotation and shift Function No. Mnemonic Name Page F30 ROR Cyclic shifting right 6-53 F31 ROL Cyclic shifting left 6-53 F32 RCR Cyclic shifting right with carrying 6-55 F33 RCL Cyclic shifting left with carrying 6-55 F34 SFTR Bit moving right 6-57 F35 SFTL Bit moving left 6-57 F36 WSFR Word shitting right 6-59 F37 WSFL Word shitting left 6-59 F38 SFWR Shift writing 6-61 F39 SFRD Shift read 6-62

6-52 Chapter 6 Interpretation of Application Instructions Rotation and shift

F30 ROR cyclic shifting right F ROR Rotation right D· n 30 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z D· * * * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format ROR D· n

D· :Data source. n :Bit number of cyclic shifting right. For 16-bit instruction, n≤16;for 32-bit instruction, n≤32. Function It is the instruction to make each bit of 16-bit/32-bit data shift right.

F31 ROL cyclic shifting left F ROL Rotation left D· n 31 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z D· * * * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format ROL D· n

D· :Data source. n :Bit number of cyclic shifting right. For 16-bit instruction, n≤16;for 32-bit instruction, n≤32. Function It is the instruction to make each bit of 16-bit/32-bit data shift left.

6-53 Chapter 6 Interpretation of Application Instructions Rotation and shift

For example: 《Left gyration》 《Right gyration》

X000 X000 ROL P D0 K4 ROR P D0 K4

Left Right Upper Lower Lower gyration Upper gyration position position position position 1111 111100000000 1111 111100000000 ※ ※ n bit M8022 M8022 n bit Carrying Carry After one After one Upper Lower position execution Lower position Upper position execution position 0000 111111110000 1111 000000001111 ※ ※ M8022 0 1 M8022 ※ ※

Instruction interpretation When X000 is from OFF to ON, K4-bit left(right) gyration is executed, and the last bit is stored in the carrying flag sign M8022. ● The 16-bit/32-bit continuous execution instruction will gyrate after each scan cycle. Please pay attention to it. ●When bit is used to specify the element, only K4 (16-bit instruction) and K8 (32-bit instruction) are effective (Such as K4Y010 and K8M0)

6-54 Chapter 6 Interpretation of Application Instructions Rotation and shift

F32 RCR rotation right with carry F RCR Rotation right with carry D· n 32 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z D· * * * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format RCR D· n

D· :Data source. n :Bit number of cyclic shifting right. For 16-bit instruction, n≤16;for 32-bit instruction, n≤32. Function It is the instruction to make the carrying flag M8022 for each bit of 16-bit/32-bit data shift right.

F33 RCL cyclic shifting left with carrying F RCL Rotation left with carry D· n 33 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z D· * * * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format RCL D· n

D· :Data source. n :Bit number of cyclic shifting right. For 16-bit instruction, n≤16;for 32-bit instruction, n≤32. Function It is the instruction to make the carrying flag M8022 for each bit of 16-bit/32-bit data shift left.

6-55 Chapter 6 Interpretation of Application Instructions Rotation and shift

For example: 《Left gyration with carrying》 《Right gyration with carrying》 X000 X000 RCL P D0 K4 RCR P D0 K4

Right Left Upper Lower Upper gyration Lower gyration position position position position 1111 111100000000 1111 111100000000 ※ ※ M8022 M8022 n bit Carrying Carry n bit cycling cycling Ex: After one Ex: M8022=OFF After one Lower Upper M8022=ON Upper execution Lower position position position position execution 1111 000000000111 0001 111111110000 1 M8022 M8022 0 ? ※ Instruction interpretation When X000 is changed from OFF to ON, K4 with carrying flag M8022 will gyrate to the left (right). The 16-bit/32-bit continuous execution instruction will gyrate after each scan cycle. Please pay attention to it. When bit is used to specify the element, only K4 (16-bit instruction) and K8 (32-bit instruction) are effective (Such as K4Y010 and K8M0).

6-56 Chapter 6 Interpretation of Application Instructions Rotation and shift

F34 SFTR bit moving right F SFTR Bit shift right S· D· n1 n2 34 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * D· * * * n1 * * n2 * * Instruction Format SFTR S· D· n1 n2

S· :Start number of shift device. n1 :Data length to be shifted, n1=1~1024. D· :Start number of device to be shift n2 :Bit number for one shifting, n2=1~n1。 Function For the bit device of n1 bits(length of moving register) started with D·, it moves right with n2 bits. The bit device started with S. is moved to D. to fill the empty element with n2 bits.

F35 SFTL bit moving left F SFTL Bit shift left S· D· n1 n2 35 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * D· * * * n1 * * n2 * * Instruction Format SFTL S· D· n1 n2

S· :Start number of shift device. n1 :Bit length for one shifting, n1=1~1024. D· :Start number of device to be shift n2 :Bit number for one shifting, n2=1~n1。 Function For the bit device of n1 bits(length of moving register) started with D·, it moves left with n2 bits. The bit device started with S. is moved to D. to fill the empty element with n2 bits. Note:The instruction is of pulse instruction in general. When continuous execution instruction is used, it will execute in each scan cycle.

6-57 Chapter 6 Interpretation of Application Instructions Rotation and shift

《Bit shift right》

X000 ①M3~M0→Overflow SFTR P X000 M0 K16 K4 ②M7~M4→M3~M0 ③M11~M8→M7~M4 ④M15~M12→M11~M8 X003 X002 X001 X000 N2 shifting ⑤X003~X000→M15~M12 right 5 M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0

4 3 2 1 《Bit shift left》

Conditional step for 1-bit data

X000 M8046 M0 M8046 X000 SFTL M0 S0 K8 K1 S0 X001

S1 X002 8-character shifting register of S0~S7 with

S7 X000 1-bit of M0 taken as starting input

M8000 MOV K2S0 K2Y000

M8047

END

X000

X001 Even if X000 is ON, Y000 won’t act. X007

Y000

Y001

Y007

6-58 Chapter 6 Interpretation of Application Instructions Rotation and shift

F36 WSFR word shifting right F WSFR Word shift right S· D· n1 n2 36 P Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * D· * * * * * * * n1 * * n2 * * Note:AP300 series supports data register W. |Instruction Format WSFR S· D· n1 n2

S· :Start number of shifting device. n1 :Bit length to be shifted with word as unit, D· : Start number of device to be n1=1~512. shifted. n2 :Word number for one shifting, n2=1~n1. Function For the data tandem of n1 bits(length of moving register) started with D·, it moves right with n2 words. The word device started with S. is moved to D. to fill the empty element with n2 words.

F37 WSFL word shifting left F WSFL Word shift left S· D· n1 n2 37 P Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * D· * * * * * * * n1 * * n2 * * Note:AP300 series supports data register W. |Instruction Format WSFL S· D· n1 n2

S· :Start number of shifting device. n1 :Bit length to be shifted with word as unit, D· : Start number of device to be n1=1~512. shifted. n2 :Word number for one shifting, n2=1~n1. Function For the data tandem of n1 bits(length of moving register) started with D·, it moves left with n2 words. The word device started with S. is moved to D. to fill the empty element with n2 words. Note:The above two instructions generally use the pulse type instruction.

6-59 Chapter 6 Interpretation of Application Instructions Rotation and shift

S· and D· can't specify the same element. When S• and D• are specified as bit combined device, the same bit specifying is required. 《Word shift right》

X000 ①D13~D10→Overflow WSFR P D0 D10 K16 K4 ②D17~D14→D13~D10 ③D21~D18→D17~D14 ④D25~D22→D21~D18 D3 D2 D1 D0 N2 bit shifting ⑤D3~D0→D25~D22 right 5 D25 D24 D23 D22 D21D20D19D18D17 D16 D15 D14 D13 D12 D11 D10

2 4 3 1

《Word shift left》

Shifting of bit specifying element

X000 WSFR P K1X000 K1Y000 K4 K2

Please make the bit matching X7 X6 X5 X4 X3 X2 X1 X0

3 Y17Y16Y15Y14Y13Y12Y11Y10 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0

2 1 Please conduct the same bit specifying on the bit element.

6-60 Chapter 6 Interpretation of Application Instructions Rotation and shift

F38 SFWR shift writing F SFWR Shift register write S· D· n 38 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format SFWR S· D· n

S· :Source device for shifting writing D· :Start device for writing destination data tandem N :Data length to be written, n=2~512 (Actual data length to be written is n-1. The start device D• is taken as the pointer for writing points). Function It is the instruction to control the first-in first-out data writing. For example: X000 SFWR P D0 D1 K10

D0 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1

● D1 shall be reset to 0 in advance. ● When the driving X000 is changed from OFF to ON, content of D0 is written into D2 and content of D1 is changed to 1. When X000 is changed from OFF to ON once again, content of D0 is written into D3 and content of D1 is changed to 2. (When continuous execution instruction is used, it will be saved after one scan cycle) ● Content of the pointer D1 is taken as current points of written data. When content of D1 exceeds n-1, it stops executing and the carrying flag M8022 works.

6-61 Chapter 6 Interpretation of Application Instructions Rotation and shift

F39 SFRD shift read F SFRD Shift register read S· D· n 39 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * D· * * * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format SFRD S· D· n

S· :Tandem start device of shifting read data D· :Destination device storing the data tandem read. n :Data length for shifting read, n=2~512 (Actual length to be read is n-1. The read start device is taken as pointer to judge stopping instruction execution). Function It is the instruction to control the first-in first-out data reading. For example:

X000 SFRD P D1 D20 K10

D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D20

● When the driving X000 is ON from OFF, content of D2 will be read to D20. At the same time, 1 is subtracted from content of the pointer D1. Data at the left side moves one bit to the right side(content of D10 is not changed). When X000 is ON from OFF once again, content of D2 is read to D20 and 1 is subtracted from content of D1. (When continuous execution instruction is used, it will execute one reading and shifting in one scan cycle) ● When content of the pointer D1 is 0, the instruction stops executing, and the zero point flag M8020 acts.

6-62 Chapter 6 Interpretation of Application Instructions Rotation and shift

《Instance of first-in and first-out control》 Shifting writing and reading The product number is registered while warehousing, to ensure first in first out for outgoing. An instance is shown as below. The product is 4 numbers of hexadecimal system and the maximum number is below 99 points. X020 X000~X017 is the input of product number to be MOV P K4X000 D256 transmitted to D256. In D257 is index, D258~D356 is the data register SFWR P D256 D257 K100 Out used to store the 99-point product number. X021 SFRD P D257 D357 K100 The first-in number will be first out to D357.

M8000 The output product number will be represented by MOV D357 K4Y000 4 hexadecimal numbers, Y000~Y017.

6-63 Chapter 6 Interpretation of Application Instructions Data processing

6 F40~F49 Data Processing

Data processing Function No. Mnemonic Name Page F40 ZRST Zone reset 6-65 F41 DECO Decoder 6-66 F42 ENCO Encoder 6-67 F43 SUM ON bit sum 6-68 F44 BON ON bit judging 6-69 F45 MEAN Mean value 6-70 F46 ANS Alarm coil set 6-71 F47 ANR Alarm coil reset 6-72 F48 SOR BIN square root computation 6-74 F49 FLT BIN integer →binary floating point 6-75

6-64 Chapter 6 Interpretation of Application Instructions Data processing

F40 ZRST zone reset F ZRST Zone reset D1· D2· 40 P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z D1· * * * * * * * D2· * * * * * * * Note:AP300 series supports data register W. |Instruction Format ZRST D1· D2·

D1· :Start device for all clearing. D2· :End device for all clearing, D1• number≤D2• number. Devices of the same type must be specified, otherwise, it may lead to instruction error, D8067=6705. Function It is to reset the batch zone value of the devices under the same type. For example: X000 ZRSTP M100 M200

When X000 is from OFF to ON, M100 to M200 are fully cleared. ● When the operand number of D1·>the operand number of D2·, only the operand specified by D1· can be cleared. ●The instruction is executed with 16-bit, however, D1•/D2• can specify 32-bit counter. They can't be specified in a mixed way. For example, D1• is 16-bit counter, while D2• is 32-bit counter. ● The instruction is of pulse instruction in general. As for bit elements Y, M and S and word elements T, C and D, they can use instruction RST, which is an independent resetting instruction for the device. As for word elements KnY, KnM, KnS, T, C, D, the instruction FMOV can be used to write the constant K0 in the elements in batches.

X000 RST M0 Reset M0

RST T0 Coil value for resetting T0

RST M0 Reset D0 X001 FMOV K0 D0 K100 Write K0 to D0~D99

6-65 Chapter 6 Interpretation of Application Instructions Data processing

F41 DECO decoder F DECO Decoder S· D· n 41 P

Bit element Character element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format

DECO S· D· n

S· :Source device for decoding. D· :Device for storing decoding results. When D· is bit device, n=1~8. D· is bit device, n=1~4. n :Decoding bit length, n=1~8. When n=0, it is not processed. When it is beyond 0~8, the error flag will act. Function Low bit n of the source device is taken for decoding and result of 2n bit length is stored in D•. Note:The instruction is of pulse instruction in general. For example:

X004 DECO X000 M0 K3

X002 X001 X000 0 1 1 ② ①

③ M7 M6 M5 M4 M3 M2 M1 M0 0 0 0 0 1 0 0 0 The data source is1×20+1×21+0×22=3, so M3 from the 3rd bit of M0 is set as 1, and other bits are 0. When D· is bit element, n=8, 28=256 points. When D. is word element, each word element is of double byte, namely 16-bit. When n=4, 24=16 points. When n<4, the high bit of D· is for zero extension.

6-66 Chapter 6 Interpretation of Application Instructions Data processing

F42 ENCO encoder F ENCO Encoder S· D· n 42 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * D· * * * * * * n * * Note:AP300 series supports data register W. Instruction Format

ENCO S· D· n

S· :Source device for coding. D· :Device for storing coding results n :Coding bit length. When S· is bit device, n=1~8; when S· is word element, n=1~4. Function For the data with the source device S· as the start address and the length of 2n bits, the position with the highest bit of 1 is stored in the element specified by destination D·. The range of D· is determined by n. It is not processed when n=0. When it is beyond 0~8, the error flag acts. Note:The instruction is of pulse instruction in general. For example: X000 ENCO M0 D0 K3

M7 M6 M5 M4 M3 M2 M1 M0 0 0 0 0 1 0 1 0

b15 b0 0 0 0 0 0 0 00000000 1 1 ←n=3 bit→

When several bits in the data source are 1, 1 at low bit will not be processed. When all data sources are 0, it is error. When S· is bit element, n=8, 28=256 points. When S· is word element, n=4, 24=16 points.

6-67 Chapter 6 Interpretation of Application Instructions Data processing

F43 SUM ON bit sum F SUM Sum of active bits S· D· 43 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format

SUM S· D·

S· :Source device. D· :Destination device for storing counting values. Function It is to count the sum of bits set as "1" in the specified source device, and store the results in the specified destination device D. For example:

X000 SUM D0 D2

0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 7 D0 D2 ● If 16 bits in D0 are 0, the zero flag M8020 will act. ● When 32-bit instruction is used, D• still occupies 2 registers. See the figure above, number of 1 of 32-bit of (D1,D0) is written into D2, at the same time, D3 becomes 0.

6-68 Chapter 6 Interpretation of Application Instructions Data processing

F44 BON ON bit judging F BON Check specified but status S· D· n 44 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * * * n * * Note:AP300 series supports data register W. Instruction Format

BON S· D· n

S· :Source device. D· :Device for storing judging results. n :When specify judging bit, n=0~15 (16-bit instruction), n=0~31 (32-bit instruction). Function It is used to judge the status of a certain bit (bit n) in the specified source device S·, and store the results in the destination device D·. If the bit is “1”, the destination device is “1”, otherwise, it is “0”. For example: X000 BON D10 M0 K15

b15 b0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 M0=OFF D10 1 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 M0=ON D10 When 16-bit computation is executed, n=0~15; for 32-bit computation, n=0~31.

6-69 Chapter 6 Interpretation of Application Instructions Data processing

F45 MEAN Mean value F MEAN Mean value S· D· n 45 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * D· * * * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format

MEAN S· D· n

S· :Start address of several devices for mean value computation. D· :Destination device for storing mean values. n :Specify number for mean value computation, n=1~64. Function Compute the mean value for several data. For example: X000 MEAN D100 D150 K5

The above program is (D100+D101+D102+D103+D104)/ 5 D150

● Mean value (the algebraic sum is divided by n) of point n is stored in the destination address. The residual is ignored. If it exceeds the device number, max value of n is obtained in possible range. ● When n is beyond 1~64, error will occur. When it is beyond the range specified by n, the instruction will calculate the mean value in effective range. See the followings: X000 MEAN D8510 D0 K3

(D8510+D8511)/ 2 D0

6-70 Chapter 6 Interpretation of Application Instructions Data processing

F46 ANS alarm coil set F ANS Timed alarm set S· m D· 46

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * m * * D· * Instruction Format

· · ANS S m D S· :Detecting alarm timer, only 100ms timer can be used. Type Number T of 100ms timer AP100 T0~T39,T196~T199 AP200 T0~T199 AP300 T0~T199 m :Timing time, m=1~32,767(Unit 100ms). D· :Alarm point device, only S900~S999 can be used. Function It is the instruction used to drive signal alarm. For example: X000 ANS T0 K10 S900

● If X000 is active for more than 1 second, S900 is set. Even X000 is OFF (the timer is reset), S900 keeps acting. If it is less than 1 second, when X000 or X001 is OFF, the timer is reset. ● If M8049(The signal alarm is effective) is ON, the minimum number of the signal alarm S900~S999 which are ON is stored in D8049. In addition, if any of S900~S999 is ON, M8048 (the alarm acts) is ON.

6-71 Chapter 6 Interpretation of Application Instructions Data processing

F47 ANR alarm coil reset F ANR Annunciator reset 47 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z

Instruction Format ANR

Function It is to reset the driven alarm. For example: X000 ANR

If X000 is active, the acting points of the signal alarm S900~S999 are reset. If several alarm points act simultaneously, the alarm point with minimum number will be reset. At this time, if the effective flag M8049 of the signal alarm is ON, content of the register D8049 will be updated timely and the minimum number of the left alarm points will be stored. If X000 is active a second time, state of the next number will be reset. If the instruction ANR is used, it is reset in each scan cycle according to the sequence. Please pay attention to it. The following figure describes the external failure diagnosis circuit. The special data register D8049 is used to monitor the minimum number of action state numbers of S900~S999. In case of several failures, after the failure with minimum number is fixed, the next failure number is displayed.

6-72 Chapter 6 Interpretation of Application Instructions Data processing

M8000 M8049

Y005 X000 ANS T0 K10 S900 X001 X002 ANS T1 K20 S901 X003 X004 ANS T2 K100 S902 X005 Y005 M8048 Y006 X007 ANR P

END

● When the special auxiliary relay M8049 acts, monitoring can be performed. ● When Y005 is driven, S900 acts if X000 fails to act within 1 second. ● In case of error on DOG, if X001 and X002 fail to act simultaneously over 2 seconds, S901 acts. ● When T2 is less than 10 seconds and the input point X003 is ON, if X004 does not act during 1 operation cycle, S902 acts. ● When there is ON between S900~S999, the special auxiliary relay M8048 acts, and the output Y006 acts. ● Before executing the external failure diagnosis program, set X007 OFF; when X007 is ON, the minimum number will be cleared in sequence.

《Alarm coil is effective M8049》 When M8049 is set ON, minimum number of action state of S900~S999 is stored in D8049. 《Alarm coil acts M8048》 When M8049 is set ON, in case of acting between S900~S999, M8048 will act.

6-73 Chapter 6 Interpretation of Application Instructions Data processing

F48 SQR BIN square root computation F SQR Square root of BIN S· D· 48 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * D· * * Note:AP300 series supports data register W. Instruction Format

SQR S· D·

S· :Data source for square root. D· :Destination device for storing results. Function It is to execute square root for the data in S·, and store the results in the device specified by D· For example:

X000 SQR D0 D1

When X000 is ON, after square root is executed for data in D0, the result is stored in D1. ● S• is valid for non-negative. If it is negative, it may lead to error, the flag M8067 is ON, and the instruction will not be executed. ● The computation result D• is integer, the decimal is ignored, and the borrowing flag signal M8021 is ON. ● When the computation result is 0, the zero flag M8020 acts.

6-74 Chapter 6 Interpretation of Application Instructions Data processing

F49 FLT BIN integer →binary floating point F BIN integer→binary floating FLT S· D· 49 D P point

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * D· * * Note:AP300 series supports data register W. Instruction Format

· · FLT S D S· :Data source for conversion from BIN integral→ Binary floating-point number. D· :Destination device for storing results. Function It is to convert the values stored in S· into floating point value, and store the value in D· For example: X000 FLT D0 D2 X001 DFLT D0 D2

● The constants K and H are automatically converted in the floating-point computation instruction, so the instruction FLT cannot be used. ● Reverse conversion instruction for the instruction is FUN129(INT).

6-75 Chapter 6 Interpretation of Application Instructions Data processing

See the following sequential control on the floating-point computation instance.

(D0) ÷ (X017~X010) ×K34.5 D11,D10 16-bit BIN BCD 2-bit 6

7 1 2 5 4 (D13,D12)

For monitoring decimal floating-

( point numbers ( 8 (D21,D20 ( D22) BIN (D27,D26 (D15,D14) Binary floating- 32-bit BIN

3 point number integer (D25,D24 ( Binary floating- point number

(D29,D28 ( Binary floating- point number

M8000 1 (D0)→ (D21,D20) FLT D0 D20 Binary floating- BIN point number

2 BIN K2X010 D22 (X017~X010)→(D22) BCD BIN

(D22)→(D25,D24) 3 Binary floating- FLT D22 D24 BIN point number

4 K345 ÷ K10→(D27,D26) D EDIV K345 K10 D26 Binary floating- point number

5 D EDIV D20 D24 D28 (D21,D20)÷(D25,D24) → (D29,D28) Division computation of binary Binary floating- floating-point numbers point number 6 D EMUL D28 D26 D10 (D29.D28)×(D27.D26) → (D11,D10) Multiple computation of binary floating-point numbers 7 D EBCD D10 D12 (D11,D10)→ (D13,D12) Binary floating- For monitoring decimal floating- point number point numbers ( )→ 8 D INT D10 D14 BinaryD11,D10 floating- (D15,D14) 32-bit BIN integer point number

6-76 Chapter 6 Interpretation of Application Instructions High speed counting processing

7 F50~F59 High Speed Counting Processing

High speed counting processing Function No. Mnemonic Name Page F50 REF Input/output refresh 6-78 F52 MTR Matrix input 6-80 F53 HSCS Comparison setting 6-83 F54 HSCR Comparison resetting 6-85 F55 HSZ Zone compare 6-87 F56 SPD Pulse density 6-89 F57 PLSY Pulse output 6-91 F58 PWM Pulse modulating 6-94 F59 PLSR Ramp pulse output 6-95

6-77 Chapter 6 Interpretation of Application Instructions High speed counting processing

F50 REF input/output refresh F REF Input/Output refresh D n 50 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z D * * n * * Instruction Format REF D n

D :Start device number for input and output refreshing. n :Refreshing points. Function When the latest input information is required or you hope to output the computation results during PLC computation process, the input/output refresh instruction can be used.

AP Series Type Refreshing range X0~X5,6 points(when the refreshing point n is equal to 8, only X0~X5 can X be refreshed actually) AP-110 Y0~Y3,4 points(when the refreshing point n is equal to 8, only Y0~Y3 can Y be refreshed actually) X X0~X7,8 points AP-114 Y0~Y5,6 points(when the refreshing point n is equal to 8, only Y0~Y5 can Y be refreshed actually) X0~X13 , 12 points(when the refreshing point n is equal to 16, and refreshing is started from X0, only X0~X13 can be refreshed actually; X AP-120 similarly, when the refreshing point n is equal to 8, and refreshing is started from X10, only X10~X13 can be refreshed actually) Y Y0~Y7,8 points X0~X5,6 points(when the refreshing point n is equal to 8, only X0~X5 can X AP-130 be refreshed actually) Y Y0~Y7,8 points AP-200 X0~X5,6 points(when the refreshing point n is equal to 8, only X0~X5 can X series be refreshed actually) AP-300 Y Y0~Y7,8 points series

6-78 Chapter 6 Interpretation of Application Instructions High speed counting processing

PLC employs central input and output refreshing. The input terminal information is read by input memory before step 0 computation. After the output terminal executes the instruction END, it is output through the latching storage device from the output memory. However, when the latest input information is required or you hope to output the computation results during PLC computation process, the input/output refresh instruction can be used.

Example 1:Input refresh: X000 Refresh X000~X007, with REF X000 K8 8 points in total

Example 2:Output refresh: X000 Refresh X000~X007, with REF Y000 K8 8 points in total

● When specifying the start device number D•, set the lowest bit number 0, such as X000, X010, and Y000. ● The refreshing point n shall be 8 or 16 points, otherwise, it may lead to error. ● In general, the REF instruction can be used among the instructions FOR~NEXT and the instruction CJ. ● In the interruption processing with input and output actions, the latest input information and timely output of computation results can be obtained by executing the instruction.

6-79 Chapter 6 Interpretation of Application Instructions High speed counting processing

F52 MTR matrix input F MTR Matrix input S· D1· D2· n 52

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * D1· * D2· * * * n * * Note 1:AP100 1.2 and above versions are supported. Note 2:The limit on simultaneous driving of the instruction is 1. Instruction Format MTR S· D1· D2· n

S· :Start device for matrix scan input, which occupies 8 continuous points. It is suggested the rightmost number shall be 0, such as X000, X010 and etc. D1· :Start device for matrix scan output. Also the rightmost number is suggested to be 0, such as Y000, Y010, Y020 and etc. D2· :Start device for matrix scan output. Also the rightmost number is suggested to be 0, such as M10 and etc. n :row of matrix scan, n=2~8 is valid. Function The instruction uses 8 points input and n points output, and reads n rows of 8-point input signal instruction.

For example: M0 MTR X020 Y040 M10 K3

6-80 Chapter 6 Interpretation of Application Instructions High speed counting processing

Diode 0.1A(50V)

24V 0V S/S X20 X21 X22 X23 X24 X25 X26 X27

COM Y40 Y41 Y42 Y43 Y44 Y45 Y46 Y47

M0

Input of the first row

Y040 1 4

Input of the second row

Y041 2 5

Input of the third row

Y042 3 6

20ms

M8029

● Start with specified input S•, occupying 8 points input. ● Start with specified output D1•, occupying 3 points output. ● The example in the figure: n=3 points outputs Y040, Y041 and Y042 are cyclically ON. The inputs in the first row, second row and third row are obtained cyclically, which are stored in M10~M17, M20~M27 and M30~M37.

6-81 Chapter 6 Interpretation of Application Instructions High speed counting processing

●M8029 is set for a scan cycle after the first cycle ends. 《Input numbers used for the instruction MTR》 Input number of the instruction MTR shall be used after X020. When the instruction MTR is used, the transistor output shall be connected to the resistor (3.3K/0.5W).

Matrix loop

COM 24V X000 X001 X002 X003 X004 X005 X006 X007

Transistor output PLC

COM Y000 Y001 Y002 Y003 Y004 Y005 Y006 Y007

3.3KΩ/0.5W

Supplementary description: When executing the instruction, it must go through n(number of rows for matrix scan) scan cycles to catch the input value of a button effectively. When the scan period is too long or too short, it may cause bad pressing. Therefore, the following skill can be applied to overcome. 1. When the scan cycle is too short, it might results in I/O fails to read the input value of a button, you may fix the scan time in this case. 2. When the scan cycle is too long, the response of pressing button may become slow. You may write the instruction in the time interruption sub-program, to execute the instruction in a fixed interval.

6-82 Chapter 6 Interpretation of Application Instructions High speed counting processing

F53 HSCS comparison setting F HSCS Comparison setting S1· S2· D· 53 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * S2· * D· * * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction: The counter is compared with a comparison value. In this case, it indicate the instruction includes a comparison point. FUN53 (HSCS),FUN54 (HSCR) only occupy a comparison point, while FUN55 (HSZ) occupies two points. AP100 series: The 3 instructions FUN53, FUN54 and FUN55 can use a maximum of 12 comparison points simultaneously. AP200 series: Each high-speed input for the 3 instructions FUN53, FUN54 and FUN55 can use a maximum of 12 comparison points, so they use 12×6 comparison points at most. AP300 series: Each high-speed input for the 3 instructions FUN53, FUN54 and FUN55 can use a maximum of 12 comparison points, so they use 12×10 comparison points at most.

Instruction Format

DHSCS S1· S2· D·

S1· : Comparison value 1. S2· :Number of high speed counter. High speed counters must be specified. D· :Comparison results. D• can also specify interruption indicator I010~I060. Function The high-speed counter counts according to OFF→ON of the counting input by interruption mode. When the current value of the counter is equal to the setting value, the output contact of the counter will work immediately. For example:

6-83 Chapter 6 Interpretation of Application Instructions High speed counting processing

M8000 K100 C235 C235 The action of Y001 Y001 is affected by the scan cycle M8000 K2,147,483,647 C235 Y001 is set immediately DHSCS K100 C235 Y001

● If the instruction FUN53 is not used, the external output is correlated with the sequential control, so it is affected by scan cycle and it drives output after the END processing. ● The instruction FUN53 can be used for interrupting processing comparison and external output, therefore, when current value of C235 is becoming 99→100 or 101→100, Y001 is set immediately. 《Notes》 ● The instruction is exclusively for 32-bit, which must be input as the instruction DHSCS. ● These instructions can compare results and actions in case of pulse input. Therefore, even if the current value is changed by sending instruction, the comparison output will not change as long as there is no counting input. ● If the instructions DHSCS, DHSCR, DHSZ and etc. are used, maximum frequency of high speed counter of the PLC will be affected greatly.

《Counting interruption》 Program step EI 0 M8000 K2,147,483,647 C235

D HSCS K100 C235 I010

FEND Interruption Interrupt routine indicator program I010 IRET

● D• of the instruction DHSCS can be specified as the interruption indicator I010~I060. (The number can not be used repeatedly) ● When current value of the high speed counter specified by S2• is changed into the specified value of S1•, interruption program of mark specified by D• is executed. ● When special auxiliary relay M8059=ON, interruptions of I010~I060 are prohibited. Regarding details of interruption processing, please refer to FUN03(IRET)~FUN05(DI).

6-84 Chapter 6 Interpretation of Application Instructions High speed counting processing

F54 HSCR comparison resetting F HSCR Comparison resetting S1· S2· D· 54 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * S2· * D· * * * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction: The counter is compared with a comparison value. In this case, it indicate the instruction includes a comparison point. FUN53 (HSCS),FUN54 (HSCR) only occupy a comparison point, while FUN55 (HSZ) occupies two points. AP100 series: The 3 instructions FUN53, FUN54 and FUN55 can use a maximum of 12 comparison points simultaneously. AP200 series: Each high-speed input for the 3 instructions FUN53, FUN54 and FUN55 can use a maximum of 12 comparison points, so they use 12×6 comparison points at most. AP300 series: Each high-speed input for the 3 instructions FUN53, FUN54 and FUN55 can use a maximum of 12 comparison points, so they use 12×10 comparison points at most.

Instruction Format DHSCR S1· S2· D·

S1· : Comparison value 1. S2· :Number of high speed counter. High speed counters must be specified. D· :Comparison results. If D. is counter, it must specified in accordance with S2. Function The high-speed counter counts according to OFF→ON of the counting input by interruption method. When the current value of the counter is equal to the setting value, the output contact of the counter will work immediately.

For example:

M8000 K2,147,483,647 C235

DHSCR K200 C235 Y001

● If the instruction F54 is used, for comparison and external output employ interruption processing, when the current values of C235 is changed from 199→200 or 201→200, it is not

6-85 Chapter 6 Interpretation of Application Instructions High speed counting processing affected by scan cycle, and Y001 is immediately reset. Regarding the effect of the scan cycle, please refer to the above FUN53.

《Example of automatic reset loop》

M8000 K300 C235

DHSCR K400 C235 C235

400 300 Current value of C235 Output contact of C235 ● When current value of C235 becomes 400, C235 resets immediately, the current value is 0 and the output contact does not work. ● The instruction is exclusively for 32-bit, which must be input as the instruction DHSCR. Please refer to Notes in FUN53 for other notes.

6-86 Chapter 6 Interpretation of Application Instructions High speed counting processing

F55 HSZ inter-zone comparison F HSZ Inter-zone comparison S1· S2· S· D· 55 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * S2· * * * * * * * * * * * S· * D· * * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction: AP100 series: The 3 instructions FUN53, FUN54 and FUN55 can use a maximum of 12 comparison points simultaneously. AP200 series: Each high-speed input for the 3 instructions FUN53, FUN54 and FUN55 can use a maximum of 12 comparison points, so they use 12×6 comparison points at most. AP300 series: Each high-speed input for the 3 instructions FUN53, FUN54 and FUN55 can use a maximum of 12 comparison points, so they use 12×10 comparison points at most. Instruction Format DHSZ S1· S2· S· D·

S1· :Lower limit of zone comparison . S2· :Upper limit of zone comparison, S1·≤S2·. If S1·>S2·, S1· and S2· equal the setting value of S1· S · :Number of high speed counter. High speed counters must be specified. D· :Comparison result, occupying 3 continuous devices. Function The instruction is to set "1" for the specified zone by interruption mode. M 8000 K2,147,483,647 For C251 example: DHSZ K1000 K2000 C251 Y000

Actions of comparison output: K1000>current value of C251 Y000=ON,Y001=OFF,Y002=OFF K1000≤current value of Y001=ON,Y000= OFF,Y002=OFF C251≤K2000 Y002=ON,Y000= OFF,Y001=OFF K1000<current value of C251 ● Content of S1• and S2• is S1•≦ S2• ● If the instruction FUN55 is used, interruption processing is executed for comparison and external output, which is not affected by scan cycle.

6-87 Chapter 6 Interpretation of Application Instructions High speed counting processing

● After the instruction is executed, the output in the first scan cycle is the comparison result of current value of S1• and S2•. ● The instruction is exclusively for 32-bit, which must be input as the instruction DHSZ. Please refer to Notes in FUN53 for other notes.

6-88 Chapter 6 Interpretation of Application Instructions High speed counting processing

F56 SPD pulse density F SPD Speed detect S1· S2· D· 56 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * S2· * * * * * * * * * * * * D· * * * * * * Note:AP300 series supports data register W. Instruction Format SPD S1· S2· D·

S1· : External pulse input terminal. AP100 and AP200 (X0~X5 can be specified) ; AP300(X0~X5, X10~X13 can be specified). S2· :Time of receiving pulse (the unit is ms). D· :Result location, occupying 3 continuous devices. Function The instruction is used to measure rotation speed. Note:X specified by input S1· can't be used repeatedly with high-speed counter, input interruption, pulse catch, and instruction ZRN. Each input point can only use an instruction. 32-bit instruction is available for AP300, but unavailable for AP100 and AP200. For example: X010 SPD X000 K100 D0

X010 X000 D0: Measuring value D1:Current value

100ms 100ms

100

D2:Time remaining (ms)

6-89 Chapter 6 Interpretation of Application Instructions High speed counting processing

● Input pulse specified by S1• counts in time (ms) specified by S2•, and the result is stored in device specified by D•. ● Through repeated operation, pulse density (the proportional value with rotating speed) is obtained in D•. D• occupies 3 points of devices. ● In the figure, when X010 is ON, D1 counts OFF->ON of X000. After 100ms, the results are stored in D0. Then D1 is reset to count the action of X000 a second time. ● D2 is used to measure time remaining. ● The specified input X herein can not be used repeatedly with the high speed counter and interruption input. ● Maximum frequency of ON/OFF of input X is processed as the 1-phase high speed counting. When it is used with high speed counting, instructions FUN57(PLSY)and FUN59(PLSR), sum of the processing frequency shall be lower than the specified frequency.

6-90 Chapter 6 Interpretation of Application Instructions High speed counting processing

F57 PLSY pulse output F PLSY Pulse Y output S1· S2· D· 57 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * Note:AP300 series supports data register W. Instruction Format PLSY S1· S2· D·

S1· :Pulse output frequency. 16-bit instruction: 1~32,767Hz;32-bit instruction: 1~200,000Hz; If it is lower than 1Hz, the pulse will be sent as 1Hz. The min frequency of channel Y2 and Y3 of AP300 shall not be lower than 12Hz. S2· :Pulse output number 16-bit instruction: 0~32,767; 32-bit instruction: 0~2,147,483,647; When the value of S2. is specified as 0, the number of generated pulses is unlimited. D· :Pulse output device. AP100 and AP200 can only specify Y000 or Y001, while AP300 can specify Y000~Y003.

Function The function is used to generated certain pulses based on the specified frequency. For example: X010

PLSY K100 K1000 Y000

Pulsar ● During the Y000 instruction Frequency execution, if content (K1000) of the word element specified by S1• is changed, the output frequency will vary accordingly. ● When the value of S2. is specified as 0, the number of generated pulses is unlimited. During the instruction execution, if the word element specified by S2• is changed, it will execute the changed content from the next instruction driving. ● After X010 is OFF, the output Y0 stops immediately; when it is ON a second time, it acts from the initial state, Y0 sends continuous pulse. ● Duty ratio of the pulse is 0.5. The output control is not affected by scan cycle and interruption

6-91 Chapter 6 Interpretation of Application Instructions High speed counting processing processing is employed. ● After pulse setting is finished, the finish flag M8029 acts. ● Pleases use PLC of transistor output type. 《Notes》 ● Do not drive and use the pulse output instruction under the same output channel simultaneously. If it is driven simultaneously, the instruction driven firstly will be executed, but the instruction driven lastly won't be executed. ●The recommended wiring method and current are as shown in the figure below

PLC Power Loaded Virtual supply resistor resistor

100mA

《Address numbers of the related devices》 1. Description of flag signals ● M8029:Flag of finishing execution of pulse output. ● M8145:Flag of stopping Y000 pulse output. ● M8146:Flag of stopping Y001 pulse output. ● M8155:Flag of stopping Y002 pulse output. ● M8156:Flag of stopping Y003 pulse output. ● M8143:Flag of finishing execution of Y0 pulse output. ● M8144:Flag of finishing execution of Y1 pulse output. ● M8147:Flag of executing Y0 pulse output. ● M8148:Flag of executing Y1 pulse output. ● M8153:Flag of finishing execution of Y2 pulse output. ● M8154:Flag of finishing execution of Y3 pulse output. ● M8157:Flag of executing Y2 pulse output. ● M8158:Flag of executing Y3 pulse output. ● M8149:Enable synchronous output of Y000 and Y001. 2. Description of special registers ● D8140, D8141:Register of the current value for the pulse of Y0 channel output, D8141(high bit), D8140(low bit).

6-92 Chapter 6 Interpretation of Application Instructions High speed counting processing

● D8142, D8143:Register of the current value for the pulse of Y1 channel output, D8143(high bit), D8142(low bit). ● D8190, D8191:Register of the current value for the pulse of Y2 channel output, D8191(high bit), D8190(low bit). ● D8200, D8201:Register of the current value for the pulse of Y3 channel output, D8201(high bit), D8200(low bit).

6-93 Chapter 6 Interpretation of Application Instructions High speed counting processing

F58 PWM pulse width modulating F PWM Pulse width modulation S1· S2· D· 58

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D· * Note:AP300 series supports data register W. Instruction Format PWM S1· S2· D·

S1· :Pulse output width, t=0~1000ms【Note】. S2· :Pulse output cycle, T=1~1000ms【Note】, but S1·≤S2·. D· :Pulse output device. AP100 and AP200 can only specify Y000 or Y001, while AP300 can specify Y000~Y003. Pleases use PLC of transistor output type. Note:The units of S1· and S2· are determined by the selected time base. For example, when S2· is 300, and the time base is 0.01ms, the pulse output cycle is 300×0.01ms. The time base of Y000 channel is determined by D8158, while the time base of Y001 is determined by D8159. The time base of channel Y002 and Y003 is 0.01ms fixedly. Function It is to generate the pulse for which the width and cycle can be controlled. For example: X010 PWM D10 K50 Y000

t Y000 T

● The output ON/OFF can execute interruption processing. ● In the above case, when the content of D10 exceeds 50, it may be error. ● When X010 is OFF, Y000 is OFF. ● The time base of Y000 and Y001 is determined by D8158 and D8159 respectively. The time base of channel Y002 and Y003 is 0.01ms fixedly.

D8158 Y000 parameter time base 0:Parameter is in the unit of 1ms 1:Parameter is in the unit of 0.1ms D8159 Y001 parameter time base 2:Parameter is in the unit of 0.01ms 《Notes》 ● Please use PLC of transistor output type. For high frequency pulse output, as mentioned above, please provide sufficient load current. (FUN57 PLSY).

6-94 Chapter 6 Interpretation of Application Instructions High speed counting processing

F59 PLSR ramp pulse output F PLSR Ramp pulse output S1· S2· S3· D· 59 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * S3· * * * * * * * * * * * * D· * Note:AP300 series supports data register W. Instruction Format PLSR S1· S2· S3· D·

S1· :Maximum frequency of pulse output. 16-bit instruction: 1~32,767Hz;32-bit instruction: 1~200,000Hz; If it is lower than 1Hz, the pulse will be sent as 1Hz. The min frequency of channel Y2 and Y3 of AP300 shall not be lower than 12Hz. S2· :Total quantity of output pulse. S3· :Time of acceleration and deceleration in ms, S3≥30ms. D· :Pulse output device. AP100 and AP200 can only specify Y000 or Y001, while AP300 can specify Y000~Y003. Pleases use PLC of transistor output type. Function It is the ramp pulse output instruction with fixed sizes. For example:

For specified maximum frequency, fixed acceleration is executed; after it reaches specified output pulse quantity, fixed deceleration is executed.

6-95 Chapter 6 Interpretation of Application Instructions High speed counting processing

Setting content of the operands is as followed: S1· maximum Range of setting: 10~200,000(Hz). When the setting value is 1, S1. is the frequency: frequency of 1Hz by default. The minimum output frequency of Y2 and Y3 channels on AP300 can't be smaller than 12Hz. The frequency is set with multiple of 100. 1/100 of specified value of maximum frequency can be set as one speed variation (frequency) during deceleration, therefore, please set the step motor in specified range. S2· total Setting range: 16-bit computation, 0~32,767 output pulse 32-bit computation, 0~2,147,483,647 quantity: When the instruction DPLSR is used, (D1 and D0) are used as 32-bit setting value in this example. S3· Time of acceleration and deceleration shall act with the same values. acceleration/ deceleration time: D· Pulse AP100 and AP200 can only specify Y000 or Y001, while AP300 can specify output code: Y000~Y003. The controller output must be transistor output. ● Output frequency of the instruction is 1~200,000Hz. When the maximum speed and variable speed of acceleration/deceleration exceed the range, it is lowered or carried in the range automatically. ● The output control is not affected by scan cycle for interruption processing. ● When X010 is OFF, output is interrupted. When it is set ON a second time, it acts from the initial position. ● During the instruction execution, even if the operand is rewritten, the operation will not change. The content of change will take effect in the next instruction driving. ● When setting pulse output is finished, the finishing flag M8029 is set ON.

《Address numbers of the related devices》 1. Description of flag signals ● M8029:Flag of finishing execution of pulse output. ● M8145:Flag of stopping Y000 pulse output.

6-96 Chapter 6 Interpretation of Application Instructions High speed counting processing

● M8146:Flag of stopping Y001 pulse output. ● M8155:Flag of stopping Y002 pulse output. ● M8156:Flag of stopping Y003 pulse output. ● M8143:Flag of finishing execution of Y0 pulse output. ● M8144:Flag of finishing execution of Y1 pulse output. ● M8147:Flag of executing Y0 pulse output. ● M8148:Flag of executing Y1 pulse output. ● M8153:Flag of finishing execution of Y2 pulse output. ● M8154:Flag of finishing execution of Y3 pulse output. ● M8157:Flag of executing Y2 pulse output. ● M8158:Flag of executing Y3 pulse output. ● M8149:Enable synchronous output of Y000 and Y001. 2. Description of special registers ● D8140, D8141:Register of the current value for the pulse of Y0 channel output, D8141(high bit), D8140(low bit). ● D8142, D8143:Register of the current value for the pulse of Y1 channel output, D8143(high bit), D8142(low bit). ● D8190, D8191:Register of the current value for the pulse of Y2 channel output, D8191(high bit), D8190(low bit). ● D8200, D8201:Register of the current value for the pulse of Y3 channel output, D8201(high bit), D8200(low bit).

6-97 Chapter 6 Interpretation of Application Instructions Handy instruction

8 F60~F69 Handy Instructions

Handy instruction Function No. Mnemonic Name Page F60 IST Initialize state 6-99 F61 SER Data searching 6-103 F62 ABSD Absolute drum 6-105 F63 INCD Incremental drum 6-107 F64 TTMR Demonstrating timer 6-109 F65 STMR Special timer 6-110 F66 ALT ON/OFF alternative output 6-111 F67 RAMP Ramp signal 6-113 F68 ROTC Rotary table control 6-115 F69 SORT Sort data 6-117

6-98 Chapter 6 Interpretation of Application Instructions Handy instruction

F60 IST initialize state F IST Initialize state S· D1· D2· 60

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * D1· * D2· * Note 1:AP100 1.2 and above versions are supported. Note 2:The limit on simultaneous driving of the instruction is 1. Instruction Format

IST S· D1· D2·

S· : Start input of operation mode. D1· :Minimum serial number for state step point under automatic mode D2· :Maximum serial number for state step point under automatic mode D1•/D2• Specified range of operands: S20~S1023(AP100, AP200), S20~S4095(AP300), and D2 >D1. Function The instruction is a specific handy instruction for initializing state of step ladder control flow. With special relay, it forms convenient automatic control. For example: X000 IST X030 S20 S20

RUN monitoring

X030:Manual operation X034:Continuous operation X031:Origin return X035:Origin return starts X032:Step X036:Automatic start X033:One cycle X037:Stop When driving the instruction, the special relays as below will switch automatically. However, if the driving input is OFF, it will not change. M8040:Transfer disabled S0:Initial state for manual operation M8041:Transfer start S1:Initial state for origin return M8042:Start pulse S2:Initial state for automatic operation M8047:STL monitor effective

6-99 Chapter 6 Interpretation of Application Instructions Handy instruction

If the instruction is used, S10~S19 are used for origin return. Therefore, during programming, do not take these states as common states. In addition, when S0~S9 are taken as step points, S0~S2 are for the above manual operation, origin return and automatic operation. Therefore, in the program, the step point circuits for the 3 states must be written, and S3~S9 can be used freely. The instruction shall be programmed in priority than the states S0~S2 and other STL circuits. To avoid the above X030~X034 are ON simultaneously, rotating switch must be used. If origin return finishing (M8043) doesn't act, all the outputs are OFF when switching between manual operation (X030), origin return(X031)and automatic mode(X032,X033, X034). The automatic operation can be driven a second time after origin return finishes.

Special auxiliary relay for the instruction IST The auxiliary relay for the instruction IST can be divided into automatic control as per its state and program control for operation preparation and control purpose. 1) Automatic control for the instruction IST Transfer disabled When the auxiliary relay works, all the state transfers are disabled. Individual : M8040 keeps acting. Origin returns, operation : It keeps operation from pressing the stop button and of one cycle pressing the start button. Step : M8040 keeps acting. However, only when pressing the start button, will M8040 become inactive and execute transfer. Others : When switching PLC from STOP→RUN, the action will be held. When pressing the start button, it will be released. Even if it it under the state of transfer disabled, the output within the state will be held. Transfer start The auxiliary relay for the transfer conditions from the initial state S2 to the next state. Individual, origin return : No action Step, one cycle : It acts only when pressing the start button. Continuous : After pressing the start button continuously, it keeps acting; when pressing the stop button, it is released. Enable pulse It acts instantly when pressing the start button. STL monitor effective

6-100 Chapter 6 Interpretation of Application Instructions Handy instruction

M8047 is set ON after instruction IST is applied. When M8047 is driven, STL monitor is effective. The state numbers (S0~S899) of the current actions are stored in D8040~D8047 from small to big. Therefore, it monitors 8 action state numbers at most. Besides, if any of the states acts, the special auxiliary relay M8046 will act.

2)Driven by sequential control program Origin return finishes Under the mode of origin return, when the machine returns to the origin, the user program makes the special auxiliary relay act. Origin condition After the origin conditions of the machine are detected, the user program drives the special auxiliary relay. It is valid signal under all modes. All output resets prohibited After switching among Individual, Origin Return and Automatic mode, if the machine is not at the origin, all the outputs and action states shall be reset.

Distribution of mode selection input If the instruction IST is used, it shall distribute the input of continuous numbers by following the input of the mode as shown below. When discontinuous number or some of them are ignored, the following auxiliary relays can be used to change the ranking, and use it as the start input of the specified mode. X030:Individual operation X031:Origin return X032:Step X033:One cycle X034:Continuous operation X035:Origin return starts X036:Automatic start X037:Stop Note: Don't operate X030~X034 simultaneously. (Selection switch can be used)

6-101 Chapter 6 Interpretation of Application Instructions Handy instruction

Input is not continuous Only continuous/origin return mode Only continuous / individual number mode Example: Example: Example: X030:individual operation X030:Origin return X030:individual operation X035:Origin return X031:Continuous operation X031:Continuous operation X033:Step X032:Automatic switch and X032:Automatic switch X040:One operation cycle origin return start X033:Stop X032:Continuous operation X033:Stop X034:Origin return starts X026:Automatic start X041:Stop

X030 M8000 X030 M0 M0 M0 X035 X030 M8000 M1 M1 M1 X033 M8000 M2 M2 M2 X040 M3 M3 M3 X032 X031 X031 M4 M4 M4 X034 X032 M8000 M5 M5 M5 X026 X032 M6 M6 M6 X041 X033 X033 M7 M7 M7

This example uses M0 as the initial input specified by the mode. M8000 IST M0 S20 S29

6-102 Chapter 6 Interpretation of Application Instructions Handy instruction

F61 SER data searching F SER Search data S1· S2· D· n 61 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * S2· * * * * * * * * * * * * D· * * * * * * * n * * * * Note:AP300 series supports data register W. Instruction Format

SER S1· S2· D· n

S1· :The first device for specifying the table starting address and data storage S2· :Data content searched by the instruction D· :Start device for storing the list of searching results, occupying 5 continuous points. n :Length of data zone to be compared, n=1~256(16-bit instruction), n=1~128(32-bit instruction). Function The instruction is used for searching the same data, maximum value and minimum value in the data table. For example: X000 SER D100 D0 D50 K10

Structure and data example of search list: Searched Example of Comparison Data Maximum Minimum Same element searched data data location value value D100 D100=K100 0 Same D101 D101=K111 1 D102 D102=K100 2 Same D103 D103=K98 3 D104 D104=K23 4 Minimum D0=K100 D105 D105=K66 5 D106 D106=K100 6 Same D107 D107=K95 7 D108 D108=K210 8 Maximum D109 D109=K88 9

6-103 Chapter 6 Interpretation of Application Instructions Handy instruction

List of search results Element No. Content Remark D50 3 Number of the same data D51 0 Location of the same data (Initial) D52 6 Location of the same data (Final) D53 4 Final location of minimum value D54 8 Final location of maximum value Note:When S1·, S2· and D· are beyond the range, it will lead to error.

● It is the comparison of numbers with positive or negative symbols. ● When there are several maximum and minimum values, it will display the last position. ● When the 32-bit instruction is used, 32-bit shall be taken as the unit to store the search results. ● In the 5-bit element started with D•, as shown in the table above, positions of the same data, minimum value and maximum value are stored. When the same data do not exist, D50~D52=0 in the above case.

6-104 Chapter 6 Interpretation of Application Instructions Handy instruction

F62 ABSD absolute drum F ABSD Absolute drum S1· S2· D· n 62 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * S2· * D· * * * n * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction is 1. Instruction Format ABSD S1· S2· D· n

S1· :Comparison start device. When the operand is specified as KnX, KnY, KnM, and KnS, 16-bit instruction shall specify K4; for the 32-bit instruction, it shall specify K8, and the numbers of X, Y, M and S shall be multiple of 16. S2· :Counter number. For the 16-bit instruction, it shall specify C0~C199( C0~C99 for AP100; C0~C199 for AP200/AP300). For the 32-bit instruction, it shall specifyC200~C511(C220~C255 for AP100; C200~C255 for AP200; C200~C511 for AP300). D· :Start number of comparison result output. n :Number of groups for multi-section comparison, n =1~64. Function The instruction and data comparison table comparing the current value of the counter in the platform rotation (0 to 360 degrees) during the first, to compare the results of continuous n-point output ON / OFF control. Take the working bench rotating for one cycle to control the auxiliary relay M0~M3 ON/OFF as an example to describe in detail.

For example: X 000 A BSD D300 C0 M 0 K4 C0 X001 RST C0 X001 C0 K360 Rotating angle signal for 1 p ulse for 1 deg ree

6-105 Chapter 6 Interpretation of Application Instructions Handy instruction

The following data are written into D300~D307 by using sending instructions in advance Rising point Falling point Target output D300= 40 D301=140 M0 D302=100 D303=200 M1 D304=160 D305= 60 M2 D306=240 D307=280 M3 When X000 is ON, there are the following changes for M0~M3. Rising point/fall point may vary according to change of data of D300~D307.

40 140 M0 100 200 M1 60 160 M2 240 280 M3 ● The value n determines number of points for output target. ● When X000 is OFF, the wave output remains unchanged. ● When the instruction DABSD is used, S2•can specify high speed counter. However, the wave output may be delayed due to the scan cycle. When high speed response is required, please use the instruction HSZ for high-speed comparison.

6-106 Chapter 6 Interpretation of Application Instructions Handy instruction

F63 INCD incremental drum F INCD Incremental drum S1· S2· D· n 63

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * S2· * D· * * * n * * Note:AP300 series supports data register W. Instruction Format INCD S1· S2· D· n

S1· :Start element for comparison , when KnX, KnY, KnM and KnS are specified, K4 shall be specified, and the numbers of X, Y, M and S shall be multiple of 16. S2· :Counter number. For the 16-bit instruction, it shall specify C0~C198(C0~C98 for AP100; C0~C198 for AP200/AP300), which will occupy 2 counters with continuous numbers. D· :Start number of comparison results. n :Number of groups for multi-section comparison, n =1~64. Function The instruction is to generate output waves for a pair of counters.

For example: X000 INCD D300 C0 M0 K4 M8013 K9999 C0

According to the time sequence table, we take the control n=4 points for M0-M3 for interpretation.

● The following data are written into S1•by the sending instructions in advance. D300= 20 D301=30 D302=10 D303=40

6-107 Chapter 6 Interpretation of Application Instructions Handy instruction

● When the counter C0 reaches setting values of D300~D303, it is reset automatically according to the sequence. ● The working counter C1 counts the times of resetting. ● It is corresponding to the current values of the working counters C1, and M0-M3 works according to the sequence. ● When the output actions specified by n finish, the flag M8029 acts, which returns and starts the same actions. ● When X000 is OFF, C0 and C1 are cleared, and M0~M3 is OFF as well. When X000 is set ON a second time, it works from initial state. X000 40 30 20 20 20 10 C0 2 3 C1 0 1 0 1 0 M0 M1 M2 M3 M8029 Finishing flag

6-108 Chapter 6 Interpretation of Application Instructions Handy instruction

F64 TTMR demonstrating timer F TTMR Demonstrating timer D· n 64

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z D· * * n * * Note:AP300 series supports data register W. Instruction Format

TTMR D· n

D· :Number of element storing the ON time of button switch, occupying 2 devices with continuous numbers D· is in the unit of s, D·+1 is in the unit of 100ms. n :Setting of multiple, n=0~2. Function The time of pressing the button multiplying with the ratio is taken as the default value of the timer, to monitor the continuity of the monitoring information. For example:

X010 TTMR D300 K0

X010 D301 D301

D300 D300

t0 t0

Pressing time of the button X010 (100ms units) was measured by D301, multiplying by the specified ratio of n, and the result is stored in D300 (1s units). Setting time of the timer can be adjusted by the button. Pressing time of the button X010 is τ0 second. According to n value, actual D301 is listed below: n D301 (100ms units) D300 (100ms units)

K0 t0 0.1 t0

K1 t0 t0

K2 t0 10 t0 When X010 is OFF, D301 is reset and D300 does not change.

6-109 Chapter 6 Interpretation of Application Instructions Handy instruction

F65 STMR special timer F STMR Special timer S· m D· 65

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * m * * D· * * * Instruction Format

STMR S· m D·

S· :Number of the timer, range of specifying: 100ms timer. Type Number T of 100ms timer AP100 T0~T39,T196~T199 AP200 T0~T199 AP300 T0~T199 m :Setting value of the timer, unit 100ms, range: 1~32767. D· :Start number of the output element, occupying 4 devices with continuous number. Function The instruction is used to make the delay timer, single triggering timer and twinkling timer in a simple way. For example: X000 STMR T10 K100 M0

X000 M0 10s 10s M1 10s 10s M2 10s

M3 ● S specified by m is the setting value of the specified timer, which is 10 seconds in the example. ● M0 is the delay timer. ● M1 is the single trigger timer after M1 is the input ON→OFF. ● M2 and M3 are used for twinkling. ● When X000 is off, M2 and T10 are reset. M0, M1 and M3 are off after setting the time. ● Timer used here can not be used repeatedly in other general circuits.

6-110 Chapter 6 Interpretation of Application Instructions Handy instruction

F66 ALT ON/OFF alternative output F ALT ON/OFF alternative output D· 66 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z D· * * * Instruction Format

ATL D·

D· :Destination element. Function When the instruction is driven, the state of D· will be changed. For example: X000 ALTP M0

X000 M0

● Every time the driving input X000 changes from OFF→ON each time, M0 takes in reverse direction. ● When continuous execution instruction is used, each computation cycle performs reverse actions. Please pay attention to it. ● M0 in the above figure is taken as input. When the instruction ALTP is used for driving M1, multi-level frequency dividing output can be obtained. M0 ALTP M1

X000 M0 M1

6-111 Chapter 6 Interpretation of Application Instructions Handy instruction

《Application of repeated actions》 《Start/stop from 1 input》 X000 ALTP M0 M0 Y000 Stop M0 Y001 Start

● When pressing button X000, the output start Y001 acts. ● When pressing button X000 again, the output stop Y000 acts.

《Twinkling action》 X006 T2 K50 T2 X006 T2 ALTP Y007

X006 5s 5s T2

X007 ● When the input X006 is ON, contact of the timer T2 acts instantly with an interval of 5 seconds. ● Every time the contact of T2 is ON, the output Y007 is ON/OFF alternatively.

6-112 Chapter 6 Interpretation of Application Instructions Handy instruction

F67 RAMP ramp signal F RAMP Ramp signal S1· S2· D· n 67

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * S2· * * D· * * n * * Note:AP300 series supports data register W. Instruction Format

RAMP S1· S2· D· n

S1· :Element of initial value of slope signal S2· :Element of target value. D· :Process value. n :Times of scanning, n=1~32767. Function The signal is used to generate slope output signal. For example: X000 RAMP D1 D2 D3 K1000

● Write the preset initial value and target value into D1 and D2 in advance. If X000 is ON, content of D3 changes slowly from D1 to D2. Time of moving is the n times of scanning.

D2 D1 (D3) 掃描次數存 儲在D4內 D1 (D3)

n個掃描時間 n個掃描時間 D1 < D2 時 D1 > D2 時

6-113 Chapter 6 Interpretation of Application Instructions Handy instruction

● The preset scanning time (a little longer than the actual scan time of the program) is written into D8039, which is driven. The PLC is in constant scanning operation mode. If the value is 20ms, in the above case, after 20 seconds, D3 is changed from D1 to D2. ● During operation, if X000 is OFF, it becomes interrupted. When X000 is set ON a second time, D4 is cleared and it acts from D1. ● After execution is finished, the flag M8029 is ON, value of D3 is back to D1. ● If the instruction combines the analog output, it can output buffering start/stop instruction. ●X000 turns ON and starts to RUN, the number of scan times should be clear from stored register in advance. (Data register is holding in case of using)

《Action of mode flag》 In PLC, it acts according to the mode flag M8026, and content of D3 changes as follows: "M8026 = ON, D3 reaches to the target and keeps it until driving instruction sets OFF to ON again; M8026 = OFF, D3 reaches the target value is immediately reset to the D1 value."

M8026 Driving M8026 Driving X000 X000 =ON instruction =OFF instruction (D2) (D2) (D1) (D3) (D1) (D3)

M8029 M8029

6-114 Chapter 6 Interpretation of Application Instructions Handy instruction

F68 ROTC rotary table control F ROTC Rotary table control S· m1 m2 D· 68

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * m1 * * m2 * * D· * * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction is 1. Instruction Format ROTC S· m1 m2 D·

S· :Register for counting, occupying 3 devices with continuous numbers. m1 :Splitting line of worktable, m1=2~32,767. m2 :Number of ranges at low speed, m2=0~32,767 (m1≥m2). D· :Start point for signal output, occupying 8 devices with continuous numbers. Function The instruction is used to make the part specified on the rotary table move to the along the shortest path. For example: X010 ROTC D200 K10 K2 M0

The instruction is to get/place the part on the rotary table with the splitting line m1=10, and the getting/placing window as required is next to the rotary table. ● Please set the 2-phase switch which is to detect the forward/reverse direction of the rotary table and the switch X002 which acts when part 0 is moved to window 0. X000~X002 are used to drive M0~M2(The start sequential number of X and M can be set at your discretion). ● D200 occupies 3 devices with continuous numbers. D200 is used as a counting register. D201 is to set the number of target window, and D202 is to set the number of target part. D201 and D202 are set prior to sending the instruction. When the setting value of D200 is beyond 0~9 (namely, 0~(m1-1)), D8067 = 6706. ● M0:A-phase signal M1:B-phase signal M2 : Signal for zero point detection M3:High speed forward M4:Low speed forward rotation M5:Stop rotation M6:Low speed reverse M7:High speed reverse rotation rotation

6-115 Chapter 6 Interpretation of Application Instructions Handy instruction

When the instruction is driven under X010 ON, the results of M3~M7 can be obtained automatically. When X010 is OFF, M3~M7 is OFF. ● When X010 is ON and the signal for zero point detection (M2) is ON, the content of counting register D200 is cleared. It shall clear the operation before starting the instruction.

6-116 Chapter 6 Interpretation of Application Instructions Handy instruction

F69 SORT sort data F SORT Sort data S· m1 m2 D· n 69

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * m1 * * m2 * * D· * * n * * * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction is 1. Instruction Format SORT S· m1 m2 D· n

S· :Start element of original data zone m1 :Number of data groups, m1=1~32. m2 :Number of data rows, m2=1~6。 D· :Start element of data zone for storing sorting result. n :Reference number of data sorting, n=1~m2. Function The instruction is used to sort the data.

For example: X020 SORT D100 K5 K4 D200 D0

When X020 is ON, the data starts sorting. After finishing flag M8029 is ON, it stops operation. During operation, do not change the operand and data content. When it is operated a second time, set X020 OFF one time.

6-117 Chapter 6 Interpretation of Application Instructions Handy instruction

《Example of data sorting》 <————Number of rows m2——————> Row 1 2 3 4 Line ID Height Weight Age D100 D105 D110 D115 1 1 150 45 20 D101 D106 D111 D116 2 2 180 50 40 D102 D107 D112 D117 3 3 160 70 30 D103 D108 D113 D118 4 4 100 20 8

<——Number of data m1——> m1——> of data <——Number D104 D109 D114 D119 5 5 150 50 45 ● Start data register is specified by S•. ● Input ID and other continuous numbers in the 1st line to identify the original line number.

《For executing the instruction D0=K2》 Row 1 2 3 4 Line ID Height Weight Age D200 D205 D210 D215 1 4 100 20 8 D201 D206 D211 D216 2 1 150 45 20 D202 D207 D212 D217 3 5 150 50 45 D203 D208 D213 D218 4 3 160 70 30 D204 D209 D214 D219 5 2 180 50 40

6-118 Chapter 6 Interpretation of Application Instructions Handy instruction

《For executing the instruction D0=K3》 Row 1 2 3 4 Line ID Height Weight Age D200 D205 D210 D215 1 4 100 20 8 D201 D206 D211 D216 2 1 150 45 20 D202 D207 D212 D217 3 2 180 50 40 D203 D208 D213 D218 4 5 150 50 45 D204 D209 D214 D219 5 3 160 70 30 ● Data of the computation result starts with the element specified by D•, occupying m1×m2 data registers. When S• and D• are the same element, , do not change content of S• before finishing the operation. ● Executing of the instruction needs m1 scan cycles. After data sorting finishes, the flag M8029 acts.

6-119 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

9 F70~F79 I/O of Peripheral Devices

I/O of peripheral devices Function No. Mnemonic Name Page F70 TKY Decimal key input 6-121 F71 HKY Hexadecimal key input 6-123 F72 DSW Digital switch input 6-126 F73 SEGD 7-section decoding 6-129 F74 SEGL Hour and minute display of 7-section code 6-131 F75 ARWS Arrow switch 6-134 F76 ASC ASCII code conversion 6-136 F77 PR ASCII code printing 6-138 F78 FROM BFM reading 6-140 F79 TO BFM writing 6-143

6-120 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

F70 TKY decimal key input F TKY Decimal key input S· D1· D2· 70 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * D1· * * * * * * * * * D2· * * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction is 1. Instruction Format TKY S· D1· D2·

S· :Start device for key input, which occupies 10 continuous points. D1· :Storage location for key input values. D2· :Key output signal Function The instruction is to input decimal numbers by 10 keys.

For example: X030 TKY X000 D0 M10

0123456789

24V0V S/S X000 X001 X002 X003 X004 X005 X006 X007 X010 X011

PLC

6-121 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

X000 ④ X001 ② X002 ① X003 ③

M10 M11 M12 M13 Key sensing output M20 ① ② ③ ④

● Input the decimal keys according to the sequence①②③④ in the figure above, and content of D0 is changed to 2,130. Maximum value of the input is 9,999, and overflow will occur if it is beyond the range (content of D0 is stored in binary system). ● When the instruction D TKY is used, D1and D0 buffers are combined. When the value exceeds 99,999,999, overflow will occur. ● From the moment pressing X002 to the moment pressing other keys, M12 keeps ON and other keys are the same. ● Similarly, if the corresponding X000~X011 act, M10~M19 will act. ● When pressing any key, if the pressing is detected, M20 will be ON. When several keys are pressed, the earlier pressed one shall prevail. ● When the input X030 is OFF, content of D0 will not change, and M10~M2 will be all OFF.

6-122 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

F71 HKY hexadecimal key input F HKY Hexadecimal key input S· D1· D2· D3· 71 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * D1· * D2· * * * * * * D3· * * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction is 1. Instruction Format HKY S· D1· D2· D3·

S· :Start device for key input, which occupies 4 continuous points. D1·:Start device for key scan output, which occupies 4 continuous points. D2· :Storage location for key input values. D3· :Key output signal Function The instruction is used for writing numerical value and input functions with hexadecimal key.

For example: X000 HKY X010 Y010 D0 M0

《Digit keys》 9 8 7 6 5 4 3 2 1 0

BCD

Overflow 103 102 101 100 HKY

D0(BIN) ● Every time the digit key is pressed, values with upper limit 9,999 is stored in D0 in the form of BIN. If it exceeds the value, overflow will occur. ● When the instruction DHKY is used, D1 and D0 are valid between 0~99999999.

6-123 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

● When several keys are operated, the earlier pressed one shall prevail. ● After one cycle scan for Y010~Y013, the finishing flag M8029 acts.

《Function keys》 F E D C B A

M5 M4 M3 M2 M1 M0 ● When the key A is pressed, M0 keeps ON; when D is pressed, M0 is OFF and M3 keeps ON. ● When several keys are operated, the earlier pressed one shall prevail.

《Output of key detection》 ● When any key of A~F is pressed, M6 works instantly. ● When any key of 0~9 is pressed, M7 works instantly. ● When the driving input X000 is OFF, D0 does not change, and M0~M7 are OFF.

CDEF

External circuit 89AB

4567

0 123

24V 0V C X10 X11 X12 X13

C2 Y10 Y11 Y12 Y13

● Functions of the flag M8167: When M8167=ON, the instruction HKY can input hexadecimal number of 0~F; When M8167=OFF, the instruction HKY A~F can be used as function key.

6-124 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

Supplementary description: When executing the instruction, it must go through 8 scan cycles to catch the input value of a key effectively. When the scan cycle is too long or too short, it may cause bad pressing. Therefore, the following skill can be applied to overcome. 1. 1. When the scan cycle is too short, it might results in I/O fails to read the input value of a key, you may fix the scan time in this case. 2. 2. When the scan cycle is too long, the response of pressing button may become slow. You may write the instruction in the time interruption sub-program, and execute it within a fixed interval.

6-125 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

F72 DSW digital switch input F DSW Digital switch S· D1· D2· n 72

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * D1· * D2· * * * * * * n * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction is 2. Instruction Format DSW S· D1· D2· n

S· :Start device for scan input of finger-dialing switch. D1· :Start device for scan output of finger-dialing switch D2· :Location storing the setting value of finger-dialing switch n :Number of groups connected by the finger-dialing switch, n=1~2. Function The instruction is used to read the BCD code set by the digit switch for 1(n=1) or 2 (n=2) groups of 4-bit numbers. When the input is not BCD code, the value in this bit will be forced to be 0.

For example: X000 DSW X020 Y020 D0 K1

6-126 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

2nd group of BCD digital input switch 100 101 102 103 Diode

1248 1248 24V 0V S/S X020 X021 X022 X023 X024 X025 X026 X027 1st group of 2nd group of input input

COM Y020 Y021 Y022 Y023 100 101 102 103

Wiring diagram for T machine type Note:When the input is not BCD code, the value in this bit will be forced to be 0.

《The 1st group The 4-bit BCD code digit switch connecting X020~X023 reads according to of input》 the sequence of Y020~Y023 and stored in D0. 《The 2nd group The 4-bit BCD code digit switch connecting X024~X027 reads according to of input》 the sequence of Y020~Y023 and stored in D1. (Valid when n=2) X000 Cyclic action Y020 t tt

Y021 t Interr uptio Y022 t n Y023 t Execution M8029 finishing T: A scan cycle

● When X000 is ON, Y020~Y023 work according to the sequence (a scan cycle). After one cycle, the finishing flag M8029 acts. ● When DSW values need continuous input, PLC with transistor output shall be used.

6-127 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

Supplementary description: A. When PLC is used as relay output, the following method can be used: 1)When X000=ON, the instruction DSW is executed; when X000 is OFF, M10 will continue to keep ON and it will be OFF until the scan terminal of instruction DSW finishes one cycle. 2)The condition contact X000 uses button switch. Every time it is pressed, M10 will be OFF after the scan terminal specified by the instruction DSW finishes one cycle output. Then the instruction stops execution and the finger-dialing switch data will be fully read. Therefore, under the circumstances, even the scan terminal uses relay output, service life of the relay will not be shortened. X000 SET M10 M10 DSW X020 Y020 D20 K2 M8029 RST M10

B. When executing the instruction, it must go through 4 scan cycles to catch the input value of a key effectively. When the scan cycle is too long or too short, it may cause bad pressing. Therefore, the following skill can be applied to overcome. 1) When the scan cycle is too short, it might results in I/O fails to read the input value of a button, you may fix the scan time in this case. 2) When the scan cycle is too long, the response of pressing button may become slow. You may write the instruction in the time interruption sub-program, and execute it within a fixed interval.

6-128 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

F73 SEGD 7-section decoding F SEGD 7-section decoding S· D· 73 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format SEGD S· D·

S· :Source device of decoding. D· :Output device after decoding. Function 0-F (hexadecimal system number) of specified by low 4-bit of S• is decoded into D• of data in the 7-section code. High 8-bit of D• does not change. M8273 specifies logic relation of output display When M8273=OFF, 《Seven-section Decoding Table》is shown as below: Source Pre-setting Hexadecim Bit 7-section Number al combination combined number B7 B6 B5 B4 B3 B2 B1 B0 represented number format 0 0000 B0 0011111 1 0 1 0001 0000011 0 1 B5 B6 B1 2 0010 0101101 1 2 B4 B2 3 0011 0100111 1 3 B3 4 0100 0110011 0 4 5 0101 0110110 1 5 6 0110 0111110 1 6 7 0111 0010011 1 7 8 1000 0111111 1 8 9 1001 0110111 1 9 A 1010 0111011 1 A B 1011 0111110 0 B C 1100 0011100 1 C D 1101 0101111 0 D E 1110 0111100 1 E F 1111 0111000 1 F

6-129 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

Start of bit element (such as Y000) Or the last bit of work element is B0. When M8273=ON, 《Seven-section Decoding Table》is shown as below: Source Pre-setting 7-section Hexadecim Bit B7 B6 B5 B4 B3 B2 B1 B0 Number combined al combination represented number number format 0 0000 B0 1100000 0 0 1 0001 1111100 1 1 B5 B6 B1 2 0010 1010010 0 2 B4 B2 3 0011 1011000 0 3 B3 4 0100 1001100 1 4 5 0101 1001001 0 5 6 0110 1 0 0 0 0 0 1 0 6 7 0111 1 1 0 1 1 0 0 0 7 8 1000 1000000 0 8 9 1001 1001000 0 9 A 1010 1000100 0 A B 1011 1000001 1 B C 1100 1100011 0 C D 1101 1010000 1 D E 1110 1000011 0 E F 1111 1000111 0 F

6-130 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

F74 SEGL Hour and minute display of 7-section code F Hour and minute display of SEGL S· D· n 74 7-section code

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * n * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction is 2. Instruction Format SEGL S· D· n

S· :Source device to display 7-section code D· :Start device for 7-section display scan output n :Polarity setting of output signal and scan signal, n=0~7. Function The instruction is used for controlling 1 or 2 groups of 4-bit 7-section code with saving function. For example:

X000 SEGL D0 Y000 K0

COM0 Y000 Y001 Y002 Y003 COM1Y004 Y005 Y006 Y006 COM2Y010 Y011 Y012 Y013

103 102 101 100 103 102 101 100 1 V+1 V+ 2 2 3 3 4 4 Group 1 Group 2

《4-bit for one group》 n=0~3 ● BCD conversion result of D0 (Although it is of binary system, it is effective between 0~9,999 after conversion in BCD ), is output to (Y000~Y003). ● The control signals (Y004~Y007) are used to save the 7-section display of 4-bit for one group with saving function.

6-131 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

《4-bit for 2 groups》 n=4~7 ● Similarly, D0 is output to (Y000~Y003), D1 is output to (Y010~Y013). D1 and D0 execute BCD conversion, which are then effective between 0~9,999, otherwise, error will occur. If S· uses K/H form, error occurs to the parameter, and D8067=6706. ● The control signal (Y004~Y007)is shared by 2 groups. ● The instruction is used for 4-bit (1 or 2 groups) display, which requires 4 times of the computation cycle. After 4-bit output finishes, the finishing flag M8029 acts. ● When the driving input of the instruction is ON, it executes actions repeatedly. Of one series of actions, when the driving input is OFF, it stops acting and restarts from the initial action at the next driving. ● The instruction is simultaneously executed with the scan cycle of the PLC. To execute a series of displays, the scan cycle of the PLC needs more than 10ms. When it is less than 10ms, the constant scan mode shall be used and scan cycle more than 10ms shall be operated. ● ON voltage of transistor output of the PLC is about 1.5V, the 7-section display shall use the corresponding output voltage. Setting of parameter n: it is used to set loop in which the transistor is of positive or negative polarity. The 7-section display is one group or two groups of 4-bit fingers.

《Logic of PLC》 NPN transistor output loop: when the internal signal is 1, it outputs low level, which is called negative logic. Full- loading resistor Logic1 Low Negative PLC

PNP transistor output loop: when the internal signal is 1, it outputs high level, which is called positive logic.

PLC Positive High

Unloading Logic 1 resistor

6-132 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

《Logic of 7-section display》 Function Positive logic Negative logic Data input High level converted into BCD data Low level converted into BCD data Control signal Data saved in high level Data saved in low level

《Selection of parameter n》 Number of groups for One group Two groups 7-section display Logic between PLC output terminal and data input Same Different Same Different terminal of the display Logic between PLC output Diffe Diffe Diffe Diffe terminal and data scan signal Same Same Same Same rent rent rent rent of the display n 0 1 2 3 4 5 6 7 When logics of PLC transistor output and 7-section display are the same or not the same, it can be matched with setting value of the parameter n. Assume PLC output is of negative logic, data input terminal of 7-section display is also of negative logic and control signal of 7-section monitor is of positive logic. If it is 4-bit for 1 group, n=1; for 4-bit for 2 groups, n=5.

6-133 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

F75 ARWS arrow switch F ARWS Arrow switch S· D1· D2· n 75

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * D1· * * * * * * D2· * n * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction is 1. Instruction Format ARWS S· D1· D2· n

S· :Start device for key input, which occupies 4 continuous points. D1· :Device with data input by arrow switch D2· :Start device with 7-section display scan output, occupying 8 points, which is used to set values by visual means. n :It is the same as n in the instruction SEGL, with n=0~3. Function The instruction is used for input and display of arrow switch.

For example: X000 ARWS X020 D0 Y020 K0

Y024 Increase Y025 Y026 Y027 X021

3 2 1 0 10 10 10 10 Carrying Abdication Y020 1 X023 X022 Y021 2 Y022 3 X020 Y023 4

It is used in 7-section decoding monitor for Decrease visual setting. ● 16-bit binary BCD (effective between 0-9,999 after conversion) data is stored in D0. BCD code is used in the following interpretation for convenience. ● When the drive input X000 is ON, it is specified as 103 bit. When pressing the abdication key each time, it changes as per 103-102-101-100-103. In addition, when pressing the carrying key each time, it changes as per103-100-101-102-103. The specified bit can display by LED according

6-134 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O to the control signals (Y024~Y027). ● As for specified bit, once the added key D0 is pressed, it changes as per 0-1-2-3-4-5-6-7-8-9-0-1. When the decreasing button is pressed, it changes as per 0-9-8-7……1-0-9. The content is displayed by 7-section display. ●As shown above, the instruction allows you to view the display when while writing the destination value into D0.

Supplementary description: The output points Y20~Y27 specified by the instruction must use transistor output. When the instruction is used, please fix the scan time or the instruction is inserted into the interruption subprogram for executing.

6-135 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

F76 ASC ASCII code conversion F ASC ASCII code conversion D· 76

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z D· * * * * Note:AP300 series supports data register W. Instruction Format ASC S D·

S :8 letters and fingers input by the computer(A~Z, 0~9. The half-width characters are processed, while the full-width characters won't be processed). If the input is less than 8 characters, the low bit will fill the empty position. If the input is A, put A at the highest bit, and leave the rest 7 bits as “ ”. D· :Start address of the device for storing the ASCII code after conversion Function The instruction is used to convert the characters into ASCII codes and store them in the specified element. For example: X000 ASC ABCDEFGH D300

Result of instruction execution: The letters A~H are sent to D300~D303 after ASCII code after conversion. High Low 8-bit 8-bit D300 42(B) 41(A) D301 44(D) 43(C) D302 46(F) 45(E) D303 48(H) 47(G) ● The instruction is used for displaying error and other information on external display.

6-136 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

● After M8161 is set ON, when executing the instruction, only low 8-bit is moved to D•, which occupies the devices with the same number of the characters moved and the high 8-bit is 0. High Low 8-bit 8-bit D300 00 41 A D301 00 42 B D302 00 43 C D303 00 44 D D304 00 45 E D305 00 46 F D306 00 47 G D307 00 48 H

6-137 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

F77 PR ASC II code printing F PR ASCII code print S· D· 77

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * D· * Note 1:AP300 series supports data register W. Note 2:The time of using the instruction is: 1(But it can be decorated by the index register). Instruction Format PR S· D·

S· :Start element for storing the ASCII code to be moved D· :External output point of outputting ASCII code, occupying 10 continuous points. Function The instruction is used for moving ASCII code data to Y.

For example: X000 PR D300 Y000

《Action of PR instruction 》When M8027=OFF ● Like the previous page, if ASCII data is stored in D300 ~D303(WhenM8027=0, only D300-D303 will be occupied), sequence of moving starts with A and ends with H. ● The moving output is Y000 (Low bit) ~Y007 (high bit), and others include control signal Y010 and executing flag Y011.

 When the drive input X000 is executing, if it is OFF, the moving is stopped immediately and the external output points are all cleared. When it is ON a second time, it acts from the initial state.

6-138 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

● When the instruction is executed with the scan cycle (T0 in the above figure), if the scan cycle is short, please use constant scan mode; if it is long, please use timing interruption driving. ● Transistor output must be used for the PLC. ● Even if the driving X000 is in ON status continuously, it will stop outputting after a cyclic output is finished.

《16-character sequential output》 FNC77 (PR) is the instruction for series connection output 8-bit parallel data in sequence. When the special auxiliary relay M8027=OFF, it is 8~character series connection output; when M8027=ON, it is 1~16 character series connection output. When moving the data, in case of 00H (NUL), namely, it stops executing the instruction, the data left will not be output.

《Action of PR instruction 》When M8027=OFF

Driving input X000

Start End Data Y007~Y000 character character TTT

Select pulse signal Y010

Executing mark Y011

Execution finishing mark M8029

T: Computation cycle or time of interruption

● When the instruction drives X000 on the rising edge, the instruction starts executing; if the drive X000 is OFF during data output, the output is not stopped. ● Even if the driving X000 is in ON status continuously, it will stop outputting after a cyclic output is finished. However, the flag 8029 will act until X000 is OFF.

6-139 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

F78 FROM BFM reading F FROM BFM reading m1 m2 D· n 78 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z m1 * * * * m2 * * * * D· * * * * * * * * * n * * * * Note 1:AP300 series supports data register W. Note 2:AP100 series doesn't support the instruction. Instruction Format FROM m1 m2 D· n m1 :The unit number of the special functional unit/module, m1=0~255. 0~253:Communication port for the expansion module; 254:RS485 or RS232 expansion card communication port ; 255:RS485 or RS232 expansion card communication port 2. (Only K of AP300 series is in the range of 0~255, which is 0~254 for other AP series.) m2 :Number of the buffering storage zone(BFM) for the sending source, m2=0~FFFFH. D· :Number of the destination element. n :Sending points, n=1~61(16bit)/1~30 (32bit). Function It is to read the content in the buffering storage zone(BFM) of the special functional unit/module in the PLC. When the instruction is used to read the data of multiple buffering storage zones(BFM), error might occur to the watchdog timer.

For example: M8000 FROM K0 K4 D0 K3

The program in the above figure reads the content of BFM#4~#6 in the special module(The unit number is 0 fixedly) to D0~D2.

《Specifying content of the operand》 1) m1 :The unit number of the special functional unit/module. It is used to specify the target device for which the instruction FROM/TO acts. Setting range: K0~255. For the PLC, the unit number of the connected special functional unit/module can be

6-140 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O distributed automatically. The unit number from the module closet to the basic unit is 0→1→2… in sequence. 2)m2 :BFM number In the special functional unit/module, a maximum of 32,767 points of 16-bit RAM can be built in, which is called BFM. The BFM number is within the range of 0~32,766, in which the content depends on the control purpose. Setting range:H0~HFFFF. When processing BFM with a 32-bit instruction, the specified BFM is a low 16-bit number, while the adjacent BFM is a high 16-bit. 3)n :Sending points Setting range: K1~K61. n is used to specify the sending points of words. n=2 in 16-bit instruction will get the same results as n=1 in 32-bit instruction.

《Related elements》 a) M8028 interruption permitted 1、M8028=OFF When executing instruction FROM/TO, it will change to the state of interruption prohibited automatically, and the input interruption and timer interruption won't be executed. The interruption generated during this period will be executed immediately after the execution of instruction FROM/TO is finished. Besides, the instruction FROM/TO can be also used in the interruption program. 2、M8028=ON If interruption is generated during the execution of instruction FROM/TO, the interruption will be executed, and then the interruption program will be executed. However, the instruction FROM/TO can't be used in the interruption program. b) M8070 error alarm The special reference coil M8070 is the indicator of communication error status. When communication error occurs, M8070 is ON. c) D8070 error code When communication error occurs, the error code will be stored in the special data register D8070.

6-141 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

《Solutions to Errors of Watchdog Timer》 1. Reason to cause error of watch dog timer a. Connecting with many special expansion devices Under the system configuration of connecting with many special expansion devices(locating, cam switch, link, analog, and etc.), the BFM executed when PLC runs will take longer time for initialization, so it will take longer time for computation, which will cause error of watchdog timer. b. Multiple instructions FROM/TO driven simultaneously When multiple instructions FROM/TO are executed to perform sending operation to multiple BFMs, the computation time will be longer, which might also cause error of watchdog timer. 2. Solutions a. Change the time of watchdog timer By modifying the content of D8000(timer of watchdog timer), it could change the detection time of the watchdog timer. Type in the following program, then the sequential control program will conduct monitoring according to the new timer of watchdog timer. M8002 Time of watchdog timer MOV K300 D8000 Watchdog timer refreshing 300ms When the instruction WDT is not written, WDT the value of D8000 will become valid when processing END. b. Change the time sequence of executing the instructions FROM/TO Please stagger the time sequence of executing the instructions FROM/TO, so as to shorten the computation time.

6-142 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

F79 TO BFM writing F TO BFM writing m1 m2 S· n 79 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z m1 * * * * m2 * * * * S· * * * * * * * * * * * n * * * * Note 1:AP300 series supports data register W. Note 2:AP100 series doesn't support the instruction. Instruction Format TO m1 m2 S· n m1 :The unit number of the special functional unit/module, m1=0~255. 0~253:Communication port for the expansion module; 254:communication port for the RS485 or RS232 expansion card; 255:communication port 2 for the RS485 or RS232 expansion card. (Only K of AP300 series is in the range of 0~255, which is 0~254 for other AP series.) m2 :Number of the buffering storage zone(BFM) for the sending destination, m2=0~FFFFH. S· :Element number of the sending source. n :Sending points, n=1~60(16bit)/1~30 (32bit). Function It writes the data from PLC to the BFM of the special functional unit/module. When the instruction is used to read the data of multiple buffering storage zones(BFM), error might occur to the watchdog timer. For example: M1 TO K0 K27 H0 K1

As shown in the above figure, the program writes [H0] in BFM#27 of the special module(with the unit number is fixed to be 0). 《Specifying content of the operand》 1) m1 :The unit number of the special functional unit/module. It is used to specify the target device for which the instruction FROM/TO acts. Setting range: K0~255. For the PLC, the unit number of the connected special functional unit/module can be distributed automatically. The unit number from the module closet to the basic unit is 0→1→2… in sequence.

6-143 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

2)m2 :BFM number In the special functional unit/module, a maximum of 32,767 points of 16-bit RAM can be built in, which is called BFM. The BFM number is within the range of 0~32,766, in which the content depends on the control purpose of the device.. Setting range:H0~HFFFF. When processing BFM with a 32-bit instruction, the specified BFM is a low 16-bit number, while the adjacent BFM is a high 16-bit. 3)n :Sending points Setting range: K1~K60. n is used to specify the sending points of words. n=2 in 16-bit instruction will get the same results as n=1 in 32-bit instruction.

《Related elements》 a) M8028 interruption permitted 1、M8028=OFF When executing instruction FROM/TO, it will change to the state of interruption prohibited automatically, and the input interruption and timer interruption won't be executed. The interruption generated during this period will be executed immediately after the execution of instruction FROM/TO is finished. Besides, the instruction FROM/TO can be also used in the interruption program. 2、M8028=ON If interruption is generated during the execution of instruction FROM/TO, the interruption will be executed, and then the interruption program will be executed. However, the instruction FROM/TO can't be used in the interruption program. b) M8070 error alarm The special reference coil M8070 is the indicator of communication error status. When communication error occurs, M8070 is ON. c) D8070 error code When communication error occurs, the error code will be stored in the special data register D8070.

《Solutions to Errors of Watchdog Timer》 1. Reason to cause error of watch dog timer a. Connecting with many special expansion devices Under the system configuration of connecting with many special expansion devices(locating, cam switch, link, analog, and etc.), the BFM executed when PLC runs will

6-144 Chapter 6 Interpretation of Application Instructions Peripheral devices I-O

take longer time for initialization, so it will take longer time for computation, which will cause error of watchdog timer. b. Multiple instructions FROM/TO driven simultaneously When multiple instructions FROM/TO are executed to perform sending operation to multiple BFMs, the computation time will be longer, which might also cause error of watchdog timer. 2. Solutions a. Change the time of watchdog timer By modifying the content of D8000(timer of watchdog timer), it could change the detection time of the watchdog timer. Type in the following program, then the sequential control program will conduct monitoring according to the new timer of watchdog timer.

M8002 Time of watchdog timer MOV K300 D8000 Watchdog timer refreshing 300ms When the instruction WDT is not written, WDT the value of D8000 will become valid when processing b. Change the time sequence of executing the instructions FROM/TO Please stagger the time sequence of executing the instructions FROM/TO, so as to shorten the computation time.

6-145 Chapter 6 Interpretation of Application Instructions External serial devices

10 F80~F88 External Serial Devices SER

External serial devices Function No. Mnemonic Name Page F80 RS RS communications 6-147 F81 PRUN Octal code bit sending 6-154 F82 ASCI HEX converted into ASCII 6-155 F83 HEX ASCII converted into HEX 6-158 F84 CCD Check code 6-160 F87 MBUS MBUS communication 6-162 F88 PID PID operation 6-169

6-146 Chapter 6 Interpretation of Application Instructions External serial devices

F80 RS communications F RS RS communications S· m D· n K 80

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * m * * * * D· * * n * * * * K * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction is 1. Instruction Format · · RS S m D n K S· :Address of data sent. m :Length of data sent (0~255). D· :Address of data received. n :Length of data received (0~255). K :Serial port selection, constant 0~1. 0:RS485 communication port; 1:RS485 or RS232 expansion card communication port ; 2:RS485 or RS232 expansion card communication port 2. (Only K of AP300 series can be 0, 1 or 2, which is 0 or 1 for other AP series.) Function The instruction uses RS232/RS485 expansion card communication port 1/2 or the built-in RS485 communication port to achieve serial non-protocol data sending and receiving.

●Data sending format of RS485 communication port can be set by the special register D8120. During executing of the instruction RS, even if the settings of D8120 are changed, it is not accepted in fact. ● Data sending format of communication port of RS485 or RS232 expansion card can be set by the special register D8320(for the expansion card communication port 1)/D8300(for the expansion card communication port 2).. During executing of the instruction RS, even if settings of D8320/D8300 are changed, it is not accepted in fact. ● In the environment not for message sending, points of message sending are set at “K0”. In addition, in the environment not for message receiving, points of information receiving are set at (K0). ● Although one program can use a large number of RS, MBUS, DTLK, RMIO and other

6-147 Chapter 6 Interpretation of Application Instructions External serial devices communication instructions upon demands, one communication instruction is driven at one serial port at the same time. Moreover, the time of OFF shall be equal to or more than one scan cycle during switching.

Communication format In addition to non-sequential communication from the instruction FUN80 (RS), the communication formats D8120, D8320 and D8300 are for the special data registers of other communication instructions or computer connection. However, when the instruction FUN80 (RS) is used, the relevant setting for other communication instructions or connection with the computer will be unavailable. Please follow the instructions below to set the format. Content Bit number Name 0(Bit OFF) 1(Bit ON) B0 Length of data 7 bit 8 bit (0,0):None B1 Parity B2,B1: (0,1):(ODD) B2 (1,1):(EVEN) B3 Stop bit 1 bit 2 bit (0,1,1,0):4,800 (1,0,1,1):115,200 B4 Communication (0,1,1,1):9,600 (1,1,0,0):128,000 B5 speed B7,B6,B5,B4: (1,0,0,0):19,200 (1,1,0,1):307,200 B6 (bps) (1,0,0,1):38,400 (1,1,1,0):500,000 B7 (1,0,1,0):57,600 B8[*1] Start character No Yes, initial value: STX(02H) B9[*1] End character No Yes, initial value: ETX(03H) B10~B15[*2] Unavailable — — Note:*1. The content of the start character and end character can be changed by the user. When the computer connection is used, it shall be reset first. *2. B10~B15 are the setting items for other communication instructions or computer connection. When the instruction FUN80 (RS) is used, it shall be used with “0”. When any of B10, B11, B12, B13, B14 and B15 is none-zero, preset the baud rate as 19.2kbps, 8bit data, 2bit for stopping, without parity verification. *3. When the host is powered on, D8120, D8320, D8300 are set as 89Hex by default.

6-148 Chapter 6 Interpretation of Application Instructions External serial devices

Setting example of communication format Length of data 8 bit Parity No Stop bit 2 bit Transmission Speed 19,200 bps Start character No End character No Communication port selection RS485 communication port

Communication setting in the table above shall be set according to the following program or serial communication of peripheral machines. b15 b12 b11 b8 b7 b4 b3 b0 D8120 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 ↓ D8120 89H

M8002 MOV H89 D8120

Special relay and data register used: a) When RS485 communication port is used: 1) Sending waiting (M8121): if there is sending request during data receiving, 1 is set; after receiving, it is cleared automatically during data sending. 2) Sending request (M8122): when M8122 is set by a pulse instruction under waiting for receiving or finishing of receiving, the data of length (m) is started to send from S. When sending is finished, M8122 is reset automatically. 3) Receiving finishing (M8123): after receiving is finished, M8123 is ON. The data received is transmitted to specified register, then reset to enter the status of waiting for receiving. 4) Communication format setting (D8120): refer to the communication format of the instruction RS described in previous text. 5) Number of residual data to be sent (D8122). 6) Number of data received (D8123). 7) Start character (D8124): it is for user to set the start character. 8) End character (D8125): it is for user to set the end character. b) When communication port of RS485 or RS232 expansion card are used (see the above text for definitions)

6-149 Chapter 6 Interpretation of Application Instructions External serial devices

1) Sending waiting (M8321). 2) Sending request (M8322). 3) Receiving finishing (M8323) 4) Communication format setting (D8320). 5) Number of residual data to be sent (D8322). 6) Number of data received(D8323). 7) Start character (D8324). 8) End character (D8325). c) When communication port 2 of RS485 or RS232 expansion card are used (see the above text for definitions) 1) Sending waiting (M8301). 2) Sending request (M8302). 3) Receiving finishing (M8303) 4) Communication format setting (D8300). 5) Number of residual data to be sent (D8302). 6) Number of data received(D8303). 7) Start character (D8304). 8) End character (D8305).

Time sequence of sending and receiving The instruction RS does not only stipulate the first address and number of points of data sent from PLC, but also stipulate storage first address and maximum number of points of received data. See the following for the sequence of sending and receiving data with instruction RS (RS485 communication port). X 010 RS D200 D0 D500 D1 K0 Address and number Address and number Select of points of data of points of sent data interface received Pulse W rite D0(Number of points of W rite content of data to be sent sending) and content of D200~ Send request Send request. It will be reset automatically SET M8122 after sending is finished. Please don’ t reset with program. M8123 Transmit the data received Transmit content of data to be sent to the specified register Finish The receiving finishing mark receiving RST M8123 can’ t be reset in one continuously operated program

6-150 Chapter 6 Interpretation of Application Instructions External serial devices

Instruction RS drives OFF ON

Send data Data 1 Data 4

Send request M8122 ON OFF Sending waiting OFF ON M8121 Receiving Data 2 Data 3 data Receiving OFF ON ON finishing M8123 The state of receiving waiting starts Please use sequential control program for resetting, or it can’t receive the next data.

■ Sending request M8122 ● When the input condition X010 is ON, instruction RS is executed, the controller enters the state of waiting for receiving. ● In the state of waiting for receiving or receiving finishing, M8122 is set ON by pulse signal, continuous D0 points of data from D200 is sent When sending is finished, M8122 will be set OFF automatically. ■ Receiving finishing M8123 ● When receiving finishing flag M8123 is ON, all the data received will be transferred to other elements for storing, and M8123 is set OFF. ● If M8123 is set OFF, it enters the state of waiting for receiving. When the input condition X010 is ON, instruction RS is executed, the controller enters the state of waiting for receiving. ● When setting (D1) = 0, execute the instruction RS, M8123 will not act or enter the state of waiting for receiving. If D1≧ 1, after M8123 is ON and then OFF, it enters the state of waiting for receiving.

《16-bite data processing》When M8161=OFF (M8161 is shared by such instructions as ASCI, HEX, CCD, etc. )

6-151 Chapter 6 Interpretation of Application Instructions External serial devices

M8000 M8161 OFF 16-bit mode

RS D200 K4 D500 K10 K0

High 8-bit Low 8-bit The 16-bit data is divided into high and low 8-bit for data sending and receiving.

Sending data STX D200 Down D200 Up D201 Down D201 Up ETX Start ↖ Start address No. specified by S End Symbol ← Number of byte to be sent specified by M → character

Receiving data STX D500 Down D500 Up D501 Down D501 Up D502 Down D502 Up ETX Start ↖ Start address No. specified by D End Symbol It can't exceed the maximum number of received points specified by n. The end Symbol character ETX or n points received indicate the receiving is finished.

(1) Data sent or the number of residual data to be sent Down Up Down Up

Data to be sent STX D200 D200 D201 D201 ETX 4 3 Number of 2 residual data to be 1 sent D8122 0 (2) Data received or the number of data received Down Up Up Data received STX D500 D500 Down D501 Up D501 Down D502 D502 ETX 6 5 When the receiving finishing mark 4 M8123 is reset, the data received will Number of data 3 2 be reset as well. received 1 D8123 0

《8-bite data processing (expansion function)》When M8161=ON(M8161 is shared by such instructions as ASCI, HEX, CCD, etc. )

M8000 M8161 ON 8-bit m ode

RS D200 K4 D500 K10 K0

High 8-bit(Ignored) Low 8-bit For 16-bit data, the high 8-bit w ill be ignored, and only low 8-bit w ill be valid.

6-152 Chapter 6 Interpretation of Application Instructions External serial devices

Sending data STX D200 Down D201 Down D202 Down D203 Down ETX Start ↖ Start address No. specified by S End Symbol ← Number of byte to be sent specified by M → Symbol

Receiving data STX D500 Down D501 D502 Down D503 Down D504 Down D505 ETX Down Down Start ↖ Start address No. specified by D End Symbol It can't exceed the maximum number of received points specified by n. The end Symbol character ETX or n points received indicate the receiving is finished.

(1) Data sent or the number of residual data to be sent Down Down STX Down D200 ETX Data to be sent D202 D203 D201 Down

4 3 Number of residual 2 data to be sent D8122 1 0 (2) Data received or the number of data received Down Down Down Down Data received STX D500 D501 D502 Down D503 Down D504 D505 ETX

6 5 When the receiving finishing mark M8123 is reset, 4 3 the data received will be reset as well. Number of data received 2 1 D8123 0

6-153 Chapter 6 Interpretation of Application Instructions External serial devices

F81 PRUN octal code bit sending F PRUN Octal code bit sending S· D· 81 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * D· * * Instruction Format

· · PRUN S D S· :Sending source device, n of KnX, KnM is 1~8, and lowest bit of the specified device No. is 0. D· :Sending destination device. Function This directive specifies the element number of bits with octal number processing and transmit data.

Example 1: Octal number converted to decimal digits X000 PRUN K4X010 K4M0

When instruction is executed, X10~X17→M0~M7,X20~X27→M10~M17, and values of M8 and M9 will not be changed.

Example 2: Decimal number converted to octal digits

X000 PRUN K4M0 K4Y010

When instruction is executed, M0~M7→Y10~Y17,M10~M17→Y20~Y27, and values of M8 and M9 will not be changed.

6-154 Chapter 6 Interpretation of Application Instructions External serial devices

F82 ASCI HEX converted into ASCII F ASCI HEX conversion into ASCII S· D· n 82 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format ASCI S· D· n

S· :Conversion source device. D· :Conversion destination device. n :Bits to be converted, n=1~256. Function The instruction is used to convert HEX code into ASCII code, with 16-bit and 8-bit conversion modes.

For example: X000 ASCI D100 D200 K4

Of them: D100=0ABCH D101=1234H D102=5678H ASCII: [0]=30H [1]=31H [2]=32H [3]=33H [4]=34H [5]=35H [6]=36H [7]=37H [8]=38H [9]=39H [A]=41H [B]=42H [C]=43H [D]=44H [E]=45H [F]=46H

6-155 Chapter 6 Interpretation of Application Instructions External serial devices

《16-bite conversion mode》When M8161=OFF(M8161 is shared by such instructions as RS, ASCI, HEX, CCD, etc. ) ● After the figures of HEX of S• are converted into ASCII code, they are sent to high 8-bit and low 8-bit of D•, and the bits to be converted is set with n. ● D• is divided into low 8-bit and high 8-bit, which are used to store ASCII data. Conversion results: n K1 K2 K3 K4 K5 K6 K7 K8 K9 D· D200 Low [C] [B] [A] [0] [4] [3] [2] [1] [8] D200 High [C] [B] [A] [0] [4] [3] [2] [1] D201 Low [C] [B] [A] [0] [4] [3] [2] D201 High [C] [B] [A] [0] [4] [3] D202 Low [C] [B] [A] [0] [4] D202 High [C] [B] [A] [0] D203 Low [C] [B] [A] Do not change D203 High [C] [B] D204 Low [C]

《8-bite conversion mode》When M8161=ON(M8161 is shared by such instructions as RS, ASCI, HEX, CCD, etc. ) ● After the figures of HEX of S• are converted into ASCII code, they are sent to low 8-bit of D•, and the bits to be converted are set with n. ● The high 8-bit of D· is 0. 16-bit data

0 Low 8-bit Destination address Conversion results: n K1 K2 K3 K4 K5 K6 K7 K8 K9 D· D200 [C] [B] [A] [0] [4] [3] [2] [1] [8] D201 [C] [B] [A] [0] [4] [3] [2] [1] D202 [C] [B] [A] [0] [4] [3] [2] D203 [C] [B] [A] [0] [4] [3] D204 [C] [B] [A] [0] [4] D205 [C] [B] [A] [0] D206 [C] [B] [A] Do not change D207 [C] [B] D208 [C]

6-156 Chapter 6 Interpretation of Application Instructions External serial devices

When BCD data is output by printing and etc., BIN→BCD conversion instruction is used before the instruction.

6-157 Chapter 6 Interpretation of Application Instructions External serial devices

F83 HEX ASCII converted into HEX F HEX ASCII conversion into HEX S· D· n 83 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * D· * * * * * * * * * n * * Note:AP300 series supports data register W. Instruction Format HEX S· D· n

S· :Conversion source device. D· :Conversion destination device. n :Bits to be converted, n=1~256. Function The instruction is used to convert ASCII code into HEX code, with 16-bit and 8-bit conversion modes. For example: X000 HEX D200 D100 K4

《16-bite conversion mode》When M8161=OFF(M8161 is shared by such instructions as RS, ASCI, HEX, CCD, etc. ) ● After ASCII character data of high and low 8-bit of S• are converted into HEX data, it is sent to D• every 4 bits. Bits to be converted are set with n. ● In instruction HEX, when the data stored in S• is not ASCII code, it may be computation error and HEX conversion can not be executed. Especially M8161 is OFF, high 8-bit of S• needs to store ASCII code, please pay attention. Conversion results: ASCII HEX D· S· D102 D101 D100 code Conversion n D200 Low 30H 0 1 ···0H D200 High 41H A 2 Do not change ··0AH D201 Low 42H B 3 · is 0 ·0ABH D201 High 43H C 4 0ABCH D202 Low 31H 1 5 ···0H ABC1H D202 High 32H 2 6 ··0AH BC12H D203 Low 33H 3 7 ·0ABH C123H

6-158 Chapter 6 Interpretation of Application Instructions External serial devices

D203 High 34H 4 8 0ABCH 1234H D204 Low 35H 5 9 ···0H ABC1H 2345H 《8-bite conversion mode》When M8161=ON(M8161 is shared by such instructions as RS, ASCI, HEX, CCD, etc. ) ● After ASCII character data of low 8-bit of S• are converted into HEX data, it is sent to D• every 4 bits Bits to be converted are set with n. 16-bit data

Ignored Low 8-bit Source address Conversion results: D ASCII HEX S· · D102 D101 D100 code Conversion n D200 30H 0 1 ···0H D201 41H A 2 Do not change ··0AH D202 42H B 3 · is 0 ·0ABH D203 43H C 4 0ABCH D204 31H 1 5 ···0H ABC1H D205 32H 2 6 ··0AH BC12H D206 33H 3 7 ·0ABH C123H D207 34H 4 8 0ABCH 1234H D208 35H 5 9 ···0H ABC1H 2345H

When the input data is BCD code, BCD→ BIN conversion shall be executed after executing the instruction.

6-159 Chapter 6 Interpretation of Application Instructions External serial devices

F84 CCD check code F CCD Check code S· D· n 84 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * D· * * * * * * * n * * * * Note:AP300 series supports data register W. Instruction Format CCD S· D· n

S· :Start device of data source D· :Store checking results. n :number of data, n=1~256. Function The instruction is used to compute the check code, with 16-bit and 8-bit conversion modes.

For example: X000 CCD D100 D0 K10

《16-bite conversion mode》When M8161=OFF(M8161 is shared by such instructions as RS, ASCI, HEX, CCD, etc. ) ● The sum of the high and low-bit data of n points from the device specified by S• and the horizontal check code are stored in D• and D•+1 devices. ● It is used for verification of communication data. Conversion of the above program is shown as below: S· Data content S· Data content D100 High K111=01101111 D100 Low K100=01100100 D101 High K98=01100010 D101 Low K100=01100100 D102 High K66=01000010 D102 Low K123=01111011 D103 High K95=01011111 D103 Low K100=01100100 D104 High K88=01011000 D104 Low K210=11010010 Total K1091 Horizontal check 10000101 Horizontal check: if number of 1 is odd, it is 1; it is even, it is 0.

6-160 Chapter 6 Interpretation of Application Instructions External serial devices

《8-bite conversion mode》When M8161=ON(M8161 is shared by such instructions as RS, ASCI, HEX, CCD, etc. ) ● The sum of n points(only low-bit data) from the device specified by S• and the horizontal check code are stored in D• and D•+1 devices. ● It is used for verification of communication data. 16-bit data

Ignored Low 8-bit Source address Conversion of the above program is shown as below: S· Data content D100 K100=01100100 D101 K111=01101111 D102 K100=01100100 D103 K98=01100010 D104 K123=01111011 D105 K66=01000010 D106 K100=01100100 D107 K95=01011111 D108 K210=11010010 D109 K88=01011000 Total K1091 Horizontal check 10000101

6-161 Chapter 6 Interpretation of Application Instructions External serial devices

F87 MBUS MBUS communication F MBUS MBUS communication S· m D· n K 87

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * m * * * * D· * * n * * * * K * * Note 1:AP300 series supports data register W. Note 2:The limit on simultaneous driving of the instruction is 1. Instruction Format MBUS S· m D· n K

S· :Address of data sent. m :Length of data sent (0~253). D· :Address of data received. n :Length of data received (0~253). K :Serial port selection, constant 0~1. 0:RS485 communication port; 1:RS485 or RS232 expansion card communication port ; 2:RS485 or RS232 expansion card communication port 2. (Only K of AP300 series can be 0, 1 or 2, which is 0 or 1 for other AP series.) Function The instruction uses RS232/RS485 expansion card communication port 1/2, RS484 communication port or the built-in RS484 communication port to achieve serial Modbus-protocol data sending and receiving. The above two ports can realize communication function of instruction MBUS simultaneously, and such function independently. The instruction MBUS of PLC under AP series only supports RTU mode, and ASCII mode is unavailable. The instruction MBUS can be used as host station communication: The stored instruction format of register sending data is HEX instruction code, including address, function code and communication data. The instruction MBUS adds CRC check code(2 bytes) according to the setting mode like RTU mode before sending. The stored instruction format in the register receiving data is address, function code and communication data, and the check code is not stored.

●Data sending format of RS485 communication port can be set by the special register D8120.

6-162 Chapter 6 Interpretation of Application Instructions External serial devices

During executing of the instruction MBUS, even if the settings of D8120 are changed, it is not accepted in fact. ● Data sending format of communication port of RS485 or RS232 expansion card can be set by the special register D8320(for the expansion card communication port 1)/D8300(for the expansion card communication port 2).. During executing of the instruction MBUS, even if settings of D8320/D8300 are changed, it is not accepted in fact. ● In the environment not for message sending, points of message sending are set at “K0”. ● Although one program can use a large number of RS, MBUS, DTLK, RMIO and other communication instructions upon demands, one communication instruction is driven at one serial port at the same time. Moreover, the time of OFF shall be equal to or more than one scan cycle during switching.

Communication format In addition to Modbus-protocol communication from the instruction FUN87 (MBUS), the communication formats D8120, D8320 and D8300 are for the special data registers of other communication instructions or computer connection. However, when the instruction FUN87 (MBUS) is used, the relevant setting for other communication instructions or connection with the computer will be unavailable. Please follow the instructions below to set the format. Content Bit number Name 0(Bit OFF) 1(Bit ON) B0 Length of data 7 bit 8 bit B1 (0,0):None (1,1):(EVEN) Parity B2,B1: B2 (0,1):(ODD) B3 Stop bit 1 bit 2 bit (0,1,1,0):4,800 (1,0,1,1):115,200 B4 Communication (0,1,1,1):9,600 (1,1,0,0):128,000 B5 speed B7,B6,B5,B4: (1,0,0,0):19,200 (1,1,0,1):307,200 B6 (bps) (1,0,0,1):38,400 (1,1,1,0):500,000 B7 (1,0,1,0):57,600 B8!B12[*1] Unavailable — — B13 Unavailable — — B14~B15[*1] Unavailable — — *1. B8~B13,B14,B15 are the setting items for other communication instructions or computer connection. When the instruction FUN87(MBUS) is used, it shall be used with “0”. When any of B10, B11, B12, B13, B14 and B15 is none-zero, preset the baud rate as 19.2kbps, 8bit data, 2bit for stopping, without parity verification.

6-163 Chapter 6 Interpretation of Application Instructions External serial devices

*2. When the host is powered on, D8120, D8320, D8300 are set as 89Hex by default.

Setting example of communication format Length of data 8 bit Parity No Stop bit 2 bit Transmission Speed 38,400 bps Port selection RS485 communication expansion card

Communication setting in the table above shall be set according to the following program or serial communication of peripheral machines. b15 b12 b11 b8 b7 b4 b3 b0 D8320 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 ↓ D8320 99H

M8002 MOV H99 D8320

Special relay and data register used: a) When RS485 communication port is used: 1) Sending waiting (M8121): if there is sending request during data receiving, 1 is set; after receiving, it is cleared automatically during data sending. 2) Sending request (M8122): when M8122 is set by a pulse instruction under waiting for receiving or finishing of receiving , the data of length (m) is started to send from S. When sending is finished, M8122 is reset automatically. When the interval of setting M8122 ON for twice is smaller than 20ms, the interval for sending instruction MBUS is 20ms. 3) Receiving finishing (M8123): after receiving is finished, M8123 is ON. The data received is transmitted to specified register, then reset to enter the status of waiting for receiving. 4) Error indication (M8124): receiving error (error of CRC). 5) Communication format setting (D8120): refer to the communication format of the instruction MBUS described in previous text. 6) Number of residual data to be sent (D8122). 7) Number of data received(D8123). b) When communication port of RS485 or RS232 expansion card are used (see the above text for definitions)

6-164 Chapter 6 Interpretation of Application Instructions External serial devices

1) Sending waiting (M8321). 2) Sending request (M8322). 3) Receiving finishing (M8323) 4) Error indication (M8324) 5) Communication format setting (D8320) 6) Number of residual data to be sent (D8322) 7) Number of received data (D8323) b) When communication port of RS485 or RS232 expansion card are used (see the above text for definitions) 1) Sending waiting (M8301). 2) Sending request (M8302). 3) Receiving finishing (M8303) 4) Error indication (M8304) 5) Communication format setting (D8300) 6) Number of residual data to be sent (D8302) 7) Number of data received(D8303).

Time sequence of sending and receiving The instruction MBUS does not only stipulate the first address and number of points of data sent from PLC, but also stipulate storage first address and maximum number of points of received data. See the following for the sequence of sending and receiving data with instruction MBUS (Taking RS485 communication expansion card as an example).

X010 M B U S D 200 D 0 D 500 D 1 K1 Address and number Address and number Select of points of data of points of sent data interface received Pulse W rite content of data to be Write D0(Number of points of sent sending) and content of D200~ Send request Send request. It will be reset automatically S E T M 8322 after sending is finished. Please don’ t reset with program. M8323 Transm it content of data to Transm it the data received be sent to the specified register Finish The receiving finishing mark receiving R S T M 8323 can’ t be reset in one continuously operated program

6-165 Chapter 6 Interpretation of Application Instructions External serial devices

Instruction RS drives OFF ON

Send data Data 1 Data 4

Send request M8322 ON OFF Sending waiting OFF ON M8321 Receiving Data 2 Data 3 data Receiving OFF ON ON finishing M8323 The state of receiving waiting starts Please use sequential control program for resetting, or it can’t receive the next data. ■ Sending request M8322 ● When the input condition X010 is ON, instruction MBUS is executed, the controller enters the state of waiting for receiving. ● In the state of waiting for receiving or receiving finishing, M8322 is set ON by pulse signal, continuous D0 points of data from D200 is sent When sending is finished, M8322 will be set OFF automatically. ■ Receiving finishing M8323 ● When receiving finishing flag M8323 is ON, all the data received will be transferred to other elements for storing, and M8323 is set OFF. ● If M8323 is set OFF, it enters the state of waiting for receiving. When the input condition X010 is ON, instruction MBUS is executed, and the controller enters the state of waiting for receiving. ● When setting (D1) = 0, execute the instruction MBUS, M8323 will not act or enter the state of waiting for receiving. If D1≧ 1, after M8323 is ON and then OFF, it enters the state of waiting for receiving.

《16-bite data processing》When M8161=OFF(M8161 is shared by such instructions as RS, ASCI, HEX, CCD, etc. ) M8000 OFF 16-bit M8161 mode

MBUS D200 K4 D500 K6 K1

High 8-bit Low 8-bit The 16-bit data is divided into high and low 8-bit for data sending and receiving.

Sending data

6-166 Chapter 6 Interpretation of Application Instructions External serial devices

D200 Down D200 Up D201 Down D201 Up Check code ↖ Start address No. specified by S CRC(RTU) ← Number of byte to be sent specified by M →

Receiving data D500 Down D500 Up D501 Down D501 Up D502 Down D502 Up Check code ↖ Start address No. specified by D CRC(RTU) It can't exceed the maximum number of received points specified by n. The end character ETX or n points received indicate the receiving is finished.

(1) Data sent or the number of residual data to be sent

RTU Mode Down Up Up

Data to be sent D200 D200 D201 Down D201 Up CRC Down CRC

6 5 4 3 Number of residual 2 data to be sent 1 D8322 0 (2) Data received or the number of data received

RTU mode Down Down Up Down Up Down Up Data received D500 Up D500 D501 D501 D502 D502 CRC CRC

8 7 6 5 W hen the receiving finishing m ark M 8323 is 4 3 reset, the data received will be reset as well. Num ber of data received 2 1 D8323 0

《8-bite data processing (expansion function)》When M8161=ON(M8161 is shared by such instructions as RS, ASCI, HEX, CCD, etc. )

M8000 M 8161 ON 8-bit mode

M B U S D 2 0 0 K 4 D 5 0 0 K 6 K 1

High 8- Low 8-bit bit(Ignored) F o r 16 - b i t data, t h e hig h 8 - b i t data w ill be ig n o r ,

6-167 Chapter 6 Interpretation of Application Instructions External serial devices

Sending data D200 Down D201 Down D202 Down D203 Down Check code ↖ Start address No. specified by S CRC(RTU) ← Number of byte to be sent specified by M →

Receiving data D500 D501 D502 D503 Down D504 D505 Down Check Down Down Down Down code ↖ Start address No. specified by CRC D (RTU) It can't exceed the maximum number of received points specified by n. The end character ETX or n points received indicate the receiving is finished.

(1) Data sent or the number of residual data to be sent

RTU Mode Down Down Up Down

Data to be sent D200 D201 D202 Down D203 CRCDown CRC

6 5 4 3 Num ber of residual 2 data to be sent 1 D8322 0 (2) Data received or the number of data received

RTU mode Up Down Data received D500 Down D501 Down D502 D503 Down D504 Down D505 Down CRC Down CRC

8 7 6 5 When the receiving finishing mark M8323 is 4 3 reset, the data received will be reset as well. Number of data received 2 1 D8323 0

6-168 Chapter 6 Interpretation of Application Instructions External serial devices

F88 PID PID operation F PID PID operation S1· S2· D· 88

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * S2· * * S3· * * D· * * Note:AP300 series supports data register W. Instruction Format · · · · PID S1 S2 S3 D S1· :Setting value (SV). S2· :Set present value (PV). S3·:Parameters, S3~S3+6 set control parameters. AP100 AP200 Setting range D0~D487 D0~D2023 of S3. D· :Output value (). When executing the program, the computation results(MV) are stored in D. Function The instruction is the special instruction for PID operation control. After the sampling time is up, PID operation will be executed in the current scanning time. After setting all the parameters, it starts to execute instruction PID (before PID operation parameter setting values for PID control must be written with MOV and other instructions), the results are temporarily stored in D. Content of D. specifies the register without holding in case of power failure (For the register with holding in case of power failure, the register shall reset when RUN is added at the beginning of the program). M8002 RST D***

D*** : is the data register for holding in case of power failure.

The program will occupy 25 data registers from S3. automatically. (the following page displays ACT setting of control parameters. When B1, B2 and B5 are all 0, only 20 data registers from S3 are occupied).

6-169 Chapter 6 Interpretation of Application Instructions External serial devices

Parameter setting Setting values of parameters for control must be written with MOV and other instructions before PID operation. In addition, when specifying data register in the zone for holding in case of power failure, the setting values are held after power-OFF of the PLC. Therefore, it requires no re-writing. Address Name Operation and Function S3· Sampling time (Ts) 1~32767[ms](No shorter than the scanning time) Bit Content number 0(Bit OFF) 1(Bit ON) B0 Positive action Negative action Without input variation B1 With input variation alarm alarm Without input variation B2 With input variation alarm alarm Direction of action S3·+1 B3 Unavailable (ACT) Auto turning function Auto turning function B4 disabled enabled No upper and lower With upper and lower B5 limits of the output limits of the output values values B6~B15 Unavailable Note:B5 and B2 shall not be ON simultaneously. Input wave filtering S3·+2 0~99[%] No input wave filtering for 0 constant (a) S3·+3 Proportional gain (Kp) 1~32767[%] It is positively infinite for 0(no S3·+4 Integration time (TI) 1~32767[×100ms] integration action) 0~100[%] No differential gain for 0 S3·+5 Differential gain (KD) 0~100 are recommended, while the actual setting range is 0~200. S3·+6 Differential time(TD) 1~32767[×10ms] No differential action for 0 S3·+7~ When PID operation is executed, it is used for internal processing. S3·+19 Setting value of input S3·+20 variation (increasing) 0~32767(when S3+1bit1=1, it is effective) alarm Setting value of input S3·+21 variation (decreasing) 0~32767(when S3+1bit1=1, it is effective) alarm Setting value of output S3·+22 variation (increasing) 0~32767(when S3+1 bit2=1,bit5=0, it is effective) alarm

6-170 Chapter 6 Interpretation of Application Instructions External serial devices

Setting value of upper -32768~32767(when S3+1 bit2=0,bit5=1, it is effective) limit for output Setting value of output variation (decreasing) 0~32767(when S3+1 bit2=1,bit5=0, it is effective) S3·+23 alarm Setting value of lower -32768~32767(when S3+1 bit2=0,bit5=1, it is effective) limit for output B0:Input variation (increasing) B1:Input variation (decreasing) S3·+24 Alarm output B2:Output variation (increasing) B3:Output variation (decreasing) (when S3+1 bit1=1or bit2=1, it is effective) However, S3·+20~S3·+24 are occupied when S3·+1 B1=1, B2=1 or B5=1.

Although instruction PID can be executed for many times (no restriction on times of the loop), S3. or D. used in the computation can not be used repeatedly. PID instruction can be used in interruption of timer, sub-program, step logic and jump instruction. Maximum error of sampling time Ts is between -(1 scan cycle+1ms) and +(1 scan cycle). When Ts is too small, such variation may lead to problems. At this time, please execute with constant scan mode or program in the interruption of the timer. If sampling time Ts≤1 computation cycle of PLC controller, the following computation error will occur (K6740), and PID operation will be performed based on Ts= computation cycle. At this time, it is suggested that instruction PID can be used in interruption (I6□□~I8□□) of the timer. Input filter constant can be used to relieve variation of measuring values. Increasing differential gain can be used to relieve dramatic variation of output values.

■ Direction of action (S3+1(ACT)) ● Direction of action [B0] Direction of action of the system is specified with positive action and negative action. ● Set upper and lower limits of the output values [B5] When settings of upper and lower limits of the output values are valid (S3.+1(ACT) bit5=1), see the following figure for the output values. Use of the settings can help inhibit increasing of the PID control differential item. When the function is used, bit 2 of S3. +1(ACT) shall be OFF.

6-171 Chapter 6 Interpretation of Application Instructions External serial devices

Output Without upper/lower value limits of output value Output unavailable

S3·+22 Upper limit of output value

S3·+23 Lower limit of output value With upper and lower limits of output value Output unavailable

● Alarm setting(Input variation, output variation )[B1,B2] Make bit 1 and bit 2 of S3.+1(ACT) ON, and the operator can detect the input variation and output variation. The detection shall be executed according to values of S3.+20~S3.+23. If it exceeds the setting input variation, the bit elements of alarm symbol S3·+24 will be ON after instruction PID is executed. (see the following figure) However, when S3.+21 and S3.+23 are taken as alarm values, the setting values will be used as negative values. In addition, when the output variation is used for alarm, bit 5 of S3.+1(ACT) shall be OFF.

Input variation

Increasin g side a) Variation

Sampling (Current)- (Previous) =Variation 0 tim es b) Action of alarm symbol (S3·+24) D ecreasing side i)Input variation (B1=1) Alarm symbol S3· +24 B0 ON OFF S3· +24 B 1 OFF

Output variation

Increasing side

Sampling 0 tim es ii)Output variation (B2=1) D ecreasing side Alarm symbol S3·+24 B2 ON OFF S3· +24 B3 OFF ON Mathematical method of 3 parameters of PID To execute PID for better control, the optimum values of constants (parameters) for the control objects must be used. There will be the optimum values of 3 constants to be obtained for PID (proportional gain Kp, integration time TI and differential time TD).

6-172 Chapter 6 Interpretation of Application Instructions External serial devices

Step response method is used for mathematical computation and the following is detailed description. The step response method is to add 0-100% step output on the control system and judge features of actions from input variation (maximum inclination R and unavailable time L) to obtain 3 constants of PID. Step 1 output can be obtained by 0-75% or 0-50%. Features of actions Output value 100% Output value (MV) 0% Time

Variation of input value 1S Max ramp(R )

Time S 1S Id le tim eL(S)

Proportional gain Kp Integration Differential time

(%) timeT1(×100ms) TD(×100ms)

Only proportional 1 Outputvalu e  —— —— control P RL (MV)

0 .9 Outputvalu e PI control  33L —— RL (MV)

1 .2 Outputvalu e PID control  20L 50L RL (MV)

6-173 Chapter 6 Interpretation of Application Instructions External serial devices

In case of error in setting values of the control parameters or data of PID operation, the computation error M8067 is ON. The following data are stored in D8067 according to the error content. Processing Code Error code description Processing method state Applied instruction is specified with the K6705 incompatible register Range and data of device address No. of K6706 operand of applied instruction are out of the boundary Sampling time TS is out of the K6730 object boundary (Ts<0) Computation Input wave filtering constant is out of the K6732 of object boundary instruction Proportional gain(KP) is out of the K6733 PID stops object boundary(KP<0) Integration time(TI) is out of the object K6734 boundary (TI<0) Differential gain(KD) is out of the K6735 object boundary(KD<0 or 201≤KD) Please confirm content of control Differential time(TD) is out of the object data K6736 boundary (TD<0) K6740 Sampling time≤ Computation cycle Overflow of measuring value variation K6742 (PV<﹣32768 or 32767

6-174 Chapter 6 Interpretation of Application Instructions External serial devices

If the difference between the measuring value and the target value is below 150 when the auto tuning starts, or more than 1/3 of Auto tuning the difference between the K6750 Auto tuning result is bad ends measuring value and the target value, it will finish confirming the measuring value and target value. Please conduct the auto tuning again. The operation direction predicted by the measuring value when the auto tuning starts is consistent with that when the auto tuning outputs. Auto tuning operation direction is Auto tuning K6751 Please make the correlation inconsistent continues between the target value, the output value used by auto tuning and the measuring value correct, and then conduct auto tuning again. During the auto tuning, as it can't act correctly due to the fluctuation of the measuring value, please set Auto tuning the sampling time far more than the K6752 Auto tuning operation error ends output change cycle, and increase the input filter constant. Please conduct auto tuning again after changing the settings. Key points: Before executing PID computation, the correct measuring values shall be read into measuring value PV of PID. Especially when PID computation is executed for input value of input module of analog value, switching time shall be paid attention to.

6-175 Chapter 6 Interpretation of Application Instructions External serial devices

Basic computation formula of instruction PID PID computation is executed according to speed shape and differential shape of measuring values. PID control executes computation formula of positive action or negative action according to the specified direction in S3. In addition, for the values after S3 in computation, specify the used parameter content.

PID basic computation formula Direction of action PID computation method Positive action Ts MV  Kp{(EV  EV )  EV D } n n1 TI n n

EVn  PVnf  SV

TD  D .TD Dn  (2PVnf 1  PVnf  PVnf 2 )  .Dn1 Ts  D .TD Ts  D .TD

MVn   MV Negative action Ts MV  Kp{(EV  EV )  EV D } n n1 TI n n

EVn  SV  PVnf

TD  D .TD Dn  (2PVnf 1  PVnf  PVnf 2 )  .Dn1 Ts  D .TD Ts  D .TD

MVn   MV

Mark interpretation EVn: deviation of current sampling MVn:current operand EVn-1: deviation of one cycle Dn:current differential quantity SV: target value Dn-1:differential item one cycle before PVnf: measuring value of current sampling (after wave filtering) Kp:proportional gain PVnf-1: measuring value one cycle before (after wave filtering) Ts:sampling cycle PVnf-1: measuring value two cycles before (after wave filtering) TI:integration constant ΔMV:variation of the output TD:differential constant αD:differential gain

PVnf is the value computed according to the read measuring value. [Measuring value after wave filtering PVnf]=PVn+L(PVnf-1-PVn) PVnf: measuring value of current sampling L:wave filtering coefficient PVnf-1: measuring value one cycle before (after wave filtering)

6-176 Chapter 6 Interpretation of Application Instructions Convenient communication

11 F90~F95 Convenient Communication

Convenient communication Function No. Mnemonic Name Page F90 COIW Single coil write in 6-178 F91 MCIR Coil reading 6-182 F92 MCIW Multi-coil write in 6-184 F93 REGW Single register write in 6-186 F94 MRGR Register read 6-188 F95 MRGW Multi-register write in 6-190

6-177 Chapter 6 Interpretation of Application Instructions Convenient communication

F90 COIW single coil write in F COIW Single coil write S1· S2· D· K 90

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * D· * * * * 0,1 0,1 K * * Note:AP300 series supports data register W. Instruction Format · · · COIW S1 S2 D K S1· :Communication station number(0~255). S2· :The specified start address of the remote coil element. D· :The bit value sent locally. K :Serial port selection, constant 0~1. 0:RS485 communication port; 1:RS485 or RS232 expansion card communication port 1; 2:RS485 or RS232 expansion card communication port 2. (Only K of AP300 series can be 0, 1 or 2, which is 0 or 1 for other AP series.) Functional code:05H. Function The instruction uses RS232/RS485 expansion card communication port 1/2 or the built-in RS485 communication port to achieve the purpose of writing single coil to other devices. ●Data sending format of RS485 communication port can be set by the special register D8120. During the execution of the instruction COIW, even if the settings of D8120 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● When using the instruction, the station number of the host and slave can't be repeated. ● Data sending format of communication port 1/2 of RS485 or RS232 expansion card can be set by the special register D8320(for the expansion card communication port 1)/D8300(for the expansion card communication port 2).. During the execution of the instruction COIW, even if the settings of D8320/ D8300 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● The same program can apply a lot of communication instructions upon demands, such as MCIR. COIW, MCIW, MRGR, REGW, MRGW, and etc. After the communication of the current instruction, the current port will be released automatically, and the next instruction will be executed. After the condition of enabling the instruction is ON, the communication will be sent. If

6-178 Chapter 6 Interpretation of Application Instructions Convenient communication you need to send the communication again, it shall turn OFF the said condition for a scan cycle, and turn it ON again.

Communication format In addition to non-sequential communication from the instruction COIW, the communication formats D8120, D8320 and D8300 are for the special data registers of other communication instructions or computer connection. However, when the instruction COIW is used, the relevant setting for other communication instructions or connection with the computer will be unavailable. Please follow the instructions below to set the format. Content Bit number Name 0(Bit OFF) 1(Bit ON) B0 Length of data 7 bit 8 bit B1 (0,0):None (1,1):(EVEN) Parity B2,B1: B2 (0,1):(ODD) B3 Stop bit 1 bit 2 bit (0,1,1,0):4,800 (1,0,1,1):115,200 B4 Communication (0,1,1,1):9,600 (1,1,0,0):128,000 B5 speed B7,B6,B5,B4: (1,0,0,0):19,200 (1,1,0,1):307,200 B6 (bps) (1,0,0,1):38,400 (1,1,1,0):500,000 B7 (1,0,1,0):57,600 B8~B15[*1] Unavailable — — Note:*1. B8~B15 are the setting items for other communication instructions or computer connection, which shall be set as 0. When any of B10, B11, B12, B13, B14 and B15 is none-zero, preset the baud rate as 19.2kbps, 8bit data, 2bit for stopping, without parity verification. *2. When the host is powered on, D8120, D8320, D8300 are set as 89Hex by default.

Setting example of communication format Length of data 8 bit Parity No Stop bit 2 bit Transmission Speed 19,200 bps Communication port selection RS485 communication port

6-179 Chapter 6 Interpretation of Application Instructions Convenient communication

Communication setting in the table above shall be set according to the following program or serial communication of peripheral machines. b15 b12 b11 b8 b7 b4 b3 b0 D8120 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 ↓ D8120 89H M8002 MOV H89 D8120

Special relay and data register used: a) When RS485 communication port is used: 1) Communication finishing (M8123): Single pulse flag bit. When the communication of the instruction is finished one time (including the communication error), M8123 is set ON automatically, which will be set OFF during the next scan cycle. 2) Error indication (M8124): When no data or wrong data are returned, the instruction will be sent again. If the error still occurs for a third time, M8124 will be set ON, and the current port will be released. M8124 could be set OFF through the user program. 3) Communication format setting (D8120): refer to the communication format of the instruction MBUS described in previous text. 4) Sending interval (D8126): Set the sending interval (0~30000)*1ms, which is 10ms by default. When the conditions of enabling multiple convenient communications are set ON simultaneously, the setting value of D8126 could control the interval of sending two adjacent instructions. 5) Judging timeout (D8129): Set the time for judging timeout (5~255)*10ms. After the instruction is sent, if no data or wrong data are received within the preset time for judging timeout, the instruction will be re-sent. b) When communication port of RS485 or RS232 expansion card are used (see the above text for definitions) 1) Communication finishing (M8323) 2) Error indication (M8324) 3) Communication format setting (D8320) 4) Sending interval (D8326): Set the sending interval (0~30000)*1ms, which is 10ms by default. 5) Judging timeout (D8329): Set the time for judging timeout (5~255)*10ms. c) When communication port 2 of RS485 or RS232 expansion card are used (see the above text for definitions) 1) Communication finishing (M8303)

6-180 Chapter 6 Interpretation of Application Instructions Convenient communication

2) Error indication (M8304) 3) Communication format setting (D8300) 4) Sending interval (D8306): Set the sending interval (0~30000)*1ms, which is 10ms by default. 5) Judging timeout (D8309): Set the time for judging timeout (5~255)*10ms.

In case of communication error, the current error code will be stored in the register D8345, and the error step number will be stored in register D8346. The table below lists the error code and error information. Code Error code description Processing state K6760 CRC verification error Instruction operation continues K6761 No response K6762 Response exception K6763 Can't identify returned data

For example: Control the action Y0 of the slave by M0 of the AP host, and set the station number of the AP host as 1. Change the communication format of the slave (19200,8,N,2) to make it consistent with the AP host, and set the station number of the salve as 2.

M8002 MOV H89 D8120 Set communication format: 19200, 8, N, 2

MOV K10 D8129 Set time for response timeout 100ms M10 COIW K2 H100 M0 K0 Set instruction COIW M8123 Slave ID: 2 Communication Bit element address of slave: H100 finishing processing M8124 Value sent by main body: M0 Communication Port selection: 485 port on the main error processing body

6-181 Chapter 6 Interpretation of Application Instructions Convenient communication

F91 MCIR coil reading F MCIR Coil read S1· S2· m· D K 91

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * m· * * * * D * * * K * * Note:AP300 series supports data register W. Mnemonic · · · MCIR S1 S2 m D K S1· :Communication station number(0~255). S2· :The specified start address of the remote coil element. m· :Length of coil to be read(1~2000). D :Coil received by the local machine K :Serial port selection, constant 0~1. 0:RS485 communication port; 1:RS485 or RS232 expansion card communication port 1; 2:RS485 or RS232 expansion card communication port 2. (Only K of AP360 series can be 0, 1 or 2, which is 0 or 1 for other AP series.) Functional code:01H. Function The instruction uses RS232/RS485 expansion card communication port 1/2 or the built-in RS485 communication port to achieve the purpose of reading multiple coils to other devices.

●Data sending format of RS485 communication port can be set by the special register D8120. During the execution of the instruction MCIR, even if the settings of D8120 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● When using the instruction, the station number of the host and slave can't be repeated. ● Data sending format of communication port 1/2 of RS485 or RS232 expansion card can be set by the special register D8320(for the expansion card communication port 1)/D8300(for the expansion card communication port 2).. During the execution of the instruction MCIR, even if the settings of D8320/ D8300 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● Under the environment which doesn't require reading coil, please set the number of coil to be

6-182 Chapter 6 Interpretation of Application Instructions Convenient communication read as 0. ● The same program can apply a lot of communication instructions upon demands, such as MCIR. COIW, MCIW, MRGR, REGW, MRGW, and etc. After the communication of the current instruction, the current port will be released automatically, and the next instruction will be executed. After the condition of enabling the instruction is ON, the communication will be sent. If you need to send the communication again, it shall turn OFF the said condition for a scan cycle, and turn it ON again.

Communication specification, special relay and data register used: (The same as instruction F90)

For example: Read the status of M100~M110 on the slave from the AP host, and set the station number of the AP host as 1. Change the communication format of the slave (19200,8,N,2) to make it consistent with the AP host, and set the station number of the salve as 2.

M8002 MOV H89 D8120 Set communication format: 19200, 8, N, 2

MOV K10 D8129 Set time for response timeout 100ms M10 MCIR K2 H264 K11 S0 K0 M8123 Set instruction MCIR Communication Slave ID: 2 finishing processing Bit element address of slave: H264 M8124 Communication Length of read coil: 11 error processing Start value received by main body: S0 Port selection: 485 port on the main body

6-183 Chapter 6 Interpretation of Application Instructions Convenient communication

F92 MCIW multi-coil write in F MCIW Multi-coil write S1· S2· m· D· K 92

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * m· * * * * D· * * * * K * * Note:AP300 series supports data register W. Mnemonic · · · · MCIW S1 S2 m D K S1· :Communication station number. S2· :The start address of sending the remote coil element. m· :Length of coil to be written(1~1968). D· :Send the coil from the local machine. K :Serial port selection, constant 0~1. 0:RS485 communication port; 1:RS485 or RS232 expansion card communication port 1; 2:RS485 or RS232 expansion card communication port 2. (Only K of AP360 series can be 0, 1 or 2, which is 0 or 1 for other AP series.) Functional code:0FH. Function The instruction uses RS232/RS485 expansion card communication port 1/2 or the built-in RS485 communication port to achieve the purpose of writing multi-coil to other devices.

●Data sending format of RS485 communication port can be set by the special register D8120. During the execution of the instruction MCIW, even if the settings of D8120 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● When using the instruction, the station number of the host and slave can't be repeated. ● Data sending format of communication port 1/2 of RS485 or RS232 expansion card can be set by the special register D8320(for the expansion card communication port 1)/D8300(for the expansion card communication port 2).. During the execution of the instruction MCIW, even if the settings of D8320/D8300 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● Under the environment which doesn't require writing coil, please set the number of coil to be

6-184 Chapter 6 Interpretation of Application Instructions Convenient communication written as 0. ● The same program can apply a lot of communication instructions upon demands, such as MCIR. COIW, MCIW, MRGR, REGW, MRGW, and etc. After the communication of the current instruction, the current port will be released automatically, and the next instruction will be executed. After the condition of enabling the instruction is ON, the communication will be sent. If you need to send the communication again, it shall turn OFF the said condition for a scan cycle, and turn it ON again.

Communication specification, special relay and data register used: (The same as instruction F90)

For example: Read the status of Y0~Y15 on the slave from the AP host, and set the station number of the AP host as 1. Change the communication format of the slave (19200,8,N,2) to make it consistent with the AP host, and set the station number of the salve as 2.

M8002 MOV H89 D8120 Set communication format: 19200, 8, N, 2

MOV K10 D8129 Set time for response timeout 100ms M10 MCIW K2 H100 K14 S0 K0 M8123 Set instruction MCIW Communication Slave ID: 2 finishing processing Bit element address of slave: H100 M8124 Communication Length of read coil: 14 error processing Start value sent by main body: S0 Port selection: 485 port on the main body

6-185 Chapter 6 Interpretation of Application Instructions Convenient communication

F93 REGW single register write in F REGW Single register write S1· S2· D· K 93

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * D· * * * * * * * * * * K * * Note:AP300 series supports data register W. Mnemonic · · · REGW S1 S2 D K S1· :Communication station number. S2· :The start address of the specified register. D· :The 16-bit value sent locally. K :Serial port selection, constant 0~1. 0:RS485 communication port; 1:RS485 or RS232 expansion card communication port 1; 2:RS485 or RS232 expansion card communication port 2. (Only K of AP360 series can be 0, 1 or 2, which is 0 or 1 for other AP series.) Functional code:06H. Function The instruction uses RS232/RS485 expansion card communication port 1/2 or the built-in RS485 communication port to achieve the purpose of writing single register to other devices.

●Data sending format of RS485 communication port can be set by the special register D8120. During the execution of the instruction REGW, even if the settings of D8120 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● When using the instruction, the station number of the host and slave can't be repeated. ● Data sending format of communication port 1/2 of RS485 or RS232 expansion card can be set by the special register D8320(for the expansion card communication port 1)/D8300(for the expansion card communication port 2).. During the execution of the instruction REGW, even if the settings of D8320/D8300 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● The same program can apply a lot of communication instructions upon demands, such as MCIR. COIW, MCIW, MRGR, REGW, MRGW, and etc. After the communication of the current instruction, the current port will be released automatically, and the next instruction will be

6-186 Chapter 6 Interpretation of Application Instructions Convenient communication executed. After the condition of enabling the instruction is ON, the communication will be sent. If you need to send the communication again, it shall turn OFF the said condition for a scan cycle, and turn it ON again. Communication specification, special relay and data register used: (The same as instruction F90)

6-187 Chapter 6 Interpretation of Application Instructions Convenient communication

F94 MRGR register read F MRGR Register read S1· S2· m· D K 94

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * m· * * * * D * * * * * * * K * * Note:AP300 series supports data register W. Mnemonic · · · MRGR S1 S2 m D K S1· :Communication station number. S2· :The start address of the specified register. m· :Length of register to be read(1~125). D :Register received by the local machine K :Serial port selection, constant 0~1. 0:RS485 communication port; 1:RS485 or RS232 expansion card communication port 1; 2:RS485 or RS232 expansion card communication port 2. (Only K of AP360 series can be 0, 1 or 2, which is 0 or 1 for other AP series.) Functional code:03H. Function The instruction uses RS232/RS485 expansion card communication port 1/2 or the built-in RS485 communication port to achieve the purpose of reading multiple registers to other devices. ●Data sending format of RS485 communication port can be set by the special register D8120. During the execution of the instruction MRGR, even if the settings of D8120 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● When using the instruction, the station number of the host and slave can't be repeated. ● Data sending format of communication port 1/2 of RS485 or RS232 expansion card can be set by the special register D8320(for the expansion card communication port 1)/D8300(for the expansion card communication port 2).. During the execution of the instruction MRGR, even if the settings of D8320/D8300 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● Under the environment which doesn't require reading register please set the number of register to be read as 0. ● The same program can apply a lot of communication instructions upon demands, such as MCIR.

6-188 Chapter 6 Interpretation of Application Instructions Convenient communication

COIW, MCIW, MRGR, REGW, MRGW, and etc. After the communication of the current instruction, the current port will be released automatically, and the next instruction will be executed. After the condition of enabling the instruction is ON, the communication will be sent. If you need to send the communication again, it shall turn OFF the said condition for a scan cycle, and turn it ON again. Communication specification, special relay and data register used: (The same as instruction F90)

6-189 Chapter 6 Interpretation of Application Instructions Convenient communication

F95 MRGW multi-register write F MRGW Multi-register write S1· S2· m· D· K 95

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * m· * * * * D· * * * * * * * * K * * Note:AP300 series supports data register W. Mnemonic · · · · MRGW S1 S2 m D K S1· :Communication station number. S2· :The start address of the element sending the remote register. m· :Length of register to be written(1~123). D· :Send the register from the local machine. K :Serial port selection, constant 0~1. 0:RS485 communication port; 1:RS485 or RS232 expansion card communication port 1; 2:RS485 or RS232 expansion card communication port 2. (Only K of AP360 series can be 0, 1 or 2, which is 0 or 1 for other AP series.) Functional code:10H. Function The instruction uses RS232/RS485 expansion card communication port 1/2 or the built-in RS485 communication port to achieve the purpose of writing multi-register to other devices. ●Data sending format of RS485 communication port can be set by the special register D8120. During the execution of the instruction MRGW, even if the settings of D8120 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● When using the instruction, the station number of the host and slave can't be repeated. ● Data sending format of communication port 1/2 of RS485 or RS232 expansion card can be set by the special register D8320(for the expansion card communication port 1)/D8300(for the expansion card communication port 2).. During the execution of the instruction MRGW, even if the settings of D8320/D8300 are changed, it won't take effect. Only after the instruction is enabled for a second time, will it take effect. ● Under the environment which doesn't require writing register please set the number of register to be written as 0. ● The same program can apply a lot of communication instructions upon demands, such as MCIR.

6-190 Chapter 6 Interpretation of Application Instructions Convenient communication

COIW, MCIW, MRGR, REGW, MRGW, and etc. After the communication of the current instruction, the current port will be released automatically, and the next instruction will be executed. After the condition of enabling the instruction is ON, the communication will be sent. If you need to send the communication again, it shall turn OFF the said condition for a scan cycle, and turn it ON again. Communication specification, special relay and data register used: (The same as instruction F90)

6-191 Chapter 6 Interpretation of Application Instructions FLASH read/write

12 F100~F101 FLASH Read/Write

FLASH read/write Function No. Mnemonic Name Page F100 STORE FLASH store 6-193 F101 LOAD FLASH data read 6-195

6-192 Chapter 6 Interpretation of Application Instructions FLASH read/write

F100 STORE FLASH store F STORE FLASH storage S· D n 100 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z F S· * * * * * * D * n * * * * Note 1:AP300 series supports data register W. Note 2:The instruction can only use the instruction P. Instruction Format

STORE P S· D n

S· :Data to be stored in FLASH. D :Register F for storage(Only the register F can be used). n :number of data to be stored, n=1~2000. Function The instruction stores the data in the specific zone of FLASH, so that the user may store the commonly used data conveniently. For example: X000 STORE P D100 F200 K3

After X0 is turned ON, the values of D100, D101 D100 F200 D101 F201 and D102 will be stored in special registers F200, F201 D102 F202 and F202 of FLASH respectively. Note:1. The instruction can only use the instruction P, so as to prevent too many times of writing/erasing on FLASH (The maximum writing/erasing times of FLASH: 20000). 2. When the instruction STORE writes FLASH, the scan cycle will be longer, which will also affect the normal operation of other instructions, such as : FUN53(DHSCS)、FUN54 (DHSCR)、FUN55(DHSZ)、FUN56(SPD)、FUN57(PLSY)、FUN58(PWM)、 FUN200(PPMI)、FUN201(PPMA)、FUN204(PTPO)、FUN205(CLLM)、FUN206 (VSPO)、FUN207(ICF)、FUN208(CSFO)、FUN209(SLCH)、FUN210(LINI)、 FUN211(LINA)、FUN212(CIMI)、FUN213(CIMA), all these instructions will be affected. 3. For AP100 and AP200, there are two FLASH zones. The first is F0~F999, while the second is F1000~F1999. Thus, when crossing the zones for writing/erasing, the two FLASH zones will be written/erased, which greatly increases the scan cycle than writing a zone. For AP 300,

6-193 Chapter 6 Interpretation of Application Instructions FLASH read/write each 15 values are divided into a zone, namely, F0~F14;F15~F29;F30~F44… 4. The special register F can't monitor with AP-PCLINK, which must be read by using instruction F101 LOAD. 5. When it fails to write, M8067 is set ON, D8067=6709.

6-194 Chapter 6 Interpretation of Application Instructions FLASH read/write

F101 LOAD FLASH data read F LOAD FLASH data read S D· n 101 P

Bit element Word element

X Y M S K H KnXKnY KnM KnS T C D W V Z F S * D· * * * * n * * * * Note:AP300 series supports data register W. Instruction Format

LOAD S D· n

S :Register F to be read(Only the register F can be used). D· :The address storing the reading result. n :Number of data to be read, n=1~2000. Function The instruction may read the values stored in the special register F. For example: X000 LOAD F90 D260 K3

After X0 is set ON, the values of F90, F91 and F92 in FLASH are stored in D260, D261 and D262 respectively.

F90 D260 F91 D261 F92 D262

Note:Special registers F can't monitor with AP-PCLINK.

6-195 Chapter 6 Interpretation of Application Instructions Floating point operation

13 F110~F137 Floating Point Operation

Floating point operation Function No. Mnemonic Name Page F110 ECMP Binary float compare 6-197 F111 EZCP Binary float zone compare 6-198 F112 EMOV Movement of binary floating-point number 6-199 F118 EBCD Binary floating-point numbers→Decimal floating points 6-200 F119 EBIN Binary floating-point numbers→Decimal floating points 6-202 F120 EADD Addition of binary floating-point numbers 6-203 F121 ESUB Subtraction of binary floating-point numbers 6-204 F122 EMUL Multiplication of binary floating-point numbers 6-205 F123 EDIV Division of binary floating-point numbers 6-206 F124 EXP Exponent arithmetic computation of binary floating-point 6-207 numbers F125 LOGE Natural logarithm computation of binary floating-point numbers 6-208 F126 LOG10 Common logarithm computation of binary floating-point 6-209 numbers F127 ESQR Square root of binary floating-point numbers 6-210 F128 ENEG NEG computation of binary floating-point numbers 6-211 F129 INT Binary floating-point numbers→BIN integer 6-212 F130 SIN Floating-point sine computation 6-213 F131 COS Floating-point cosine computation 6-214 F132 TAN Floating-point tangent computation 6-215 F133 ASIN Floating-point arc sine computation 6-216 F134 ACOS Floating-point arc cosine computation 6-217 F135 ATAN Floating-point arc tangent computation 6-218 F136 RAD Degree - RAD 6-219 F137 DEG RAD - Degree 6-220

6-196 Chapter 6 Interpretation of Application Instructions Floating point operation

F110 ECMP binary float compare F ECMP Binary float compare S1· S2· D· 110 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S1· * * * * * S2· * * * * * D· * * * Note:AP300 series supports data register W. Instruction Format DECMP S1· S2· D·

S1· :Comparison value 1 of binary floating-point number. S2· :Comparison value 2 of binary floating-point number. D· :Comparison results, occupying 3 continuous points Function It is to compare the binary floating-point numbers within two data sources, and output 3 points of ON/OFF status from D. according to the comparison results. For example: X000 DECMP D30 D40 M0 D31,D30>D41,D40 M0=ON,M1=OFF,M2=OFF D31,D30=D41,D40 M0=OFF,M1=ON,M2=OFF D31,D30<D41,D40 = , = , = M0 OFF M1 OFF M2 ON When X000 is OFF, even the instruction ECMP is not executed, M0-M2 keeps the state before X000 is OFF. When the constants K and H are specified as source data, they are converted into binary floating-point number automatically for processing.

6-197 Chapter 6 Interpretation of Application Instructions Floating point operation

F111 EZCP binary float zone compare F EZCP Binary float zone compare S1· S2· S· D· 111 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S1· * * * * * S2· * * * * * S· * * * * * D· * * * Note:AP300 series supports data register W. Instruction Format DEZCP S1· S2· S· D·

S1· :Lower limit value of binary floating-point number for zone comparison. S2· :Upper limit value of binary floating-point number for zone comparison. S· :Comparison value of binary floating-point number. D· :Comparison results, occupying 3 continuous points Note:When setting, S1•≤S2•; when S1•>S2•, value of S2• shall be taken as the same value of S1• for comparison. Function It is to compare the range of the content of (S1·,S1·+1)with the range of +/- 2 points specified by the binary floating-point value , and output 3 points of ON/OFF status from D. For example: X000 DEZCP D30 D40 D50 M0 D31,D30>D51,D50 M0=ON,M1=OFF,M2=OFF D31,D30≤D51,D50≤D41,D40 M1=ON,M0=OFF,M2=OFF D51,D50>D41,D40 = , = , = M2 ON M0 OFF M1 OFF When X000 is OFF, even the instruction EZCP is not executed, M0-M2 keeps the state before X000 is OFF. When the constants K and H are specified as source data, they are converted into binary floating-point number automatically for processing.

6-198 Chapter 6 Interpretation of Application Instructions Floating point operation

F112 EMOV Movement of binary floating-point number F Movement of binary EMOV S· D· 112 D P floating-point number

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Instruction Format DEMOV S· D·

S· :Binary floating point data of transfer source or device number storing data D· :Device number storing floating point data Function Content (binary floating-point number) of the transfer source (S•+1, S•) is transferred to (D•+1, D•). For example: X000 DEMOV D10 D0

(D11,D10)→(D1,D0) In addition, a real number (E) can be also directly specified in S•.

X000 DEMOV E-1.23 D0

The above program is to transfer E﹣1.23→(D1,D0).

6-199 Chapter 6 Interpretation of Application Instructions Floating point operation

F118 EBCD Binary floating-point numbers→Decimal floating points F Binary floating-point EBCD numbers→Decimal floating S· D· 118 D P points

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * D· * * Note:AP300 series supports data register W. Instruction Format DEBCD S· D·

S· :Data source (binary floating-point number). D· :Conversion results (decimal floating-point number). Function Convert binary floating-point number in the element specified by the source data into decimal floating-point number and store it in the destination address. For example: X000 DEBCD D50 D40

Binary floating-point D51 D50 Mantissa section 23-bit, the index number section 8-bit and the symbol 1-bit

Index Mantissa Decimal D41 D40 floating-point number

Mantissa section Index section D40 × 10D41

Decimal floating-point value=「Mantissa D40」×10[Index D41]

Processing range(represented by decimal system) of binary floating-point is stated below: The minimum absolute value The maximum absolute value 1175494×10-44 3402823×1032

6-200 Chapter 6 Interpretation of Application Instructions Floating point operation

The decimal computation is executed based on the binary floating-point value in the PLC. However, for the binary floating-point number, it is hard to judge other values, so it shall be converted into decimal floating-point number by the instruction. It is easy for the peripheral equipment to monitor.

6-201 Chapter 6 Interpretation of Application Instructions Floating point operation

F119 EBIN Binary floating-point numbers→Decimal floating points F Decimal floating-point EBIN numbers→Binary floating S· D· 119 D P points

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * D· * * Note:AP300 series supports data register W. Instruction Format

DEBIN S· D·

S· :Data source (decimal floating-point number). D· :Conversion results (binary floating-point number). Function Convert decimal floating-point number in the element specified by the source data into binary floating-point number and store it in the destination address. For example: X000 DEBIN D50 D40

Convert decimal floating-point number in the element D50 specified by the source data into binary floating-point number and store it in D41, D40. Index Mantissa Decimal floating-point D51 D50 number

Binary floating-point D41 D40 Mantissa section 23-bit, the index number section 8-bit and the symbol 1-bit

Mantissa section Index section D50 × 10D51 Decimal floating-point value=「Mantissa D50」×10[Index D51] Mantissa D50=±(1,000~9,999) or 0 Index D51=﹣41~﹢35 The range of absolute range for the binary floating-point number is: 1175494×10-44~3402823×1032. If the converted decimal floating-point value is beyond this range, it will lead to error.

6-202 Chapter 6 Interpretation of Application Instructions Floating point operation

F120 EADD Addition of binary floating-point numbers F Addition of binary EADD S1· S2· D· 120 D P floating-point numbers

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S1· * * * * * S2· * * * * * D· * * Note:AP300 series supports data register W. Instruction Format DEADD S1· S2· D·

S1· :Augend. S2· :Addend. D· :Sum. Function The sum of number on the register specified by S1• plus number on the register specified by S2•, is stored in the register specified by D•. The addition computation is executed with binary floating-point number.

● If the number specified by S1• or S2• is constant, the instruction will convert the constant into binary floating-point number for addition computation. ● S1• and S2• can specify the same register number. If the continuous execution instruction is applied, the numbers will be plus in each computation cycle. Thus, under general conditions, the pulse execution instruction DEADD P is applied. ● When the computation result is 0, the zero flag M8020=ON. There is no borrow/carry flag in the instruction.

For example: X000 DEADDP D50 D40 D10

(D51,D50)+(D41,D40)→(D11,D10)

When X000 is ON, the binary floating-point numbers (D51, D50) plus binary floating-point numbers (D41, D40), the sum is stored in (D11, D10).

6-203 Chapter 6 Interpretation of Application Instructions Floating point operation

F121 ESUB subtraction of binary floating-point numbers F Subtraction of binary ESUB S1· S2· D· 121 D P floating-point numbers

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S1· * * * * * S2· * * * * * D· * * Note:AP300 series supports data register W. Instruction Format DESUB S1· S2· D·

S1· :Minuend. S2· :Subtrahend D· :Difference. Function The difference of number on the register specified by S1• minus number on the register specified by S2•, is stored in the register specified by D•. The subtraction computation is executed with binary floating-point number. ● If the number specified by S1• or S2• is constant, the instruction will convert the constant into binary floating-point number for subtraction computation. ● S1• and S2• can specify the same register number. If the continuous execution instruction is applied, the numbers will be minus in each computation cycle. Thus, under general conditions, the pulse execution instruction DESUB P is applied. ● When the computation result is 0, the zero flag M8020=ON. There is no borrow/carry flag in the instruction.

For example: X000 DESUBP D50 D40 D10

(D51,D50)—(D41,D40)→(D11,D10)

When X000 is ON, the binary floating-point numbers (D51, D50) minus binary floating-point numbers (D41, D40), the difference is stored in (D11, D10).

F122 EMUL multiplication of binary floating-point numbers

6-204 Chapter 6 Interpretation of Application Instructions Floating point operation

F Multiplication of binary EMUL S1· S2· D· 122 D P floating-point numbers

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S1· * * * * * S2· * * * * * D· * * Note:AP300 series supports data register W. Instruction Format DEMUL S1· S2· D·

S1· :Multiplicand. S2· :Multiplicator. D· :Product. Function The product of number on the register specified by S1• multiple number on the register specified by S2•, is stored in the register specified by D•. The multiplication computation is executed with binary floating-point number. ● If the number specified by S1• or S2• is constant, the instruction will convert the constant into binary floating-point number for multiplication computation. ● S1• and S2• can specify the same register number. If the continuous execution instruction is applied, the numbers will be multiple in each computation cycle. Thus, under general conditions, the pulse execution instruction DEMUL P is applied.

For example: X000 DEMULP D50 D40 D10

(D51,D50)×(D41,D40)→(D11,D10)

When X000 is ON, the binary floating-point numbers (D51, D50) multiple binary floating-point numbers (D41, D40), the product is stored in (D11, D10).

6-205 Chapter 6 Interpretation of Application Instructions Floating point operation

F123 EDIV Division of binary floating-point numbers F Division of binary EDIV S1· S2· D· 123 D P floating-point numbers

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S1· * * * * * S2· * * * * * D· * * Note:AP300 series supports data register W. Instruction Format DEDIV S1· S2· D·

S1· :Dividend. S2· :Divisor (the number can not be 0, otherwise, it may be regarded as error computation, and the instruction will not be executed). D· :Quotient. Function The quotient of number on the register specified by S1• divided by the number on the register specified by S2•, is stored in the register specified by D•. The division computation is executed with binary floating-point number. ● If the number specified by S1• or S2• is constant, the instruction will convert the constant into binary floating-point number for division computation. ● S1• and S2• can specify the same register number. If the continuous execution instruction is applied, the numbers will be divided in each computation cycle. Thus, under general conditions, the pulse execution instruction DEDIV P is applied.

For example: X000 DEDIVP D50 D40 D10

(D51,D50)÷(D41,D40)→(D11,D10)

When X000 is ON, the binary floating-point numbers (D51, D50) divided by binary floating-point numbers (D41, D40), the quotient is stored in (D11, D10).

6-206 Chapter 6 Interpretation of Application Instructions Floating point operation

F124 EXP exponent arithmetic computation of binary floating-point numbers F Exponent arithmetic EXP computation of binary S· D· 124 D P floating-point numbers

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Instruction Format DEXP S· D·

S· :exponent. D· :power. Function It makes operation by taking e(2.71828)as the base, and (S·+1,S·)as the exponent, and then stores the result in (D·+1,D·). In addition, a real number can be also directly specified in S•. e(S·+1, S) → (D·+1, D·) Error condition: When the operation result is beyond the following range, it will lead to operation error, and the error flag bit (M8067) is ON. The error code(K6706) is stored in D8067. 2-126≤|Operation result|<2128 For example: X000 DEXP D10 D20

e(D11, D10)→(D21, D20) Exponent Power Key points: 1)ln2128=88.7,ln2-126=-87.3, so it will lead to operation error if 89 or larger number is set by (D11,D10). 2) Conversion from natural logarithm into common logarithm In the CPU, operations are executed in natural logarithm. When a value in common logarithm is required, specify a common logarithm value divided by 0.4342945 in (S•+1, S•). x x 10  e 0.4342945

6-207 Chapter 6 Interpretation of Application Instructions Floating point operation

F125 LOGE natural logarithm computation of binary floating-point numbers F Natural logarithm computation LOGE of binary floating-point S· D· 125 D P numbers

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Instruction Format DLOGE S· D·

S· :Power. D· :Exponent. Function Natural logarithm [logarithm whose base is “e (2.71828)”] of (S•+1, S•) is calculated, and the operation result is stored to (D•+1, D•). In addition, a real number can be also directly specified in S•. Only a positive value can be set in (S•+1, S•). (The natural logarithm operation cannot be executed for a negative value.)

Loge (S 1, S)  (D 1, D)

Error condition: When a negative value or 0 is specified in S•, it will lead to operation error, and the error flag bit (M8067) is ON. The error code(K6706) is stored in D8067.

For example: X000 DLOGE D10 D20

Loge (D11, D10)  (D21, D20)

6-208 Chapter 6 Interpretation of Application Instructions Floating point operation

F126 LOG10 common logarithm computation of binary floating-point numbers F Common logarithm LOG10 computation of binary S· D· 126 D P floating-point numbers

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Instruction Format DLOG10 S· D·

S· :Power. D· :Exponent. Function Natural logarithm [logarithm whose base is 10] of (S•+1, S•) is calculated, and the operation result is stored to (D•+1, D•). In addition, a real number can be also directly specified in S•. Only a positive value can be set in (S•+1, S•). (The natural logarithm operation cannot be executed for a negative value.)

Log10 (S 1, S)  (D 1, D)

Error condition: When a negative value or 0 is specified in S•, it will lead to operation error, and the error flag bit (M8067) is ON. The error code(K6706) is stored in D8067.

For example: X000 DLOG10 D10 D20

Log10 (D11, D10)  (D21, D20)

6-209 Chapter 6 Interpretation of Application Instructions Floating point operation

F127 ESQR square root of binary floating-point numbers F Square root of binary ESQR S· D· 127 D P floating-point numbers

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * * * D· * * Note:AP300 series supports data register W. Instruction Format DESQR S· D·

S· :Source element to be executed with square root(It is only valid for positive numbers. For the negative numbers, it is regarded as computation error, and M8067is ON). D· :Square root. Function Square root is executed for numbers on the register specified by S•, and the square root is stored in the register specified by D•. The square root computation is executed with binary floating-point numbers. If the number specified by S• is constant, the instruction will convert the constant into binary floating-point number for square root computation. For example: X000 DESQR D50 D40

(D51, D50)  (D41, D40)

When X000=ON, the binary floating-point numbers (D51, D50)are conducted with square root, and the square root is stored in (D41, D40).

6-210 Chapter 6 Interpretation of Application Instructions Floating point operation

F128 ENEG NEG computation of binary floating-point numbers F NEG computation of binary ENEG D· 128 D P floating-point numbers

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E D· * * Note:AP300 series supports data register W. Instruction Format DENEG D·

D· :Start device number of the element storing binary floating data to be executed with NEG computation. Function The sign of binary floating-point data stored in (D•+1, D•) is inverted, and the result is stored to (D•+1, D•). For example: M0 DENEGP D10

(D11, (D11,D10) → D10) 1.2345 → ﹣1.2345

6-211 Chapter 6 Interpretation of Application Instructions Floating point operation

F129 INT binary floating-point numbers→BIN integer F Binary floating-point INT S· D· 129 D P numbers→BIN integer

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * D· * * Note:AP300 series supports data register W. Instruction Format INT S· D·

S· :Source to be converted. D· :Conversion result. Function The register content specified by S• is converted into BIN integral with the form of binary floating-point number, which is then temporarily stored in the register specified by D•, with the decimal of BIN integer ignored. Action of the instruction is opposite with the instruction F49 FLT. When the conversion result is 0, the zero flag M8020=ON. If the decimal point is ignored in the conversion result, the borrowing symbol M8021=ON. If the conversion result is beyond the following range, the carrying symbol M8022=ON. 16-bit instruction:﹣32,768~32,767 32-bit instruction:﹣2,147,483,648~2,147,483,647

For example: X000 INT D0 D10 X001 DINT D20 D30

When X000=ON, the binary decimals(D1, D0)are converted into BIN integer, the result is stored in D10, with the decimal of the BIN integer ignored. When X001=ON, the binary decimals(D21, D20)are converted into BIN integer, the result is stored in (D31, D30), with the decimal of the BIN integer ignored.

6-212 Chapter 6 Interpretation of Application Instructions Floating point operation

F130 SIN floating-point sine computation F SIN Floating-point sine computation S· D· 130 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Mnemonic DSIN S· D·

S· :Specified RAD value. D· :Computation result of SINE. Function RAD value specified by S• is equal to (angle×π/180), and SIN value is obtained and stored in register specified by D•. The result range: ﹣1≤D·≤1

For example: X000 DSIN D10 D20

(D11,D10) RAD value of binary floating-point number

(D21,D20) SIN value as binary floating-point number

6-213 Chapter 6 Interpretation of Application Instructions Floating point operation

F131 COS floating-point cosine computation F Floating-point cosine COS S· D· 131 D P computation

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Instruction Format DCOS S· D·

S· :Specified RAD value. D· :Computation result of COSINE. Function RAD value specified by S• is equal to (angle×π/180), and COS value is obtained and stored in register specified by D•. The result range: ﹣1≤D·≤1

For example: X000 DCOS D10 D20

(D11,D10) RAD value of binary floating-point number

(D21,D20) COS value as binary floating-point number

6-214 Chapter 6 Interpretation of Application Instructions Floating point operation

F132 TAN Floating-point tangent computation F Floating-point tangent TAN S· D· 132 D P computation

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Instruction Format DTAN S· D·

S· :Specified RAD value. D· :Computation result of ANBENT. Function RAD value specified by S• is equal to (angle×π/180), and TAN value is obtained and stored in register specified by D•.

For example: X000 DTAN D10 D20

(D11,D10) RAD value of binary floating-point number

(D21,D20) TAN value as binary floating-point number

6-215 Chapter 6 Interpretation of Application Instructions Floating point operation

F133 ASIN floating-point arc sine computation F Floating-point arc sine ASIN S· D· 133 D P computation

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Mnemonic DASIN S· D·

S· :Specify data source of ASIN. D· :Computation result of ARCSINE. Function Content ARC SIN (inverse function of SIN) specified by S. is stored in D. as binary floating-point number. Range of input data ﹣1≤S·≤1 source: ﹣π/2≤D·≤π/2 Result range:

For example: X000 DASIN D10 D20

(D11,D10) RAD value of binary floating-point number

(D21,D20) ASIN value as binary floating-point number

6-216 Chapter 6 Interpretation of Application Instructions Floating point operation

F134 ACOS floating-point arc cosine computation F Floating-point arc cosine ACOS S· D· 134 D P computation

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Mnemonic DACOS S· D·

S· :Specify ACOS data source. D· :Computation result of ARCCOSINE. Function Content ARC COS (inverse function of COS) specified by S. is stored in D. as binary floating-point number. Range of input data ﹣1≤S·≤1 source: 0≤D·≤π Result range:

For example: X000 DACOS D10 D20

(D11,D10) RAD value of binary floating-point number

(D21,D20) ACOS value as binary floating-point number

6-217 Chapter 6 Interpretation of Application Instructions Floating point operation

F135 ATAN Floating-point arc tangent computation F Floating-point arc tangent ATAN S· D· 135 D P computation

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Mnemonic DATAN S· D·

S· :Specify ATAN data source. D· :Computation result of ARCTANGEBT. Function Content ARC TAN (inverse function of TAN) specified by S. is stored in D. as binary floating-point number. Result range: ﹣π/2<D·<π/2

For example: X000 DATAN D10 D20

(D11,D10) RAD value of binary floating-point number

(D21,D20) ATAN value as binary floating-point number

6-218 Chapter 6 Interpretation of Application Instructions Floating point operation

F136 RAD degree - RAD F RAD Degree - RAD S· D· 136 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Mnemonic DRAD S· D·

S· :Data source. D· :Computation result. S. and D. are in the form of binary floating-point. Function The instruction realizes conversion from degree into radian.

For example: X000 DRAD D10 D20

6-219 Chapter 6 Interpretation of Application Instructions Floating point operation

F137 DEG RAD - Degree F DEG RAD - Degree S· D· 137 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z E S· * * * D· * * Note:AP300 series supports data register W. Instruction Format DDEG S· D·

S· :Data source. D· :Computation result. S. and D. are in the form of binary floating-point. Function The instruction realizes conversion from radian into degree

For example: X000 DDEG D10 D20

6-220 Chapter 6 Interpretation of Application Instructions Float to scientific

14 F147 Float to Scientific

Instruction of float to scientific Function No. Mnemonic Name Page F147 SWAP Float to scientific 6-222

6-221 Chapter 6 Interpretation of Application Instructions Float to scientific

F147 SWAP float to scientific F SWAP Float to scientific S· 147 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format SWAP S·

S· :The unit to be executed with upper and lower 8-bit exchange. Function The instruction is to exchange the high and low bits of the data. For example: X000 SWAPP D10

For 16-bit instruction, the high 8-bit is exchanged with the high 8-bit.

D10 High 8-bit Low 8-bit

X000 DSWAPP D10

For 32-bit instruction, each high 8-bit is exchanged with the high 8-bit.

D11 D10 High 8-bit Low 8-bit High 8-bit Low 8-bit

Note:When the instruction is executed as continuous execution type, the exchange will be performed in each computation cycle. The instruction has the same function as the expansion function of F17 XCH.

6-222 Chapter 6 Interpretation of Application Instructions Locating

15 F156~F159 Locating Instruction

Locating Function No. Mnemonic Name Page F156 ZRN Origin return 6-224 F157 PLSV Pulse V 6-227 F158 DRVI Drive to increment 6-229 F159 DRVA Drive to absolute 6-233

6-223 Chapter 6 Interpretation of Application Instructions Locating

F156 ZRN origin return F ZRN Zero return S1· S2· S3· D· 156 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * S3· * * * * D· * Note:AP300 series supports data register W. Instruction Format ZRN S1· S2· S3· D·

S1· :Speed of origin return. S2· :Crawling speed. S3· :DOG signal. D· :Number of pulse output object. Function It is used to write the data of the origin location of the mechanic action in advance, to execute origin return. When executing relative location control of F158 DRVI and absolute location control of F159 DRVA, PLC increases or decreases the current value with its self-generated positive/negative pulse, which is stored in current value register(Y000:[D8141,D8140],Y001:[D8143, D8142],Y002:[D8191,D8190],Y003:[D8201,D8200]). In this way, the mechanical location is always kept. On case of power failure of the PLC, the location will disappear. For power on and initial operation, origin return must be executed and data of origin location of mechanical action shall be written in advance.

《Specifying content of the operand》 1) S1· :Speed of origin return Specify speed when origin return starts [16-bit instruction]:1~32,767(Hz) [32-bit instruction]:1~200,000(Hz) The min frequency of channel Y2 and Y3 of AP300 shall not be lower than 12Hz. 2) S2· :Crawling speed. Specify the low speed after DOG signal is ON 1~32,767(Hz) The min frequency of channel Y2 and Y3 of AP300 shall not be lower than 12Hz.

6-224 Chapter 6 Interpretation of Application Instructions Locating

3) S3· :DOG signal. Specify DOG signal input When specifying element out of the input relay (X), due to the computation cycle of the PLC, it may lead to greater deflection of the origin location. 4) D· :Number of pulse output object. AP100 and AP200 can only specify Y000 or Y001, while AP300 can specify Y000~Y003. The controller output must be transistor output.

《Output function of reset signal》 When the output flag of reset signal M8140 is ON and origin return finishes, it outputs reset signal to the servo motor. Output number of the reset signal is determined by pulse output numbers. AP100、AP200: Pulse output[Y000]→Clear output[Y002] , output flag of reset signal M8140 Pulse output[Y001]→Clear output[Y003] , output flag of reset signal M8140 AP300: Pulse output[Y000]→Clear output[Y004] , output flag of reset signal M8140 Pulse output[Y001]→Clear output[Y005] , output flag of reset signal M8141 Pulse output[Y002]→Clear output[Y006] , output flag of reset signal M8150 Pulse output[Y003]→Clear output[Y007] , output flag of reset signal M8151 Initial position Pulse Origin return speedS1· Crawling speedS2· output Interruption DOG processing

Reset signal Reset signal

Within 1ms About 20ms+1 scan cycle M8029 ON Mark of executing pulse OFF output

《Action of origin return》 Origin return shall be executed according to the following sequence. ① After the drive instruction, it moves at the speed of origin return speed S1•. During the origin return, if the instruction driving contact is OFF, it will not decelerate but immediately stop. After the instruction driving contact is OFF, it will receive another drive of the instruction. ② When DOG signal becomes ON from OFF, it is decelerated to the crawling speed S2•.

6-225 Chapter 6 Interpretation of Application Instructions Locating

③ When DOG signal becomes OFF from ON, and the pulse output is stops, it writes 0 into the current value register. In addition, when output flag of reset signal M8140 is ON, the reset signal is output to servo driver simultaneously. After that, when the finishing flag sign (M8029) acts, the pulse output monitors become OFF.

《Address numbers of the related devices》 1. Description of flag signals ● M8029:Flag of finishing execution of pulse output. ● M8140:For AP100, AP200:Y0, Y1 output flag of reset signal. AP300:Y0 output flag of reset signal. ● M8141:For AP300: Y1 output flag of reset signal. ● M8150:For AP300: Y2 output flag of reset signal. ● M8151:For AP300: Y3 output flag of reset signal. ● M8145:Flag of stopping Y000 pulse output. ● M8146:Flag of stopping Y001 pulse output. ● M8155:Flag of stopping Y002 pulse output. ● M8156:Flag of stopping Y003 pulse output. ● M8147:Flag of executing Y0 pulse output. ● M8148:Flag of executing Y1 pulse output. ● M8157:Flag of executing Y2 pulse output. ● M8158:Flag of executing Y3 pulse output. ● M8149:Enable synchronous output of Y000 and Y001. 2. Description of special registers ● D8140, D8141:Register of the current value for the pulse of Y0 channel output, D8141(high bit), D8140(low bit). ● D8142, D8143:Register of the current value for the pulse of Y1 channel output, D8143(high bit), D8142(low bit). ● D8190, D8191:Register of the current value for the pulse of Y2 channel output, D8191(high bit), D8190(low bit). ● D8200, D8201:Register of the current value for the pulse of Y3 channel output, D8201(high bit), D8200(low bit).

《Notes》 For it does not have the function of DOG searching, the origin return action shall be started from the front end of the DOG signal. In origin return, the values of current value registers(Y000:[D8141,D8140],Y001: [D8143,D8142],Y002:[D8191,D8190],Y003:[D8201,D8200]) will be decreased.

6-226 Chapter 6 Interpretation of Application Instructions Locating

F157 PLSV Pulse V F PLSV Pulse V S· D1· D2· 157 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D1· * D2· * * * Note:AP300 series supports data register W. Instruction Format PLSV S· D1· D2·

S· :Output pulse frequency. [16-bit instruction]:1~32,767(Hz),-1~ -32,768(Hz); [32-bit instruction]:1~200,000(Hz),-1~ -200,000(Hz). The min frequency of channel Y2 and Y3 of AP300 shall not be lower than 12Hz. D1· :Number of pulse output object. AP100 and AP200 can only specify Y000 or Y001, while AP300 can specify Y000~Y003. The controller output must be transistor output. D2· :Output object number for rotating direction signal. Actions corresponding to positive/negative S•: when S• is positive, it is ON; when S• is negative, it is OFF. Function It is the variable-speed pulse output with rotation direction. Even if it is in pulse output, the output pulse frequency S• can be changed at your discretion. There is no acceleration or deceleration at start/stop. If buffering is required, instructions such as F67 (RAMP) can be used to change the value of the pulse frequency S•. During the pulse output, when the instruction driving contact is OFF, it will not decelerate but stop.

《Address numbers of the related devices》 1. Description of flag signals ● M8145:Flag of stopping Y000 pulse output. ● M8146:Flag of stopping Y001 pulse output. ● M8155:Flag of stopping Y002 pulse output. ● M8156:Flag of stopping Y003 pulse output.. ● M8143:Flag of finishing execution of Y0 pulse output. ● M8144:Flag of finishing execution of Y1 pulse output.

6-227 Chapter 6 Interpretation of Application Instructions Locating

● M8147:Flag of executing Y0 pulse output. ● M8148:Flag of executing Y1 pulse output. ● M8153:Flag of finishing execution of Y2 pulse output. ● M8154:Flag of finishing execution of Y3 pulse output. ● M8157:Flag of executing Y2 pulse output. ● M8158:Flag of executing Y3 pulse output. ● M8149:Enable synchronous output of Y000 and Y001. 2. Description of special registers ● D8140, D8141:Register of the current value for the pulse of Y0 channel output, D8141(high bit), D8140(low bit). ● D8142, D8143:Register of the current value for the pulse of Y1 channel output, D8143(high bit), D8142(low bit). ● D8190, D8191:Register of the current value for the pulse of Y2 channel output, D8191(high bit), D8190(low bit). ● D8200, D8201:Register of the current value for the pulse of Y3 channel output, D8201(high bit), D8200(low bit).

6-228 Chapter 6 Interpretation of Application Instructions Locating

F158 DRVI Drive to increment F DRVI Drive to increment S1· S2· D1· D2· 158 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D1· * D2· * * * Note:AP300 series supports data register W. Instruction Format DRVI S1· S2· D1· D2·

S1· :Output pulse number (relative specifying). [16-bit instruction]:-32,768~+32,767; [32-bit instruction]:-2,147,483,648~+2,147,483,647; S2· :Output pulse frequency. [16-bit instruction]:1~32,767(Hz) [32-bit instruction]:1~200,000(Hz) When the setting value is 0, it will be acted with the default value of 1Hz. The minimum output frequency of channel Y2 and Y3 in AP300 can't be smaller than 12Hz. The value below 12Hz will be regarded as 12Hz. D1· :Number of pulse output object. AP100 and AP200 can only specify Y000 or Y001, while AP300 can specify Y000~Y003. The controller output must be transistor output. D2· :Output object number for rotating direction signal. Actions corresponding to positive/negative S1•: when S1• is positive, it is ON; when S1• is negative, it is OFF. When S1. is zero, the rotation direction signal won't be processed. Function The instruction is used for single-speed location control with relative drive mode.

6-229 Chapter 6 Interpretation of Application Instructions Locating

Speed Acceleration Deceleration time time

Max speed

Pulse output frequency S2·

Base speed

Instruction Time execution Finishing of instruction execution M8029 The relative location corresponding to the output pulse number S1. is stated as below: Output to Y000: [D8141(High bit), D8140(Low bit)] (32-bit is used) Output to Y001: [D8143(High bit), D8142(Low bit)] (32-bit is used) Output to Y002: [D8191(High bit), D8190(Low bit)] (32-bit is used) Output to Y003: [D8201(High bit), D8200(Low bit)] (32-bit is used) When it rotates oppositely, the content of current value register will be decreased. During the instruction executing, even if content of the operand is changed, it can not be reflected to current operation . And it will take affect in the next instruction driving. During instruction executing, when the instruction driving contact is OFF, it stops deceleration. At this time, the finishing flag sign M8029 does not act. The so-called absolute control means taking the current location as basic point, moving with a certain pulse number with rotation direction.

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of pulse output. ● M8143:Flag of finishing execution of Y000 pulse output. ● M8144:Flag of finishing execution of Y001pulse output. ● M8153:Flag of finishing execution of Y002 pulse output. ● M8154:Flag of finishing execution of Y003 pulse output. ● M8145:Flag of stopping Y000 pulse output. ● M8146:Flag of stopping Y001 pulse output. ● M8155:Flag of stopping Y002 pulse output. ● M8156:Flag of stopping Y003 pulse output... ● M8147:Flag of executing Y000 pulse output. ● M8148:Flag of executing Y001 pulse output. ● M8157:Flag of executing Y002 pulse output.

6-230 Chapter 6 Interpretation of Application Instructions Locating

● M8158:Flag of executing Y003 pulse output. ● M8149:Enable synchronous output of Y000 and Y001. 2. Description of special registers ● D8140, D8141:Register of the current value for the pulse of Y0 channel output, D8141(high bit), D8140(low bit). ● D8142, D8143:Register of the current value for the pulse of Y1 channel output, D8143(high bit), D8142(low bit). ● D8190, D8191:Register of the current value for the pulse of Y2 channel output, D8191(high bit), D8190(low bit). ● D8200, D8201:Register of the current value for the pulse of Y3 channel output, D8201(high bit), D8200(low bit). ● D8146, D8147:For AP200, when the channel Y0,Y1 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. For AP300, when the channel Y0 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. The factory setting value of D8146 is-31072, while the factory setting value of D8147 is 1. ● D8166, D8167: For AP300, when the channel Y1 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. For AP200, the accelerating/decelerating parameters of channel Y1 and Y0 of AP200 share the same registers. The factory setting value of D8166 is-31072, while the factory setting value of D8167 is 1. ● D8196, D8197: When the channel Y2 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. The factory setting value of D8196 is-31072, while the factory setting value of D8197 is 1. ● D8206, D8207: When the channel Y3 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. The factory setting value of D8206 is -31072, while the factory setting value of D8207 is 1. ● D8145:For AP200, when the channel Y0,Y1 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. For AP300, when the channel Y0 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. The factory setting value of D8145 is 500. ● D8165:For AP300, when the channel Y1 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. For AP200, the base speed parameters of channel Y1 and Y0 of AP200 share the same registers. The factory setting value of D8165 is 500. ● D8195: When the channel Y2 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. The factory setting value of D8195 is 500.

6-231 Chapter 6 Interpretation of Application Instructions Locating

● D8205: When the channel Y3 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. The factory setting value of D8205 is 500. ● D8148:For AP200, when the channel Y0,Y1 is selected, it indicates the time of accelerating from the base speed to the maximum speed. For AP300, when the channel Y0 is selected, it indicates the time of accelerating from the base speed to the maximum speed. The factory setting value of D8148 is 100. ● D8168:For AP300, when the channel Y1 is selected, it indicates the time of accelerating from the base speed to the maximum speed. For AP200, the acceleration parameters of channel Y1 and Y0 of AP200 share the same registers. The factory setting value of D8168 is 100. ● D8198:When the channel Y2 is selected, it indicates the time of accelerating from the base speed to the maximum speed. The factory setting value of D8168 is 100. ● D8208:When the channel Y3 is selected, it indicates the time of accelerating from the base speed to the maximum speed. The factory setting value of D8208 is 100. ● D8157:For AP300, when the channel Y0 is selected, it indicates the time of decelerating from the base speed to the maximum speed. The factory setting value of D8157 is 100. ● D8169:For AP300, when the channel Y1 is selected, it indicates the time of decelerating from the base speed to the maximum speed. The factory setting value of D8169 is 100. ● D8199:For AP300, when the channel Y2 is selected, it indicates the time of decelerating from the base speed to the maximum speed. The factory setting value of D8199 is 100. ● D8209:For AP300, when the channel Y3 is selected, it indicates the time of decelerating from the base speed to the maximum speed. The default value of D8209 is 100.

6-232 Chapter 6 Interpretation of Application Instructions Locating

F159 DRVI drive to absolute F DRVA Drive to absolute S1· S2· D1· D2· 159 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * D1· * D2· * * * Note:AP300 series supports data register W. Instruction Format DRVA S1· S2· D1· D2·

S1· :Destination location (absolute specifying). [16-bit instruction]:-32,768~+32,767; [32-bit instruction]:-2,147,483,648~+2,147,483,647; S2· :Output pulse frequency. [16-bit instruction]:1~32,767(Hz) [32-bit instruction]:1~200,000(Hz) When the setting value is 0, it will be acted with the default value of 1Hz. The minimum output frequency of channel Y2 and Y3 in AP300 can't be smaller than 12Hz. The value below 12Hz will be regarded as 12Hz. D1· :Number of pulse output object. AP100 and AP200 can only specify Y000 or Y001, while AP300 can specify Y000~Y003. The controller output must be transistor output. D2· :Output object number for rotating direction signal. Actions corresponding to the differences between S1• and current locations (Difference=S1· -current location): when the difference is positive, it is ON; and is OFF for negative. When the difference is zero, the rotation direction signal won't be processed. Function The instruction is used for single-speed location control with absolute drive mode.

6-233 Chapter 6 Interpretation of Application Instructions Locating

Speed Acceleration Deceleration time time

Max speed

Pulse output frequency S2·

Base speed

Instruction Time execution Finishing of instruction execution M8029 The relative location corresponding to the output pulse number S1. is stated as below: Output to Y000: [D8141(High bit), D8140(Low bit)] (32-bit is used) Output to Y001: [D8143(High bit), D8142(Low bit)] (32-bit is used) Output to Y002: [D8191(High bit), D8190(Low bit)] (32-bit is used) Output to Y003: [D8201(High bit), D8200(Low bit)] (32-bit is used) When it rotates oppositely, the content of current value register will be decreased. During the instruction executing, even if content of the operand is changed, it can not be reflected to current operation . And it will take affect in the next instruction driving. During instruction executing, when the instruction driving contact is OFF, it stops deceleration. At this time, the finishing flag sign M8029 does not act. The so-called absolute control means taking the current location as basic point, moving with a certain pulse number with rotation direction.

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of pulse output. ● M8143:Flag of finishing execution of Y000 pulse output. ● M8144:Flag of finishing execution of Y001pulse output. ● M8153:Flag of finishing execution of Y002 pulse output. ● M8154:Flag of finishing execution of Y003 pulse output. ● M8145:Flag of stopping Y000 pulse output. ● M8146:Flag of stopping Y001 pulse output. ● M8155:Flag of stopping Y002 pulse output. ● M8156:Flag of stopping Y003 pulse output. ● M8147:Flag of executing Y000 pulse output. ● M8148:Flag of executing Y001 pulse output.

6-234 Chapter 6 Interpretation of Application Instructions Locating

● M8157:Flag of executing Y002 pulse output. ● M8158:Flag of executing Y003 pulse output. ● M8149:Enable synchronous output of Y000 and Y001. 2. Description of special registers ● D8140, D8141:Register of the current value for the pulse of Y0 channel output, D8141(high bit), D8140(low bit). ● D8142, D8143:Register of the current value for the pulse of Y1 channel output, D8143(high bit), D8142(low bit). ● D8190, D8191:Register of the current value for the pulse of Y2 channel output, D8191(high bit), D8190(low bit). ● D8200, D8201:Register of the current value for the pulse of Y3 channel output, D8201(high bit), D8200(low bit). ● D8146, D8147:For AP200, when the channel Y0,Y1 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. For AP300, when the channel Y0 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. The factory setting value of D8146 is-31072, while the factory setting value of D8147 is 1. ● D8166, D8167: For AP300, when the channel Y1 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. For AP200, the accelerating/decelerating parameters of channel Y1 and Y0 of AP200 share the same registers. The factory setting value of D8166 is-31072, while the factory setting value of D8167 is 1. ● D8196, D8197: When the channel Y2 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. The factory setting value of D8196 is -31072, while the factory setting value of D8197 is 1. ● D8206, D8207: When the channel Y3 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. The factory setting value of D8206 is -31072, while the factory setting value of D8207 is 1. ● D8145:For AP200, when the channel Y0,Y1 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. For AP300, when the channel Y0 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. The factory setting value of D8145 is 500. ● D8165:For AP300, when the channel Y1 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. For AP200, the base speed parameters of channel Y1 and Y0 of AP200 share the same registers. The factory setting value of D8165 is 500. ● D8195: When the channel Y2 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. The factory setting value of D8195 is 500.

6-235 Chapter 6 Interpretation of Application Instructions Locating

● D8205: When the channel Y3 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. The factory setting value of D8205 is 500. ● D8148:For AP200, when the channel Y0,Y1 is selected, it indicates the time of accelerating from the base speed to the maximum speed. For AP300, when the channel Y0 is selected, it indicates the time of accelerating from the base speed to the maximum speed. The factory setting value of D8148 is 100. ● D8168:For AP300, when the channel Y1 is selected, it indicates the time of accelerating from the base speed to the maximum speed. For AP200, the acceleration parameters of channel Y1 and Y0 of AP200 share the same registers. The factory setting value of D8168 is 100. ● D8198:When the channel Y2 is selected, it indicates the time of accelerating from the base speed to the maximum speed. The factory setting value of D8198 is 100. ● D8208:When the channel Y3 is selected, it indicates the time of accelerating from the base speed to the maximum speed. The factory setting value of D8208 is 100. ● D8157:For AP300, when the channel Y0 is selected, it indicates the time of decelerating from the base speed to the maximum speed. The factory setting value of D8157 is 100. ● D8169:For AP300, when the channel Y1 is selected, it indicates the time of decelerating from the base speed to the maximum speed. The factory setting value of D8169 is 100. ● D8199:For AP300, when the channel Y2 is selected, it indicates the time of decelerating from the base speed to the maximum speed. The factory setting value of D8199 is 100. ● D8209:For AP300, when the channel Y3 is selected, it indicates the time of decelerating from the base speed to the maximum speed. The factory setting value of D8209 is 100.

6-236 Chapter 6 Interpretation of Application Instructions Time computation

16 F160~F167 Time Computation

Time computation Function No. Mnemonic Name Page F160 TCMP Time compare 6-238 F161 TZCP Time zone compare 6-239 F162 TADD Time addition 6-240 F163 TSUB Time subtraction 6-241 F166 TRD Read time 6-242 F167 TWR Write clock data 6-243

6-237 Chapter 6 Interpretation of Application Instructions Time computation

F160 TCMP time compare F TCMP Time compare S1· S2· S3· S· D· 160 P Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * S3· * * * * * * * * * * * * S· * * * * D· * * * Note:AP300 series supports data register W. Instruction Format TCMP S1· S2· S3· S · D·

S1· :Specify “H” of the comparison time, range of specifying「0~23」. S2· :Specify “M” of the comparison time, range of specifying「0~59」. S3· :Specify “S” of the comparison time, range of specifying「0~59」. S· :Specify “H” of the time data, range of specifying (0~23)「0~23」. S· +1:Specify “M” of the time data, range of specifying (0~59)「0~59」. S· +2:Specify “S” of the time data, range of specifying (0~59)「0~59」. D· :Comparison results, occupying continuous 3 bits. Function Compare time of source data「S1·,S2·,S3·」and 3-point time data started with S•. 3-point ON/OFF state started with D. is output according to the comparison results. For example: X000 TCMP K10 K30 K50 D0 M 10H30M50S 10H D0(H) 30M > D1(M) 50S D2(S) M0=ON, M1=OFF, M2=OFF ● Even if X000 is used to stop executing 10H D0(H) 30M = D1(M) the instruction TCMP, M0~M2 shall keep 50S D2(S) the state before X000 is OFF. M1=ON, M0=OFF, M2=OFF 10H D0(H) 30M < D1(M) 50S D2(S) M2=ON, M0=OFF, M1=OFF

6-238 Chapter 6 Interpretation of Application Instructions Time computation

F161 TZCP time zone compare F TZCP Time zone compare S1· S2· S· D· 161 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * S· * * * * D· * * * Note:AP300 series supports data register W. Instruction Format TZCP S1· S2· S · D·

S1· :Specify lower limit value of the comparison time. S1· :Specify upper limit value of the comparison time. S· :Specify time data. D· :Comparison results, occupying continuous 3 bits. Function Compare 3-point time data started with S• and time zones specified by the upper and lower points S1• and S2•. 3-point ON/OFF state started with D• is output according to the comparison results. For example: ● Even if X000 is used to stop X000 TZCP D20 D30 D0 M3 executing the instruction TZCP, M0~M5 shall keep the state before X000 is OFF. D0(H) D20(H) ● S1·、S1· +1、S1· +2:“H”, “M” D1(M) < D21(M) and “S” of lower setting value of the D2(S) D22(S) comparison time. M3=ON, M4=OFF, M5=OFF ● S2·、S2· +1、S2· +2:“H”, “M” and “S” of upper setting value of the D20(H) D0(H) D30(H) comparison time. D21(M) ≤ D1(M) ≤ D31(M) ● S·、S ·+1、S ·+2:“H”, “M” and D22(S) D2(S) D32(S) “S” of the specified time. M4=ON, M3=OFF, M5=OFF ● The lower limit value S1• may not be more than the upper limit value D30(H) D0(H) S2•. When the lower limit value D31(M) < D1(M) S1•>the upper limit value S2•, the D32(S) D2(S) lower limit value S1• shall be taken as M5=ON, M3=OFF, M4=OFF the upper and lower limit values for comparison.

6-239 Chapter 6 Interpretation of Application Instructions Time computation

F162 TADD time addition F TADD Time addition S1· S2· D· 162 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * D· * * * * Note:AP300 series supports data register W. Instruction Format TADD S1· S2· D·

S1· :Augend of time S2· :Addend of time. D· :Sum of time. Function H, M and S of calendar data specified by S1·、S1· +1、S1· +2 plus H, M and S of calendar data specified by S2·、S2· +1、S2· +2, and the result is stored in H, M and S of the register specified by D·、D· +1、D· +2.

For example:

X000 TADD D10 D20 D30 D10 10(H) D20 03(H) D30 13(H) D11 30(M) D21 10(M) D31 40(M) D12 10(S) D22 05(S) D32 15(S) 10H30M10S 03H10M05S 13H40M05S

● If the addition result is equal to or over 24H, the carrying flag M8022=ON. The computation result minus 24H, and the final result is obtained and stored. For example: 18(H) 10(H) 04(H) 10(M) 20(M) 30(M) 30(S) 05(S) 35(S) 18H10M30S 10H20M05S 04H30M35S

● If the computation result is 0 (0 H 0 M 0S), and the zero flag M8020=ON.

6-240 Chapter 6 Interpretation of Application Instructions Time computation

F163 TSUB time subtraction F TSUB Time subtraction S1· S2· D· 163 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * D· * * * * Note:AP300 series supports data register W. Instruction Format TSUB S1· S2· D·

S1· :Minuend of time. S2· :Subtrahend of time. D· :Difference of time. Function H, M and S of calendar data specified by S1·、S1· +1、S1· +2 minus H, M and S of calendar data specified by S2·、S2· +1、S2· +2, and the result is stored in H, M and S of the register specified by D·、D· +1、D· +2.

For example:

X000 TSUB D10 D20 D30 D10 10(H ) D20 03(H ) D30 07(H ) D11 30(M ) D21 10(M ) D31 20(M ) D12 10(S ) D22 05(S ) D32 05(S ) 10H 30M 10S 03H 10M 05S 07H 20M 05S

● If the subtraction result is equal to or over 24H, the carrying flag M8021=ON. The computation result plus 24H, and the final result is obtained and stored. For example: 05(H) 18(H) 11(H) 20(M) 10(M) 10(M) 40(S) 05(S) 35(S) H M S H M S H M S 05 20 40 18 10 05 11 10 35

● If the computation result is 0 (0 H 0 M 0S), and the zero flag M8020=ON.

6-241 Chapter 6 Interpretation of Application Instructions Time computation

F166 TRD read time F TRD Read time D· 166 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z D· * * * * Note:AP300 series supports data register W. Instruction Format TRD D·

D· : Start device storing the readout value of current time of the RTC, occupying continuous 7 points Function The instruction reads the real-time clock data in the special registers D8013~D8019 of the PLC, and stores the results in the 7-point data register started with the destination operand D.

For example: X000 TRD D0

Read real-time clock data of the controller according to the following format. The reading source is the special data registers (D8013~D8019)for storing the clock data.

Device Item Clock data Device Item D8018 Y (Solar 2000~2099 → D0 Y (Solar calendar) calendar) Special data D8017 Month 1~12 → D1 Month register D8016 Date 1~31 → D2 Date (For real-time D8015 Hour 0~23 → D3 Hour clock) D8014 Minute 0~59 → D4 Minute D8013 Second 0~59 → D5 Second D8019 Week 0(Sunday)~6(Saturday) → D6 Week

6-242 Chapter 6 Interpretation of Application Instructions Time computation

F167 TWR write clock data F TWR Write RTC data S· 167 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * Note:AP300 series supports data register W. Instruction Format TWR S·

S· :Start device to store the new setting value of the RTC. Function The instruction is the inverse computation of the instruction TRD, which is to write the clock data in the RTC of PLC.

For example: X000 TWRP D10

● Write data for setting clock into the RTC of the controller. To write clock data, 7-point element started with element address numbers specified by S• must be specified in advance. ● When the setting value is beyond the range specified in the table below, D8067 = 6706, and the instruction won't be executed.

Device Item Clock data Device Item Y (Solar Y (Solar D10 2000~2099 → D8018 calendar) calendar) Special D11 Month 1~12 → D8017 Month data Data for D12 Date 1~31 → D8016 Date Register clock D13 Hour 0~23 → D8015 Hour (For setting D14 Minute 0~59 → D8014 Minute real-time D15 Second 0~59 → D8013 Second clock) D16 Week 0(Sunday)~6(Saturday) → D8019 Week

6-243 Chapter 6 Interpretation of Application Instructions Peripheral devices

17 F170~F171 Peripheral Devices

Peripheral devices Function No. Mnemonic Name Page F170 GRY Binary→Gray code 6-245 F171 GBIN Gray→Binary code 6-246

6-244 Chapter 6 Interpretation of Application Instructions Peripheral devices

F170 GRY Binary→Gray code F GRY Binary→Gray code S· D· 170 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format GRY S· D·

S· :Source device. D· :Device for storing gray code Function The instruction is used to convert the binary numbers in S· into gray code and send them to the destination device D·. When the absolute rotary coder is used to convert the binary numbers into gray code in the control system, the instruction GRY shall be applied. For example: X000 GRY K1234 K3Y010

b15 b0 BIN 1234 0 0 00010011010010

Y23 Y20Y17 Y10 GRY 1234 011010111011

● The instruction that converts BIN data to gray code and sends the data. ● 32-bit gray code conversion can be executed in maximum. ● As for values of S•, it is only valid in the following range. 16-bit computation: 0~32,767; 32-bit computation: 0~2,147,483,647.

6-245 Chapter 6 Interpretation of Application Instructions Peripheral devices

F171 GBIN Gray→Binary code F GBIN Gray→Binary code S· D· 171 D P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * * * * * * * * * * * D· * * * * * * * * * Note:AP300 series supports data register W. Instruction Format GBIN S· D·

S· :Source device. D· :Device for storing reverse conversion of gray code. Function Reverse conversion to BIN value is executed for the gray code specified device by S•, and the result is stored in device specified by D•. For example: X000 GBIN K3X000 D10

X13 X10 X7 X0 GRY 1234 011010111011

b15 b0 BIN 1234 0 0 00010011010010

● The instruction that converts gray code to BIN data and sends the data. ● 32-bit gray code reverse conversion can be executed in maximum. ● As for values of S•, it is only valid in the following range. 16-bit computation: 0~32,767; 32-bit computation: 0~2,147,483,647.

6-246 Chapter 6 Interpretation of Application Instructions Peripheral communication

18 F188~F193 Peripheral Communication

Peripheral communication Function No. Mnemonic Name Page F188 CRC Cyclical redundancy check 6-248 F191 RMIO Remote I/O connection 6-251 F193 DTLK2 Data link 2 6-259

6-247 Chapter 6 Interpretation of Application Instructions Peripheral communication

F188 CRC cyclical redundancy check F CRC Cyclical redundancy check S· D· n· 188 P

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S· * * D· * * n· * * * * Note:AP300 series supports data register W. Instruction Format

· · · CRC S D n S· :Start device of data. D· :Location for storing the generated CRC value. n· :Number of data points. Function It generates CRC value for the n. points of 8-bit data (in bytes) started with the device specified by S·, and stores the result in D. The instruction supports 8-bit and 16-bit conversion modes, which are switched based on M8161 ON/OFF. To generate CRC values, the polynomial expression [X16+X15+X2+X1] is used. Besides, for CRC value, there are various standardized polynomial expressions. Please note that if different polynomial expressions are used, it will generate totally different CRC values.

Reference:The main CRC polynomial expression: Name Polynomial expression CRC-12 X12+X11+X3+X2+X+1 CRC-16 X16+X15+X2+1 CRC-32 X32+X26+X3+X22+X16+X12+X11+X10+X8+X7+X5+X4+X2+X+1 CRC-CCITT X16+X12+X5+1

《Related elements》 Device Content Remark [M8161] ON CRC acts under 8-bit mode. It is reset when STOP→RUN. OFF CRC acts under 16-bit mode.

6-248 Chapter 6 Interpretation of Application Instructions Peripheral communication

《16-bit conversion mode[M8161=ON]》 In 16-bit mode, the high 8-bit (byte) and the low 8-bit (byte) of element S would be operated. The result will be kept in the 16-bit of 1-point element specified by D.

When S·=D100,D·=D0,n·=6: Object data Device 8-bit 16-bit Low byte D100 low byte 01H S· 0101H High byte D100 high byte 01H Low byte D101 low byte 03H S·+1 CD03H High byte D101 high byte CDH Address for storing Low byte D102 low byte 6BH the object data of S·+2 056BH High byte D102 high byte 05H CRC value ——

Low byte S·+n/2-1 —— High byte Address for storing Low byte D0 low byte 42H D· 8242H CRC value High byte D0 high byte 82H

6-249 Chapter 6 Interpretation of Application Instructions Peripheral communication

《8-bit conversion mode[M8161=ON]》 In 8-bit mode, only low byte of the element S would be operated. The result will be kept in the two points of D. and D.+1 in the element specified by D. The low 8-byte are kept in D. and the high 8-byte are kept in .D+1.

When S·=D100,D·=D0,n·=6: Object data Device content S· Low byte D100 low byte 01H S·+1 Low byte D101 low byte 01H S·+2 Low byte D102 low byte 03H Address for storing S·+3 Low byte D103 low byte CDH the object data of S·+4 Low byte D104 low byte 6BH CRC value S·+5 Low byte D105 low byte 05H

——

S·+n-1 Low byte —— Address for storing D· Low byte D0 low byte 42H CRC value D·+1 Low byte D1 low byte 82H

6-250 Chapter 6 Interpretation of Application Instructions Peripheral communication

F191 RMIO remote I/O connection F RMIO Remote I/O connection K 191

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z K * * Note 1:AP100 1.2 and above versions are supported. Note 2:The limit on simultaneous driving of the instruction is 1. Instruction Format RMIO K

K :Serial port selection, constant 0~2. 0:RS485 communication port; 1:RS485 or RS232 expansion card communication port 1; 2:RS485 or RS232 expansion card communication port 2. (Only K of AP360 series can be 0, 1 or 2, which is 0 or 1 for other AP series.) Function AP series adopts the mode to increase the I/O points of the master. The master of AP series can communicate with 4 AP slaves in maximum.

Note:1. When 2 or 3 communication ports are ready for RMIO simultaneously, the firstly enabled one will take the priority. Communication frame and baud rate are set through D8120(RS485 communication port), D8320(expansion card communication port 1), D8300(expansion card communication port 2), which is controlled by the serial port. Even if the setting of D8120 is changed during the operation, it won't take effect until the instruction is enabled once again. 2. When AP series is taken as the slave under remote I/O mode, it can be only used for the expansion I/O function of the master, which can only operate the instruction RMIO, but can't execute other user programs. 3. When AP series is enabled as the slave of remote I/O mode, you can only switch it to other mode by stopping the program operation. In the remote I/O mode, the master of AP series can communicate with 4 slaves under the same series in maximum.

R R D+ - D+ - - - - D S D S D+ D S D+ D S D+ D S

6-251 Chapter 6 Interpretation of Application Instructions Peripheral communication

Item Description Communication EIA RS-485 standards Baud rate 4800bps~500000bps Number of slaves 4 slaves in maximum Slave 1 Input: 36 points(M1200~M1235);Output: 24points(M1440~M1463) Remote I/O zone Slave 2 Input: 36 points(M1240~M1275);Output: 24points(M1464~M1487) (set up by master) Slave 3 Input: 36 points(M1280~M1315);Output: 24points(M1488~M1511) Slave 4 Input: 36 points(M1320~M1355);Output: 24points(M1512~M1535) Cable Insulated twisted cable, collinearity, 2 lines type, total length: 1km(38400bit/s) RS485/ RS232 expansion card communication port 1/2 (all type is available for expansion), and RS485 communication port are available for remote I/O communication. However, they can not be enabled simultaneously. Note:The remote slave must be the basic unit of AP, which can't be the expansion module or other module.

Related flags and data registers 1) Auxiliary Relay M Auxiliary Relay Feature Name Description Response form Communication error It is ON when error occurs to the M8336 Read only Slave in master communication of master. Communication error It is ON when error occurs to the M8337 Read only Master/Slave in slave 1 communication of slave 1. Communication error It is ON when error occurs to the M8338 Read only Master/Slave in slave 2 communication of slave 2. Communication error It is ON when error occurs to the M8339 Read only Master/Slave in slave 3 communication of slave 3. Communication error It is ON when error occurs to the M8340 Read only Master/Slave in slave 4 communication of slave 4. Expansion communication port 1 is in M8341 Read only Remote I/O mode Master/Slave remote I/O mode. M8342 Read only Remote I/O mode RS485 is Remote I/O mode Master/Slave Expansion communication port 2 is in M8343 Read only Remote I/O mode Master/Slave remote I/O mode.

6-252 Chapter 6 Interpretation of Application Instructions Peripheral communication

2) Data register D Response Data Register Feature Name Description form Read Master/Slav D8373 Station number Slave the local station number only e Read Master/Slav D8374 Total slave number Save the total slave number only e Master/Slav D8376 Write Set station number Slave the local station number e D8377 Write Set total slave number Set the total slave number Master Read/W D8379 Set retry times Set retry times Master rite Read/W Set communication Master/Slav D8380 Set communication timeout rite timeout e Read Store current network scan D8331 Current network scan time Master only time Read Maximum network scan Store maximum network scan D8332 Master only time time Read Communication error Communication error count D8333 Slave only counting of master of master Read Communication error Communication error count Master/Slav D8334 only count of slave 1 of slave 1 e Read Communication error Communication error count Master/Slav D8335 only count of slave 2 of slave 2 e Read Communication error Communication error count Master/Slav D8336 only count of slave 3 of slave 3 e Read Communication error Communication error count Master/Slav D8337 only count of slave 4 of slave 4 e Read Communication error code Communication error code of D8338 Slave only of master master Read Communication error code Communication error code of Master/Slav D8339 only of slave 1 slave 1 e Read Communication error code Communication error code of Master/Slav D8340 only of slave 2 slave 2 e Read Communication error code Communication error code of Master/Slav D8341 only of slave 3 slave 3 e

6-253 Chapter 6 Interpretation of Application Instructions Peripheral communication

Response Data Register Feature Name Description form Read Communication error code Communication error code of Master/Slav D8342 only of slave 4 slave 4 e Setting When the program is in operation, or AP is power ON, all the setting for remote I/O will take effect. 1) Set station number (D8376) The setting range is 0~4. 0 indicates the master, while 1~4 indicate the slave 1~4. Even if the station number is changed during the operation, it won't take effect until the instruction is enabled once again. 2) Set the slave number (D8377) The setting range is 0~4. When the setting value is beyond the range, it will be 4 by default. The setting is not required for the slave. User shall set the slave number upon actual demands, so as to increase the communication efficiency and data refresh speed. 3) Set retry times(D8379) The setting range is 0~50. When the setting value is beyond the range, it will be 2 by default. That is, it will retry twice in case of communication error, and the communication instruction shall be sent for third times. The setting is not required for the slave. 4) Set communication timeout period (D8380) Communication timeout period=(D8380×10)ms. The setting range is 50~2550ms. That is, the setting range for D8380 is 5~255. When the setting value is beyond the range, it will be 5 by default. In this case, the default communication timeout period is 50ms. The corresponding devices used for the communication The remote I/O zone of the master is composed of: Master Slave 1 Input M1200~M1235 X000~X043 Slave 1 Output M1440~M1463 Y000~Y027 Slave 2 Input M1240~M1275 X000~X043 Slave 2 Output M1464~M1487 Y000~Y027 Slave 3 Input M1280~M1315 X000~X043 Slave 3 Output M1488~M1511 Y000~Y027 Slave 4 Input M1320~M1355 X000~X043 Slave 4 Output M1512~M1535 Y000~Y027

Wiring method

6-254 Chapter 6 Interpretation of Application Instructions Peripheral communication

RS485—RS232 converter

R R - - - - D+ D S D+ D S D+ D S D+ D S Note:1. For SHLD shielding layer, please use class-3 grounding. Otherwise, the noise will cause wrong operation. 2. Branches of communication cable should not exceed 3. 3. R represents the resistor of the communication terminal, with the spec of 120Ω,1/4W.

Communication sequence and the time required for transmission

A scan cycle

Communication data exchange Communication data exchange Communication mark update Communication mark update PLC scan time of master I/O I/O I/O

Slave 1 Slave 2 Slave 3 Slave 4 Slave 1 Slave 2 Slave 3 Slave 4

A communication cycle T

Communication sequence The communication between the master and the slaves, the data exchange of remote I/O and the update of communication flag are synchronous with the scan cycle of the slave. The processing time (1 communication cycle) will increase the scan time of the master. When there is error in communication between master and slaves, Remote I/O communication and PLC operation will stop and enter error status.

Possible causes of error are as follows: 1. Error of inspection to check code. 2. Slave in STOP mode or ERROR status. 3. Slave disconnected or connection wire broken 4. When the master is in STOP mode or ERROR status, it will not communicate with any slave. 5. The settings for communication format between master and slave are not consistent.

6-255 Chapter 6 Interpretation of Application Instructions Peripheral communication

Communication sequence for slave The communication between the slaves to the master is asynchronous with the scan time of the slaves. After communication between the slaves to the master is finished, the link data will be exchanged and the communication flag will be refreshed during the scan cycle. The processing will increase the scan time of the slave by 0.2ms.

A scan cycle Data exchange Data exchange Data not Communication Communication mark update exchange mark update PLC scan time of slave I/O I/O I/O

Master Master

The time required for transmission In remote I/O mode, the time (It is the communication cycle, which will be included in the SCAN TIME of the master) required for master to complete the communication with all slaves is as follows : Communication Normal communication Time out, t Communication time Baud rate (bps) time for each slave, time for master and 4 (ms) for master, T(ms) Tn (ms) slaves (ms) 4800 82 336 9600 42 168 Tn*n1+t*n2 19200 21 84 (n1: normal slave 38400 11 44 number; n2: slave 57600 7 D8380*10 28 number for 115200 4 16 communication 128000 4 16 timeout) 307200 2 8 500000 1 4 If there is communication error in slave, the time for repeated communication will be added (Tn will be added to the time for each error).

Communication delay time: When the remote I/O is receiving data, there will be some delay as in the following figure.

6-256 Chapter 6 Interpretation of Application Instructions Peripheral communication

X010 M1440 X000 RMIO K0

Program operation and RMIO data A scan cycle of master exchange I/O I/O I/O

X010 input interface

X010 input logic gate

Data memoryX010

Data memoryM1440

T1 T2 T3 Slave scan I/O I/O I/O I/O I/O I/O Output port holding Output terminal Output Y0 on slave 1) T4 T5

As T1: delay for input terminal (response time for OFF to ON) shown T2: time for master writing data to coil register (max scan in the time) figure: T3: program operation and output time T4: time between the slave received data to output port T5: delay for output terminal(response time for OFF to ON)

Error code When there is communication error, the special reference coils M8336~M8340 will indicate the error status and the error code will be stored in special data registers (D8338~D8342). Error Check Error Error Description Check point station station There is no response Check the wiring, and Communicatio as the master sends the 01H L M run/stop status of the n timeout error request to slave and it power supply. timesout. The station number Station doesn't comply with 02H L M Check the wiring number error the relation between the master and the

6-257 Chapter 6 Interpretation of Application Instructions Peripheral communication

slaves. Communicatio Network Check the wiring and 03H n instruction L M communication the network error instruction error configuration Communication Check the wiring and Communicatio 04H L M format for the slave the resource setting of n format error is incorrect RMIO. After the slave responds to the master, Check the wiring, and Communicatio 11H M L the master does not run/stop status of the n timeout error send another request to power supply. the next slaver. Communicatio Network Check the wiring and 13H n instruction M L communication the network error instruction error configuration Communication Check the wiring and Communicatio 14H M L format of the master the resource setting of n format error is incorrect RMIO. M:master; L:slave.

6-258 Chapter 6 Interpretation of Application Instructions Peripheral communication

F193 DTLK2 data link 2 F DTLK2 Data link 2 S1· S2· K 193

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * S2· * * * * K * * Note 1:AP300 series supports data register W. Note 2:AP100 1.2 and above versions are supported. Note 3:The limit on simultaneous driving of the instruction is 1. Instruction Format · · DTLK2 S1 S2 K S1· :Start address of data source, with the range of D0~D7999, W0~W32767. S2· :Data of length, with the range of 1~40. K :Serial port selection, constant 0~1. 0:RS485 communication port; 1:RS485 or RS232 expansion card communication port 1; 2:RS485 or RS232 expansion card communication port 2. (Only K of AP360 series can be 0, 1 or 2, which is 0 or 1 for other AP series.) Function AP series adopts the mode to link the data in the system of small scale. The AP series master can communicate with a maximum of 15 AP slaves. Note:When 2 or 3 communication ports are ready for DTLK2 simultaneously, the firstly enabled one will take the priority. The communication frame and baud rate are set through D8120(RS485 communication port), D8320(expansion card communication port 1), D8300(expansion card communication port 2), which is controlled by the serial port.

Specification Baud rate EIA RS-485 Baud rate 4800bps~500000bps Number of slaves 15 slaves in maximum The start address in the range of D0~D7999 and W0~W32767 are set by Linked zone instruction DTLK2. Data length for The maximum data length is 40 words, which can be set by instruction each slave DTLK2 Cable Insulated twisted cable, collinearity, 2 lines type, total length: 1km

6-259 Chapter 6 Interpretation of Application Instructions Peripheral communication

(38400bit/s)

Wiring method

R R D+ - D+ - - - D S D S D+ D S D+ D S Note:1. For SHLD terminal, please use class-3 grounding. Otherwise, the noise will cause wrong operation. 2. Branches of communication cable should not exceed 3. 3. R represents the resistor of the communication terminal, with the spec of 120Ω,1/4W. ○ ×

Connector Connectio connection nterminal

Related flags and data registers 1) Auxiliary Relay Auxiliary Featu Response Name Description Relay re form Read Communication It is ON when error occurs to the M8400 Slave only error in master communication of master. Read Communication It is ON when error occurs to the Master/Sl M8401 only error in slave 1 communication of slave 1. ave Read Communication It is ON when error occurs to the Master/Sl M8402 only error in slave 2 communication of slave 2. ave : : : : : Read Communication It is ON when error occurs to the Master/Sl M8414 only error in slave 14 communication of slave 14. ave Read Communication It is ON when error occurs to the Master/Sl M8415 only error in slave 15 communication of slave 15. ave Data Read It is ON as DTLK2 communicates with Master/Sl M8416 communication only other stations. ave status Read It is ON when the expansion Master/Sl M8417 Data Link2 mode only communication port 1 is in operation ave

6-260 Chapter 6 Interpretation of Application Instructions Peripheral communication

of Data Link 2. It is ON when the built-in Read Master/Sl M8418 Data Link2 mode communication port is in operation of only ave Data Link 2. It is ON when the expansion Read Master/Sl M8419 Data Link2 mode communication port 2 is in operation only ave of Data Link 2.

6-261 Chapter 6 Interpretation of Application Instructions Peripheral communication

2) Data Register Data Response Feature Name Description Register form Read D8173 Station number Slave the local station number Master/Slave only Read D8174 Total slave number Save the total slave number Master/Slave only D8175 Reserved D8176 Write Set station number Slave the local station number Master/Slave D8177 Write Set total slave number Set the total slave number Master D8178 Reserved Read/ D8179 Set retry times Set retry times Master Write Read/ D8180 Set communication timeout Set communication timeout Master Write Read D8401 Current network scan time Store current network scan time Master/Slave only Read D8402 Maximum network scan time Store maximum network scan time Master/Slave only Read Communication error Communication error count of D8403 Slave only counting of master master Read Communication error count of Communication error count of slave D8404 Master/Slave only slave 1 1 Read Communication error count of Communication error count of slave D8405 Master/Slave only slave 2 2 : : : : : Read Communication error count of Communication error count of slave D8411 Master/Slave only slave 8 8 : : : : : Read Communication error count of Communication error count of slave D8417 Master/Slave only slave 14 14 Read Communication error count of Communication error count of slave D8418 Master/Slave only slave 15 15 Read Communication error code of D8419 Communication error code of master Slave only master D8420 Read Communication error code of Communication error code of slave Master/Slave

6-262 Chapter 6 Interpretation of Application Instructions Peripheral communication

Data Response Feature Name Description Register form only slave 1 1 Read Communication error code of Communication error code of slave D8421 Master/Slave only slave 2 2 : : : : : Read Communication error code of Communication error code of slave D8427 Master/Slave only slave 8 8 : : : : : Read Communication error code of Communication error code of slave D8433 Master/Slave only slave 14 14 Read Communication error code of Communication error code of slave D8434 Master/Slave only slave 15 15 Setting When the program is in operation, or AP is power ON, all the setting for Data Link2 will take effect. 1) Set station number (D8176) Set 0~15 to the special data register D8176. 0 is the master number, while 1~15 indicate the slave 1~15. 2) Set the slave number (D8177) Set 0~15 to the special data register D8177, which indicates the total number of slaves(7 by default). The setting is not required for the slave. User shall set the slave number upon actual demands, so as to increase the data refresh speed. 3) Set retry times(D8179) Set 0~10 to the special data register D8179(3 by default). The setting is not required for the slave.If a master tries to communicate with the slaves based on the retry times, it will be communication error on the slave. 4) Set communication timeout period (D8180) Set 0~10 to the special data register D8180(5 by default). The product of the value and 10 is the communication timeout period (ms). 5) Current network scan time (D8401) It is the time taken by the network scanning of the current Data Link2. The product of such value and 10 is the current communication scan time (ms). 6) Maximum network scan time (D8402)

The program for setting the said devices:

6-263 Chapter 6 Interpretation of Application Instructions Peripheral communication

X000 MOV K0 D8176 Slave ID setting: 0~15 MOV K2 D8177 Total number of slaves: 2(1~15) The settings are not MOV K3 D8179 Retry times setting: 3 required for Communication overtime MOV K6 D8180 slave setting: 6(60ms) X001 DTLK2 D0 K5 K0

Error code When there is communication error, the special reference coils M8400~M8415 will indicate the error status and the error code will be stored in special data registers (D8419~D8434). Error Check Error Error Description Check point station station There is no response as Communica Check the wiring, the master sends the 01H tion timeout L M and run/stop status request to slave and it Error of the power supply. times out. The station number Station doesn't comply with the 02H number L M Check the wiring relation between the Error master and the slaves. The communication Communica counter doesn't comply 03H tion counter L M with the relation between Check the wiring error the master and the slaves. Communica Communication format Check the wiring 04H tion format L M,L for the slave and the resource Error is incorrect settings of DTLK2. After the slave responds Communica to the master, the master Check the wiring, 11H tion timeout M L does not send and run/stop status Error anotherrequest to the of the power supply. next slaver. Communica Communication format Check the wiring 14H tion format M L of the master and the resource Error is incorrect settings of DTLK2.

6-264 Chapter 6 Interpretation of Application Instructions Peripheral communication

Error Check Error Error Description Check point station station The station number in Without Check the setting of 21(H) L L*1 the network slave station number is incorrect The station number Station doesn't comply with the 22(H) number L L*1 Check the wiring relation between the Error master and the slaves. The communication Communica counter doesn't comply 23(H) tion counter L L*1 with the relation between Check the wiring error the master and the slaves. Without The slave receives the communicat request from the master Check the wiring, 31(H) ion L L*2 before the low power, parameter communication run/stop status. received parameters are set. Network communication Check the network 32(H) Other errors L L*1 instruction error settings Length or address Data length Check the wiring parameter of the and the resource 33(H) or address L L*1 communication settings of error instruction data is wrong DTLK2. M:Master;L:Slave;L*1:Another slave;L*2:Independent station.

6-265 Chapter 6 Interpretation of Application Instructions Pulse output

19 F200~F213 Pulse Output

Pulse output Function No. Mnemonic Name Page F200 PPMI Dual-axis relative point-to-point movement 6-267 F201 PPMA Dual-axis absolute point-to-point movement 6-270 F202 CWI Dual-axis relative circular interpolation 6-273 F203 CWA Dual-axis absolute circular interpolation 6-275 F204 PTPO Single-axis pulse output by table 6-278 F205 CLLM Closed loop locating management 6-281 F206 VSPO Pulse with variable speed 6-287 F207 ICF Change frequency immediately 6-291 F208 CSFO Cut speed and follow output 6-293 F209 SLCH Select channel 6-295 F210 LINI Tri-axis absolute linear interpolation 6-296 F211 LINA Tri-axis absolute linear interpolation 6-299 F212 CIMI Dual-axis relative oval interpolation 6-302 F213 CIMA Dual-axis absolute oval interpolation 6-305

6-266 Chapter 6 Interpretation of Application Instructions Pulse output

F200 PPMI dual-axis relative point-to-point movement F Dual-axis relative PPMI S1· S2· S3· D1· D2· 200 D point-to-point movement

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * S3· * * * * D1· * * * D2· * * * Note 1:AP300 series supports data register W. Note 2:AP100 series doesn't support the instruction. Instruction Format · · · · · DPPMI S1 S2 S3 D1 D2 S1· :Number of X-axis pulse output. S2· :Number of Y-axis pulse output. S3· :Maximum point-to-point output frequency. D1· :X-axis pulse output direction. D2· :Y-axis pulse output direction. Function 1. The channels of X-axis and Y-axis are specified by the instruction SLCH, which could be specified as channel Y0(X-axis), Y1(Y-axis), or channel Y2(X-axis), Y3(Y-axis). The current value register of pulse is (D8141,D8140) for Y0, (D8143,D8142) for Y1, (D8191,D8190) for Y2 and (D8201,D8200) for Y3. Note:For AP200, it can be only specified as channel Y0(X-axis), Y1(Y-axis). 2. When channel Y2, Y3 are selected, the minimum output frequency can't be smaller than 12Hz. It is recommended setting the output frequency≥1K. 3. S1· and S2· stand for the numbers of pulse output specified by X-axis and Y-axis(relative specifying) respectively, with the output range of ﹣ 2,147,483,648~ ﹢ 2,147,483,647, wherein the positive/negative number represents forward/reverse direction. When the direction is forward, the current value register of the pulse will be increase, and vice verse. 4. D1· and D2· are respectively the direction of X-axis and Y-axis. When the direction is forward, it will be ON. When the direction is reverse, it will be OFF. When there is output on the direction signal, it won't be OFF immediately after the pulse output ends. Instead, the direction signal will be OFF after the instruction condition contact is OFF.

6-267 Chapter 6 Interpretation of Application Instructions Pulse output

5. When channel Y0, Y1 are selected, D8145 is for setting the start/end frequency of point-to-point movement, while D8148 is for setting the acceleration time for the dual-axis movement, and D8157 is for setting the deceleration time for the dual-axis movement(When the deceleration time is equal to the acceleration time in AP200, the value of D8148 will be used). When channel Y2, Y3 are selected, D8195 is for setting the the start/end frequency of point-to-point movement, while D8198 is for setting the acceleration time for the dual-axis movement , and D8199 is for setting the deceleration time for the dual-axis movement . The setting of the acceleration/deceleration time can't be lower than 30ms. The value lower than 30ms will be set as 30ms. The factory default value is 100ms. 6. When channel Y0, Y1 are selected, the maximum output frequency is set through (D8147,D8146). When channel Y2, Y3 are selected, the maximum output frequency is set through (D8197,D8196). The maximum output frequency lower than 100Hz will be set as 100Hz, and the frequency larger than 200Hz will be set as 200Hz. 7. When the instruction of dual-axis synchronous movement is enabled, it doesn't support immediately stop flag to stop the pulse output. The immediately stop flag of channel Y0 is M8145, which is M8146 for Y1, M8155 for Y2 and M8156 for Y3. To stop pulse output immediately, please shut down the condition contact. 8. There is no restriction set on the using times of the instruction. However, if the output of Y-axis(Y1) is in use, it will fail to output for X and Y axis. 9. When the dual-axis output is finished, it will be indicated by setting M8029=ON.

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of dual-axis pulse output. ● M8143:Flag of finishing execution of Y0 pulse output. ● M8144:Flag of finishing execution of Y1 pulse output. ● M8147:Flag of executing Y0 pulse output. ● M8148:Flag of executing Y1 pulse output. ● M8153:Flag of finishing execution of Y2 pulse output. ● M8154:Flag of finishing execution of Y3 pulse output. ● M8157:Flag of executing Y2 pulse output. ● M8158:Flag of executing Y3 pulse output. 2. Description of special registers ● D8140, D8141: The current value register of the pulse output Y0 of dual-axis movement, and the current value will be increased or decreased according to the output direction, D8141(High bit), D8140(Low bit). ● D8142, D8143: The current value register of the pulse output Y1 of dual-axis movement,

6-268 Chapter 6 Interpretation of Application Instructions Pulse output

and the current value will be increased or decreased according to the output direction, D81413(High bit), D8142(Low bit). ● D8190, D8191: The current value register of the pulse output Y2 of dual-axis movement, and the current value will be increased or decreased according to the output direction, D8191(High bit), D8190(Low bit). ● D8200, D8201: The current value register of the pulse output Y3 of dual-axis movement, and the current value will be increased or decreased according to the output direction, D820(High bit), D8200(Low bit). ● D8146, D8147:When the channel Y0,Y1 are selected, it indicates the maximum speed of PPMI and PPMA, which is used to restrict the maximum value of the linear speed. ● D8196, D8197:When the channel Y2,Y3 are selected, it indicates the maximum speed of PPMI and PPMA, which is used to restrict the maximum value of the linear speed. ● D8145:When the channel Y0,Y1 are selected, it indicates the base speed of PPMI and PPMA, which is used to restrict the minimum value of the linear speed. ● D8195:When the channel Y2,Y3 are selected, it indicates the base speed of PPMI and PPMA, which is used to restrict the minimum value of the linear speed. ● D8148:When the channel Y0,Y1 are selected, it indicates the acceleration time of linear movement (The time taken when accelerating from the base speed to the maximum speed, while the actual acceleration time is determined by the value of S3. in proportion). ● D8157:When the channel Y0,Y1 are selected, it indicates the deceleration time of linear movement (The time taken when decelerating from the maximum speed to the base speed, while the actual deceleration time is determined by the value of S3. in proportion). AP300 supports the separation of acceleration and deceleration time, which this function is not supported by AP200, which uses the value of D8148 for both. ● D8198:When the channel Y2,Y3 are selected, it indicates the acceleration time of linear movement (The time taken when accelerating from the base speed to the maximum speed, while the actual acceleration time is determined by the value of S3. in proportion). ● D8199:When the channel Y2,Y3 are selected, it indicates the deceleration time of linear movement (The time taken when decelerating from the maximum speed to the base speed, while the actual deceleration time is determined by the value of S3. in proportion).

6-269 Chapter 6 Interpretation of Application Instructions Pulse output

F201 PPMA dual-axis absolute point-to-point movement F Dual-axis absolute PPMA S1· S2· S3· D1· D2· 201 D point-to-point movement

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * S3· * * * * D1· * * * D2· * * * Note 1:AP300 series supports data register W. Note 2:AP100 series doesn't support the instruction. Instruction Format · · · · · DPPMA S1 S2 S3 D1 D2 S1· :Location of X-axis pulse output. S2· :Location of Y-axis pulse output. S3· :Maximum point-to-point output frequency. D1· :X-axis pulse output direction. D2· :Y-axis pulse output direction. Function 1. The channels of X-axis and Y-axis are specified by the instruction SLCH, which could be specified as channel Y0(X-axis), Y1(Y-axis), or channel Y2(X-axis), Y3(Y-axis). The current value register of pulse is (D8141,D8140) for Y0, (D8143,D8142) for Y1, (D8191,D8190) for Y2 and (D8201,D8200) for Y3. Note:For AP200, it can be only specified as channel Y0(X-axis), Y1(Y-axis). 2. When channel Y2, Y3 are selected, the minimum output frequency can't be smaller than 12Hz. It is recommended setting the output frequency≥1K. 3. S1· and S2· stand for the locations of pulse output specified by X-axis and Y-axis respectively, with the output range of ﹣2,147,483,648~﹢2,147,483,647. The current value register of the pulse for S1·-X-axis=the pulse number that need to be output for X-axis actually; the current value register of the pulse for S2·-Y-axis =the pulse number that need to be output for Y-axis actually. The positive/negative difference represents the forward/reverse direction. When the direction is forward, the current value register of the pulse will be increased, and vice versa. 4. D1· and D2· are respectively the direction of X-axis and Y-axis. When the direction is forward, it will be ON. When the direction is reverse, it will be OFF. When there is output on the direction signal, it won't be OFF immediately after the pulse output ends. Instead, the direction signal will

6-270 Chapter 6 Interpretation of Application Instructions Pulse output be OFF after the instruction condition contact is OFF. 5. When channel Y0, Y1 are selected, D8145 is for setting the start/end frequency of point-to-point movement, while D8148 is for setting the acceleration time for the dual-axis movement, and D8157 is for setting the deceleration time for the dual-axis movement(When the deceleration time is equal to the acceleration time in AP200, the value of D8148 will be used). 5. When channel Y2, Y3 are selected, D8195 is for setting the start/end frequency of point-to-point movement, while D8198 is for setting the acceleration time for the dual-axis movement, and D8199 is for setting the deceleration time for the dual-axis movement. The setting of the acceleration/deceleration time can't be lower than 30ms. The value lower than 30ms will be set as 30ms. The factory default value is 100ms. 6. When channel Y0, Y1 are selected, the maximum output frequency is set through (D8147,D8146). When channel Y2, Y3 are selected, the maximum output frequency is set through (D8197,D8196). The maximum output frequency lower than 100Hz will be set as 100Hz, and the frequency larger than 200Hz will be set as 200Hz. 7. When the instruction of dual-axis synchronous movement is enabled, it doesn't support immediately stop flag to stop the pulse output. The immediately stop flag of channel Y0 is M8145, which is M8146 for Y1, M8155 for Y2 and M8156 for Y3.To stop pulse output immediately, please shut down the condition contact. 8. There is no restriction set on the using times of the instruction. However, if the output of Y-axis(Y1) is in use, it will fail to output for X and Y axis. 9. When the dual-axis output is finished, it will be indicated by setting M8029=ON.

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of dual-axis pulse output. ● M8143:Flag of finishing execution of Y0 pulse output. ● M8144:Flag of finishing execution of Y1 pulse output. ● M8147:Flag of executing Y0 pulse output. ● M8148:Flag of executing Y1 pulse output. ● M8153:Flag of finishing execution of Y2 pulse output. ● M8154:Flag of finishing execution of Y3 pulse output. ● M8157:Flag of executing Y2 pulse output. ● M8158:Flag of executing Y3 pulse output. 2. Description of special registers ● D8140, D8141: The current value register of the pulse output Y0 of dual-axis movement, and the current value will be increased or decreased according to the output direction, D8141(High bit), D8140(Low bit).

6-271 Chapter 6 Interpretation of Application Instructions Pulse output

● D8142, D8143: The current value register of the pulse output Y1 of dual-axis movement, and the current value will be increased or decreased according to the output direction, D81413(High bit), D8142(Low bit). ● D8190, D8191: The current value register of the pulse output Y2 of dual-axis movement, and the current value will be increased or decreased according to the output direction, D8191(High bit), D8190(Low bit). ● D8200, D8201: The current value register of the pulse output Y3 of dual-axis movement, and the current value will be increased or decreased according to the output direction, D820(High bit), D8200(Low bit). ● D8146, D8147:When the channel Y0,Y1 are selected, it indicates the maximum speed of PPMI and PPMA, which is used to restrict the maximum value of the linear speed. ● D8196, D8197:When the channel Y2,Y3 are selected, it indicates the maximum speed of PPMI and PPMA, which is used to restrict the maximum value of the linear speed. ● D8145:When the channel Y0,Y1 are selected, it indicates the base speed of PPMI and PPMA, which is used to restrict the minimum value of the linear speed. ● D8195:When the channel Y2,Y3 are selected, it indicates the base speed of PPMI and PPMA, which is used to restrict the minimum value of the linear speed. ● D8148:When the channel Y0,Y1 are selected, it indicates the acceleration time of linear movement (The time taken when accelerating from the base speed to the maximum speed, while the actual acceleration time is determined by the value of S3. in proportion). ● D8157:When the channel Y0,Y1 are selected, it indicates the deceleration time of linear movement (The time taken when decelerating from the maximum speed to the base speed, while the actual deceleration time is determined by the value of S3. in proportion). AP300 supports the separation of acceleration and deceleration time, which this function is not supported by AP200, which uses the value of D8148 for both. ● D8198:When the channel Y2,Y3 are selected, it indicates the acceleration time of linear movement (The time taken when accelerating from the base speed to the maximum speed, while the actual acceleration time is determined by the value of S3. in proportion). ● D8197:When the channel Y2,Y3 are selected, it indicates the deceleration time of linear movement (The time taken when decelerating from the maximum speed to the base speed, while the actual deceleration time is determined by the value of S3. in proportion).

6-272 Chapter 6 Interpretation of Application Instructions Pulse output

F202 CWI dual-axis relative circular interpolation F Dual-axis relative circular CWI S1· S2· S3· S4· S5· 202 D interpolation

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * S3· * * * * S4· * * * * S5· * * * * Note 1:AP300 series supports data register W. Note 2:AP100/AP200 series doesn't support the instruction. Instruction Format · · · · · DCWI S1 S2 S3 S4 S5 S1· :Number of X-axis pulse output. S2· :Number of Y-axis pulse output. S3· :Location of circle center on X-axis. S4 :Location of circle center on Y-axis. S5· : Speed and circular direction. Function 1. The channels of X-axis and Y-axis are specified by the instruction SLCH, which could be specified as channel Y0(X-axis), Y1(Y-axis), or channel Y2(X-axis), Y3(Y-axis). The current value register of pulse is (D8141,D8140) for Y0, (D8143,D8142) for Y1, (D8191,D8190) for Y2 and (D8201,D8200) for Y3. 2. The direction of pulse output is specified by the channel. The direction bit of channel Y0 is Y4, which is Y5 for channel Y1, Y6 for channel Y2 and Y7 for channel Y3. 3. When channel Y2, Y3 are selected, the minimum output frequency can't be smaller than 12Hz. It is recommended setting the output frequency≥1K. 4. When channel Y0, Y1 are selected, if Y0 or Y1 is occupied, the instruction won't be enabled. When channel Y2, Y3 are selected, if Y2 or Y3 is occupied, the instruction won't be enabled. 5. If channel Y0, Y1 are selected, the position of the start point on X-axis is (D8141,D8140), and (D8143,D8142) on Y-axis. If channel Y2, Y3 are selected, the position of the start point on X-axis is (D8191,D8190), and (D8201,D8200) on Y-axis. 6. S1· and S2· stand for the numbers of pulse output specified for X-axis and Y-axis respectively, with the range of ﹣2,147,483,648 ~﹢2,147,483,647. When pulse numbers specified for the X-axis and Y-axis are both 0, it indicates a whole circle will be drawn. 7. S3· and S4· stand for the location of the circle center on X-axis and Y-axis respectively, with the range of ﹣2,147,483,648 ~﹢2,147,483,647.

6-273 Chapter 6 Interpretation of Application Instructions Pulse output

The radius shall be ranged from 100 to 1,000,000,000. 8. The distance from the start position to the circle center shall be approximately equal to the distance from the destination position to the circle center (With the error no more than 1/1000). 9. The high 16-bit S5+1 of the 32-bit value S5. represents the time of drawing the circular, which is in 10ms. The time is restricted by the maximum frequency of the pulse. If the frequency of the actual operation is larger than 200K, it will be operated as 200K. In this case, it will take longer time. The low 16-bit S5+0 represents the direction of drawing the circular. 0 indicates the clockwise direction, while 1 indicates the counter-clockwise direction.The direction value larger than 1 will be regarded as 1. 10. If no setting for the start frequency and acceleration/deceleration time, there will be no acceleration/deceleration during the action. 11. The direction of X-axis and Y-axis will be changed during the circular movement. To reflect the direction number timely, the direction of X-axis and Y-axis is changed during the interruption. Thus, the value Y indicating the direction will be changed out of the program during a scan cycle.

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of dual-axis pulse output. ● M8143:Flag of finishing execution of Y0 pulse output. ● M8144:Flag of finishing execution of Y1 pulse output. ● M8147:Flag of executing Y0 pulse output. ● M8148:Flag of executing Y1 pulse output. ● M8153:Flag of finishing execution of Y2 pulse output. ● M8154:Flag of finishing execution of Y3 pulse output. ● M8157:Flag of executing Y2 pulse output. ● M8158:Flag of executing Y3 pulse output. 2. Description of special registers ● (D8141,D8140): The current value register of the pulse output Y0, and the current value will be increased or decreased according to the output direction. ● (D8143,D8142): The current value register of the pulse output Y1, and the current value will be increased or decreased according to the output direction. ● (D8191,D8190): The current value register of the pulse output Y2, and the current value will be increased or decreased according to the output direction. ● (D8201,D8200): The current value register of the pulse output Y3, and the current value will be increased or decreased according to the output direction.

6-274 Chapter 6 Interpretation of Application Instructions Pulse output

F203 CWA dual-axis absolute circular interpolation F Dual-axis absolute circular CWA S1· S2· S3· S4· S5· 203 D interpolation

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * S3· * * * * S4· * * * * S5· * * * * Note 1:AP300 series supports data register W. Note 2:AP100/AP200 series doesn't support the instruction. Instruction Format · · · · · DCWA S1 S2 S3 S4 S5 S1· :Destination location of X-axis pulse output. S2· :Destination location of Y-axis pulse output. S3· :Location of circle center on X-axis. S4 :Location of circle center on Y-axis. S5· : Speed and circular direction. Function 1. The channels of X-axis and Y-axis are specified by the instruction SLCH, which could be specified as channel Y0(X-axis), Y1(Y-axis), or channel Y2(X-axis), Y3(Y-axis). The current value register of pulse is (D8141,D8140) for Y0, (D8143,D8142) for Y1, (D8191,D8190) for Y2 and (D8201,D8200) for Y3. 2. The direction of pulse output is specified by the channel. The direction bit of channel Y0 is Y4, which is Y5 for channel Y1, Y6 for channel Y2 and Y7 for channel Y3. 3. When channel Y2, Y3 are selected, the minimum output frequency can't be smaller than 12Hz. It is recommended setting the output frequency≥1K. 4. When channel Y0, Y1 are selected, if Y0 or Y1 is occupied, the instruction won't be enabled. When channel Y2, Y3 are selected, if Y2 or Y3 is occupied, the instruction won't be enabled. 5. If channel Y0, Y1 are selected, the position of the start point on X-axis is (D8141,D8140), and (D8143,D8142) on Y-axis. If channel Y2, Y3 are selected, the position of the start point on X-axis is (D8191,D8190), and (D8201,D8200) on Y-axis. 6. S1· and S2· stand for the destination locations of pulse output specified for X-axis and Y-axis respectively, with the range of ﹣2,147,483,648 ~﹢2,147,483,647. When the destination location is equal to the start location, it indicates drawing a whole

6-275 Chapter 6 Interpretation of Application Instructions Pulse output circle. 7. S3· and S4· stand for the location of the circle center on X-axis and Y-axis respectively, with the range of ﹣2,147,483,648 ~﹢2,147,483,647. The radius shall be ranged from 100 to 1,000,000,000. 8. The distance from the start position to the circle center shall be approximately equal to the distance from the destination position to the circle center (With the error no more than 1/1000). 9. The high 16-bit S5+1 of the 32-bit value S5. represents the time of drawing the circular, which is in 10ms. The time is restricted by the maximum frequency of the pulse. If the frequency of the actual operation is larger than 200K, it will be operated as 200K. In this case, it will take longer time. The low 16-bit S5+0 represents the direction of drawing the circular. 0 indicates the clockwise direction, while 1 indicates the counter-clockwise direction.The direction value larger than 1 will be regarded as 1. 10. If no settings for the start frequency and acceleration/deceleration time, there will be no acceleration/deceleration during the action process. 11. The direction of X-axis and Y-axis will be changed during the circular movement. To reflect the direction number timely, the direction of X-axis and Y-axis is changed during the interruption. Thus, the value Y indicating the direction will be changed out of the program during a scan cycle.

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of dual-axis pulse output. ● M8143:Flag of finishing execution of Y0 pulse output. ● M8144:Flag of finishing execution of Y1 pulse output. ● M8147:Flag of executing Y0 pulse output. ● M8148:Flag of executing Y1 pulse output. ● M8153:Flag of finishing execution of Y2 pulse output. ● M8154:Flag of finishing execution of Y3 pulse output. ● M8157:Flag of executing Y2 pulse output. ● M8158:Flag of executing Y3 pulse output. 2. Description of special registers ● (D8141,D8140): The current value register of the pulse output Y0, and the current value will be increased or decreased according to the output direction. ● (D8143,D8142): The current value register of the pulse output Y1, and the current value will be increased or decreased according to the output direction. ● (D8191,D8190): The current value register of the pulse output Y2, and the current value will be increased or decreased according to the output direction. ● (D8201,D8200): The current value register of the pulse output Y3, and the current value

6-276 Chapter 6 Interpretation of Application Instructions Pulse output

will be increased or decreased according to the output direction.

6-277 Chapter 6 Interpretation of Application Instructions Pulse output

F204 PTPO single-axis pulse output by table F Single-axis pulse output by PTPO S1· S2 D· 204 D table

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * S2 * * D· * Note 1:AP300 series supports data register W. Note 2:AP100 series doesn't support the instruction. Instruction Format · · DPTPO S1 S2 D S1· :Start position of the source. S2 :Section number. D· :Number of pulse output object. Function 1. According to the content of the section number S2+0, each section occupies 4 D registers(S1· +0)、(S1·+1)、(S1·+2)、(S1·+3), which are taken as two 32-bit registers respectively. Wherein, (S1·+1),(S1·+0) are for setting of the output frequency, while(S1·+3), (S1·+2) are the number of pulse output for the said frequency. 2. The frequency output range of S1. is 1Hz~200,000Hz. 2. When channel Y2, Y3 are selected, the minimum output frequency can't be smaller than 12Hz. It is recommended setting the output frequency≥1K. 3. S2+0:It is for setting the number of sections(The setting range: 1~200. If it is beyond the range, it will lead to instruction error). S2+1: It is for displaying the section number in execution currently. Every time the program executes the instruction, the instruction will automatically update the section number in execution currently. 4. D· is the pulse output device. For AP200, only the output points of Y0 and Y1 can be specified. For AP300, Y0~Y3 can be specified. The instruction can only provide pulse output control. The direction control requires the user to program additionally. 5. The instruction doesn't provide the function of acceleration/deceleration. Therefore, when the instruction is disabled, the pulse output will be stopped immediately. 6. In each program scan, channel Y0, Y1, Y2 and Y3 can be only executed by one instruction. However, there is no restriction set on the using times of the instruction. 7. When it starts to execute the instruction, the user is not allow to update the setting value of the section frequency or number. Even if the value is change, it won't change the actual output.

6-278 Chapter 6 Interpretation of Application Instructions Pulse output

For example: X000 DPTPO D0 D300 Y0

1. When X0 =ON, it will output according to the frequency and pulse number set for each section by the user. 2. Table format S2=D300, section number S1·=D0, frequency value S1·=D0, output number (D300=K40) (S1·+0) (S1·+2) K1(Section 1) D1,D0 D3,D2 K2(Section 2) D5,D4 D7,D6 : : : K40(Section 40) D157,D156 D159,D158 3. The section number in execution currently can be viewed in the register D301. 4. The pulse output curve is shown as below:

Frequency (Hz) (D239,D238) (D237,D236) …... …... (D5,D4) (D7,D6) (D1,D0) (D3,D2) Time (s) t… t60 t1 t2

wherein, t1=(D3,D2)÷(D1,D0);t2=(D7,D6)÷(D5,D4);t60=(D239,D238)÷(D237,D236).

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of pulse output. ● M8143:Flag of finishing execution of Y000 pulse output. ● M8144:Flag of finishing execution of Y001pulse output. ● M8153:Flag of finishing execution of Y002 pulse output. ● M8154:Flag of finishing execution of Y003 pulse output. ● M8145:Flag of stopping Y000 pulse output. ● M8146:Flag of stopping Y001 pulse output. ● M8155:Flag of stopping Y002 pulse output. ● M8156:Flag of stopping Y003 pulse output. ● M8147:Flag of executing Y000 pulse output. ● M8148:Flag of executing Y001 pulse output.

6-279 Chapter 6 Interpretation of Application Instructions Pulse output

● M8157:Flag of executing Y002 pulse output. ● M8158:Flag of executing Y003 pulse output. ● M8149:Enable synchronous output of Y000 and Y001. 2. Description of special registers ● (D8141,D8140): The current value register of the pulse for Y0 output. ● (D8143,D8144): The current value register of the pulse for Y1 output. ● (D8191,D8190): The current value register of the pulse for Y2 output. ● (D8201,D8200): The current value register of the pulse for Y3 output.

6-280 Chapter 6 Interpretation of Application Instructions Pulse output

F205 CLLM closed loop locating management F Closed loop locating CLLM S1· S2· S3· D1· D2· 205 D management

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * S2· * * * * S3· * * * * D1· * D2· * * * Note 1:AP300 series supports data register W. Note 2:AP100 series doesn't support the instruction. Instruction Format · · · · · DCLLM S1 S2 S3 D1 D2 S1· :Source device of feedback. S2· :Number of feedback destinations. S3· :Frequency of output destination. D1· :Number of pulse output object. D2· :Pulse output direction. Function 1. Interruption list corresponding to S1·: The source device is X X0 X1 X2 X3 X4 X5 Interruption No. I00* I10* I20* I30* I40* I50* *=1:Trigger rising edge;*=0:Trigger falling edge The source device is C C235~C255 Interruption No. I010 I020 I030 I040 I050 I060 a) When S1·chooses the input point X, after the pulse output reaches the feedback destination number set in S2., it will continue to output based on the preset frequency for the last speed section until the interruption is generated in the input point X. b) When the source device S1. selects the high-speed counter, after the pulse output reaches the feedback destination number set in S2., it will continue to output based on the preset frequency for the last speed section until the feedback pulse reaches the preset feedback destination number. Then the pulse output will be stopped immediately. c) S1. could be the high-speed counter C or the external interruption input point X. If device C is selected, it shall firstly enable the high-speed counting function with the instruction OUT

6-281 Chapter 6 Interpretation of Application Instructions Pulse output

C***, and enable high-speed interruption with the interruption service program. If the external interruption point X is selected, it shall enable the external interruption function with the instruction EI and the interruption service program I0*0. d) When S1. uses the counter, it needs to enable the high-speed interruption by writing the instruction DHSCS in the program. Moreover, the number of the high-speed counter C used by the instruction DHSCS shall be the same as that specified by DCLLM. 2. Range of S2· output number: ﹣ 2,147,483,648~ ﹢ 2,147,483,647 ( ﹢ / ﹣ represent forward/inverse direction). When the direction is forward, the current value register of the pulse will be increased, and vice versa. 3. S3. : Output destination frequency. The value higher than 200Kz will be set as 200Hz. When channel Y0, Y1 are selected, the value smaller than 1Hz will be set as 1Hz; when channel Y2, Y3 are selected, the value smaller than 12Hz will be set as 12Hz; when channel Y2, Y3 are used, it is recommended that the output frequency ≥1K. 4. Regarding the D1. pulse output device, AP200 can only specify Y0 and Y1, while AP300 can specify Y0~Y3. When output is ON for the direction signal, it won't be OFF immediately after the pulse output ends. Instead, the direction signal will be OFF after the instruction condition contact is OFF. 5. When channel Y0 is used, the register for setting the start/end frequency is D8145; When channel Y1 is used, the register for setting the start/end frequency is D8145 in AP200, which is D8165 for AP300; When channel Y2 is used, the register for setting the start/end frequency is D8195; When channel Y3 is used, the register for setting the start/end frequency is D8205. The minimum start/end frequency setting is 0Hz, which is 500Hz by default. 6. When channel Y0 is selected, the register for setting the acceleration time is D8148, and the register for setting the deceleration time is D8157. When channel Y1 is used, the register for setting the acceleration/deceleration time is D8148 in AP200. In AP300, the register for setting the acceleration time is D8168, and the register for setting the deceleration time is D8169. When channel Y2 is selected, the register for setting the acceleration time is D8198, and the register for setting the deceleration time is D8199. When channel Y3 is selected, the register for setting the acceleration time is D8208, and the register for setting the deceleration time is D8209. AP200 uses the same register for setting the acceleration time and deceleration time. The register of acceleration time is D8148 for channel Y0 for example. The setting of the acceleration/deceleration time can't be lower than 30ms. The value lower than 30ms will be set as 30ms. The factory default value is 100ms. 7. When channel Y0 is selected, the output/input ratio register of the closed loop control is D8151.

6-282 Chapter 6 Interpretation of Application Instructions Pulse output

When channel Y1 is selected, the output/input ratio register of the closed loop control is D8152. When channel Y2 is selected, the output/input ratio register of the closed loop control is D8155. When channel Y3 is selected, the output/input ratio register of the closed loop control is D8156. K1 indicates the number of input pulse for the feedback destination is 100, while the number of output pulse is 1; K200 indicates the number of input pulse for the feedback destination is 100, while the number of output pulse is 200. The range of setting value is K1~K10,000. 8. When the external interruption is used, to prevent the failure of interruption, the register of idle-speed pulse number could be used to restrict the total number of output pulse under idle speed. When the register of idle-speed pulse number =0, it indicates the function is disabled. The factory default value is 0. When channel 0 is selected, the register of idle-speed pulse number is D8149. When channel 1 is selected, the register of idle-speed pulse number is D8150. When channel 2 is selected, the register of idle-speed pulse number is D8153. When channel 3 is selected, the register of idle-speed pulse number is D8154.

Description of closed loop action 1. Function: It is used to stop the high-speed pulse immediately according to the feedback counting pulse or the external interruption signal. 2. Action diagram:

Frequency C high-speed counts=Feedback target number or External interruption generation Target frequency

Start ending frequency Times

Acceleration Deceleration High-speed time time time Idle-speed time

Output number= Feedback target number? Proportional value/100 3. The principles of adjusting the time of finishing locating are as follows: a) The so-called time of finishing locating refers to "acceleration+high-speed+deceleration +idle speed"(See the figure above). For example, when the proportional value is adjusted, it will increase/decrease the total number of the pulse output. In this way, it further decreases/increases the time of finishing locating.

6-283 Chapter 6 Interpretation of Application Instructions Pulse output

b) When the external interruption is used, to prevent the failure of interruption, the register of idle-speed pulse number could be used to restrict the total number of output pulse under idle speed. User may judge whether the execution result is good according to the time of actual idle-speed. Technically, it is good if each time of finishing locating includes a little idle-speed time.

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of pulse output. ● M8143:Flag of finishing execution of Y000 pulse output. ● M8144:Flag of finishing execution of Y001pulse output. ● M8153:Flag of finishing execution of Y002 pulse output. ● M8154:Flag of finishing execution of Y003 pulse output. ● M8145:Flag of stopping Y000 pulse output. ● M8146:Flag of stopping Y001 pulse output. ● M8155:Flag of stopping Y002 pulse output. ● M8156:Flag of stopping Y003 pulse output.. ● M8147:Flag of executing Y000 pulse output. ● M8148:Flag of executing Y001 pulse output. ● M8157:Flag of executing Y002 pulse output. ● M8158:Flag of executing Y003 pulse output. ● M8149:Enable synchronous output of Y000 and Y001.

2. Description of special registers ● D8140, D8141:Register of the current value for the pulse of Y0 channel output, D8141(high bit), D8140(low bit). ● D8142, D8143:Register of the current value for the pulse of Y1 channel output, D8143(high bit), D8142(low bit). ● D8190, D8191:Register of the current value for the pulse of Y2 channel output, D8191(high bit), D8190(low bit). ● D8200, D8201:Register of the current value for the pulse of Y3 channel output, D8201(high bit), D8200(low bit). ● D8146, D8147:For AP200, when the channel Y0,Y1 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. For AP300, when the channel Y0 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. ● D8166, D8167: For AP300, when the channel Y1 is selected, it indicates the maximum

6-284 Chapter 6 Interpretation of Application Instructions Pulse output

speed, which is used to restrict the maximum value of the pulse speed. For AP200, the accelerating/decelerating parameters of channel Y1 and Y0 of AP200 share the same registers. ● D8196, D8197: When the channel Y2 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. ● D8206, D8207: When the channel Y3 is selected, it indicates the maximum speed, which is used to restrict the maximum value of the pulse speed. ● D8145:For AP200, when channel Y0,Y1 are selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. For AP300, when channel Y0 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. ● D8165:For AP300, when channel Y1 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. For AP200, the base speed parameters of channel Y1 and Y0 of AP200 share the same registers. ● D8195: When channel Y2 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. ● D8205: When channel Y3 is selected, it indicates the base speed, which is used to restrict the minimum value of the pulse speed. ● D8148:For AP200, when channel Y0,Y1 are selected, it indicates the time of accelerating from the base speed to the maximum speed. For AP300, when channel Y0 is selected, it indicates the time of accelerating from the base speed to the maximum speed. ● D8168:For AP300, when the channel Y1 is selected, it indicates the time of accelerating from the base speed to the maximum speed. For AP200, the acceleration parameters of channel Y1 and Y0 of AP200 share the same registers. ● D8198:When channel Y2 is selected, it indicates the time of accelerating from the base speed to the maximum speed. ● D8208:When channel Y2 is selected, it indicates the time of accelerating from the base speed to the maximum speed. ● D8157:For AP300, when channel Y0 is selected, it indicates the time of decelerating from the base speed to the maximum speed. ● D8169:For AP300, when channel Y1 is selected, it indicates the time of decelerating from the base speed to the maximum speed. ● D8199:For AP300, when channel Y2 is selected, it indicates the time of decelerating from the base speed to the maximum speed. ● D8209:For AP300, when the channel Y3 is selected, it indicates the time of decelerating from the base speed to the maximum speed. ● D8149: Idle-speed steps of channel Y0 when CLLM is executed.

6-285 Chapter 6 Interpretation of Application Instructions Pulse output

● D8150: Idle-speed steps of channel Y1 when CLLM is executed. ● D8153: Idle-speed steps of channel Y2 when CLLM is executed. ● D8154: Idle-speed steps of channel Y3 when CLLM is executed. ● D8151: Proportion of feedback number for channel Y0 when CLLM is executed. ● D8152: Proportion of feedback number for channel Y1 when CLLM is executed. ● D8155: Proportion of feedback number for channel Y2 when CLLM is executed. ● D8156: Proportion of feedback number for channel Y3 when CLLM is executed.

6-286 Chapter 6 Interpretation of Application Instructions Pulse output

F206 VSPO pulse with variable speed F VSPO Pulse with variable speed S1· S2· S3· D1· D2· 206 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * S2· * * * * S3· * * * * D1· * D2· * * * Note 1:AP300 series supports data register W. Note 2:AP100 series doesn't support the instruction. Instruction Format · · · · · DVSPO S1 S2 S3 D1 D2 S1· :Frequency of output destination. S2· :Number of output destination. S3· :Interval frequency and time setting for acceleration/deceleration. D1· :Number of pulse output object. D2· :Pulse output direction. Function 1. S1. : Destination frequency range is 1Hz~200KHz. The value higher than 200Kz will be set as 200Hz. When channel Y0, Y1 are selected, the value smaller than 1Hz will be set as 1Hz; when channel Y2, Y3 are selected, the value smaller than 12Hz will be set as 12Hz. When channel Y2, Y3 are used, it is recommended using the output frequency ≥1K. When the instruction is being executed, the destination frequency could be changed. However, after the destination frequency is changed, the instruction will automatically accelerate/decelerate to the destination frequency according to the interval frequency and time set in S3. 2. The number of output destination S2·is only valid when the instruction is enabled for the first time. If the number is changed during the later execution of instruction, it will be invalid. The destination number can be set as negative. When the number of output destination S2·is specified as 0, it will output continuously. 3. The output parameter S3. is for the setting of two 16-bit parameters. Parameter S3·+0 is for specifying the acceleration/deceleration interval frequency, while parameter S3· + 1 is for specifying the acceleration/deceleration interval time. The interval frequency and time can be both changed during the execution of the instruction. The input range of the interval frequency is 1Hz~32767Hz; the input range of interval time is 1ms~80ms; If the input value is beyond this

6-287 Chapter 6 Interpretation of Application Instructions Pulse output

range, it will be executed based on the maximum or minimum value automatically. 4. As for the output device D1., AP200 only supports output of Y0 and Y1, while AP300 supports Y0~Y3. 5. When the instruction is being executed, only when the destination frequency is change, will the interval frequency and interval time will be changed accordingly.

6. Function description

The pulse output diagram is shown in the right: Frequency t2 The symbols in the diagram are defined as: t1:The destination frequency of section 1 t1 t2:The destination frequency of section 2 t3 t3:The destination frequency of section 3 Times g1:Auto acceleration time of section 1 g1 g2 g3 g2:Auto acceleration time of section 2 S2 g3:Auto deceleration time of section 3

S2:Total number of output pulse

Section decomposition description: 1. Section 1:Assume t1 is 6Hz, the interval frequency is 1KHz and the interval time is 10ms. The decomposition of section 1 is as shown in the figure below:

Frequency t1=6kHz

1kHz

0Hz Time 10ms10ms10ms 10ms 10ms

g1=50ms

2. Section 2:Assume t2 is 11KHz, the interval frequency is 2KHz and the interval time is 20ms. The decomposition of section 2 is as shown in the figure below:

6-288 Chapter 6 Interpretation of Application Instructions Pulse output

Frequency t2=11kHz 1kHz

2kHz

2kHz t1=6kHz

Time

20ms20ms 20ms

g2=40ms

3. Section 3:Assume t3 is 3KHz, the interval frequency is 2KHz and the interval time is 20ms. The decomposition of section 3 is as shown in the figure below: Frequency Change frequency of t3 t2=11kHz 2kHz

t3=3kHz

Time 20ms 20ms 20ms 20ms

Start g3=60ms changing

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of pulse output. ● M8143:Flag of finishing execution of Y000 pulse output. ● M8144:Flag of finishing execution of Y001 pulse output. ● M8153:Flag of finishing execution of Y002 pulse output. ● M8154:Flag of finishing execution of Y003 pulse output. ● M8145:Flag of stopping Y000 pulse output. ● M8146:Flag of stopping Y001 pulse output. ● M8155:Flag of stopping Y002 pulse output. ● M8156:Flag of stopping Y003 pulse output.. ● M8147:Flag of executing Y000 pulse output. ● M8148:Flag of executing Y001 pulse output. ● M8157:Flag of executing Y002 pulse output. ● M8158:Flag of executing Y003 pulse output.

6-289 Chapter 6 Interpretation of Application Instructions Pulse output

● M8149:Enable synchronous output of Y000 and Y001. 2. Description of special registers ● D8140, D8141:Register of the current value for the pulse of Y0 channel output, D8141(high bit), D8140(low bit). ● D8142, D8143:Register of the current value for the pulse of Y1 channel output, D8143(high bit), D8142(low bit). ● D8190, D8191:Register of the current value for the pulse of Y2 channel output, D8191(high bit), D8190(low bit). ● D8200, D8201:Register of the current value for the pulse of Y3 channel output, D8201(high bit), D8200(low bit).

6-290 Chapter 6 Interpretation of Application Instructions Pulse output

F207 ICF change frequency immediately F ICF Change frequency immediately S1· S2· D· 207 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * S2· * * * * D· * Note 1:AP300 series supports data register W. Note 2:AP100 series doesn't support the instruction. Instruction Format · · · DICF S1 S2 D S1· :Frequency of output destination. S2· :Interval frequency and time setting for acceleration/deceleration. D· :Number of pulse output object. Function 1. S1. : Destination frequency range is 1Hz~200KHz. The value higher than 200Kz will be set as 200Hz. When channel Y0, Y1 are selected, the value smaller than 1Hz will be set as 1Hz; when channel Y2, Y3 are selected, the value smaller than 12Hz will be set as 12Hz. When channel Y2, Y3 are used, it is recommended using the output frequency ≥1K. 2. To execute the instruction normally, it requires enabling the instruction DVSPO. When the instruction is combined with the instruction DVSPO, S1·、S2· and operand D of DICF must use the same device with S1·、S3· and operand D of DVSPO. 3. When the instruction is combined with the instruction DVSPO, the S2. will set the parameters for the interval frequency and time of auto acceleration/deceleration, for which the parameters definition is the same as that of the operand S3. of the instruction DVSPO. 4. As for the output device D1., AP200 only supports output of Y0 and Y1, while AP300 supports Y0~Y3. 5. It is recommended applying the instruction in the interruption service program or sub-program, so as to get good response time and effect. 6. Function description: When the instruction DVSPO is used to change the destination frequency, it will actually change the time point of the frequency, which will be affected by the time and interval of the program scan cycle. Therefore, it can't change the speed timely. The speed change diagram is as shown below:

6-291 Chapter 6 Interpretation of Application Instructions Pulse output

Target Freque frequency Start frequency ncy change changing Interval frequency

Time

Interval Interval

The time is affected by scan time

When the instruction DICF is used to change the destination frequency of the interruption service program, it will actually change the time point of the frequency, which will be only affected by the operation time of the instruction DICF. The speed change diagram is as shown below:

Freque Frequency occurs Start frequency changing ncy

Interval frequency

Time

Interval Interval

Interruption response time

6-292 Chapter 6 Interpretation of Application Instructions Pulse output

F208 CSFO cut speed and follow output F CSFO Cut speed and follow output S1 S2· D1· D2· 208

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1 * S2· * * D1· * * D2· * * * Note 1:AP300 series supports data register W. Note 2:AP100 series doesn't support the instruction. Instruction Format · · · CSFO S1 S2 D1 D2 S1 :Source of input point(only X0~X3, X10~X11 are available). S2· :Setting of input sampling number and display of input speed. D1· :Setting of output speed ratio and display of output speed. D2· :Pulse output direction. Function 1. When the source of input point S1·selects X0, it will only occupy input point X0, and match high-speed output Y0 automatically. When the source of input point S1·selects X1, it will only occupy input point X0(A phase) and input point X1(B phase), and match high-speed output Y0 automatically. When the source of input point S1·selects X2, it will only occupy input point X2, and match high-speed output Y1 automatically. When the source of input point S1·selects X3, it will only occupy input point X2(A phase) and input point X3(B phase), and match high-speed output Y1 automatically. When the source of input point S1·selects X10, it will only occupy input point X10, and match high-speed output Y2 automatically. When the source of input point S1·selects X11, it will only occupy input point X10(A phase) and input point X11(B phase), and match high-speed output Y2 automatically. 2. When the instruction is enabled, it will need to occupy the function of hardware high-speed counting function used by X0,X1,X2,X3,X10,X11. Therefore, if the hardware high-speed counter has been enabled by the high-speed counting function, it will fail to enable the instruction. In addition, if the high-speed output function of the supporting Y0, Y1 or Y2 has been enabled by other instructions, it will still fail to enabled the instruction. 3. When S1. selects X1, X3 or X11 which uses 2-phase and 2-input, the counting mode is 4-time

6-293 Chapter 6 Interpretation of Application Instructions Pulse output counting, which can't be changed 4. When Y0, Y1 and Y2 output pulse, the corresponding special registers of output pulse number (D8141,D8140),(D8143,D8142),(D8191,D8190) will update the number of pulse that has been output automatically. 5. S2· occupies five 16-bit registers continuously; S2·+0 is for setting the number of input retrieval, with the input range: 1-phase 1-input: K1~K100; 2-phase 2-input: K2~K100. When the input is beyond the range, it will be set as the minimum or maximum value. After the instruction is enabled, it won't be accepted if the number of input retrieval is changed. It will take effect after the instruction is enabled for a second time. S2·+2,S2·+1 show the latest value of retrieval speed(Read only), in the unit of 1hz; S2·+4,S2·+3 show the number of 32-bit accumulative input counts (Read-only). 6. The input frequency range is: Input frequency/input sampling number <20K. 7. D1·occupies three 16-bit registers continuously; D1·+0 is for setting the value of output ratio, with the setting range of K1(1%)~K10000(10000%). When the input is beyond the range, it will be set as the minimum or maximum value. The ratio can be changed during the execution of instruction, but it will take effect after the instruction is scanned. D1·+2,D1·+1 show the 32-bit output speed(Read only), in the unit of 1Hz. The output frequency range is ±200KHz. 8. The ratio D1·+0 is input as percentage. Thus, after the sampled input speed multiplies with the output ratio, when the conversion result is lower than 1Hz, it will take 1Hz output pulse. After the sampled number multiplies with the output ratio,, when the conversion result is lower than 1 pulse, it will output 1 pulse after n times of sampling(n×sampling number×output ratio value≥1).

《Description of related devices》 1. Description of flag signals ● M8147:Flag of executing Y000 pulse output. ● M8148:Flag of executing Y001 pulse output. ● M8157:Flag of executing Y002 pulse output. 2. Description of special registers ● D8140, D8141:Register of the current value for the pulse of Y0 channel output, D8141(high bit), D8140(low bit). ● D8142, D8143:Register of the current value for the pulse of Y1 channel output, D8143(high bit), D8142(low bit). ● D8190, D8191:Register of the current value for the pulse of Y2 channel output, D8191(high bit), D8190(low bit).

6-294 Chapter 6 Interpretation of Application Instructions Pulse output

F209 SLCH select channel F SLCH Select channel S1 209

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1 * * Note 1:AP100 series doesn't support the instruction. Note 2:AP200 series 1.1 and above support the instruction. Instruction Format

SLCH S1 S1 :Selected channel. Function 1. The instruction is to specify which channel is used by the instructions of PPMI, PPMA, DCWI, DCWA, DCIMI and DCIMA, Y0, Y1, or Y2, Y3. When S1=0, channel Y0、Y1 are selected; When S1=2, channel Y2、Y3 are selected. 2. If channel is not specified by instruction SLCH, the instructions of PPMI, PPMA, DCWI, DCWA, DCIMI and DCIMA, will use channel Y0, Y1 by default. 3. For AP200, when S1 uses the value rather than 0, it will lead to error of instruction operation For AP2300, when S1 uses the value rather than 0 and 2, it will lead to error of instruction operation

6-295 Chapter 6 Interpretation of Application Instructions Pulse output

F210 LINI tri-axis relative linear interpolation F Tri-axis relative linear LINI S1· S2· S3· S4· 210 D interpolation

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1 * S2· * * D1· * * D2· * * * Note 1:AP300 series supports data register W. Note 2:AP100/AP200 series doesn't support the instruction. Instruction Format · · · · LINI S1 S2 S3 S4 S1· :Number of X-axis pulse output. S2· :Number of Y-axis pulse output. S3· :Number of Z-axis pulse output. S4· :Point-to-point output frequency. Function 1. S1·、S2·、S3 stand for the pulse output number(relative specifying) of X-axis(Y0), Y-axis(Y1) and Z-axis (Y2) respectively, with the output number range of 2,147,483,648 ~﹢2,147,483,647, wherein the positive/negative symbol indicates the forward/inverse direction. The direction of X-axis is Y4, the direction of Y-axis is Y5, and the direction of Z-axis is Y6. When the direction is forward, the current value register of the pulse, Y0 (D8141,D8140),Y1 (D8143,D8142) and Y2 (D8191,D8190), will be increased, and vice versa. 2. The start location of X-axis(Y0) is (D8141,D8140), which is (D8143,D8142) for Y-axis(Y1) and (D8191,D8190) for Z-axis(Y2). 3. S4. is for setting the point-to-point movement speed. There will be acceleration/deceleration during the movement process. 4. D8145 is for setting the start/end point-to-point frequency. D8148 is for setting the acceleration time, D8157 is for setting the deceleration time. The acceleration/deceleration time can't be lower than 30ms. The value lower than 30ms will be set as 30ms, and the factory default value is 100ms. 5. The maximum output frequency (D8147,D8146) lower than 100Hz will be set as 100Hz, and the frequency higher than 200KHz will be set as 200KHz. If the setting value of S4. is beyond the maximum output frequency, S4. will be output with the maximum output frequency.

6-296 Chapter 6 Interpretation of Application Instructions Pulse output

Speed Acceleration Deceleration tim e tim e Max speed

Output pulse frequency S4·

Base speed

Instruction Time execution Finishing of instruction execution M8029 6. When the instruction is enabled, the start frequency of X-axis, Y-axis and Z-axis will take the value set for D8145, the acceleration time will take the value of D8148, the deceleration time will take the value of D8157. In addition, the instruction doesn't support immediately stop flag M8145、M8146 to stop the pulse output. To stop the output pulse, please disable the condition contact. 7. There is no restriction set on the using times of the instruction. However, if the output of X-axis, Y-axis or Z-axis is in use, it will fail to output for XYZ axis. 8. When the tri-axis output is finished, it will be indicated by setting M8029=ON.

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of dual-axis pulse output. ● M8143:Flag of finishing execution of pulse output for X-axis (Y0). ● M8144:Flag of finishing execution of pulse output Y-axis (Y1). ● M8153:Flag of finishing execution of pulse output Z-axis (Y2). ● M8147:Flag of executing pulse output X-axis (Y0). ● M8148:Flag of executing pulse output Y-axis (Y1). ● M8157:Flag of executing pulse output Z-axis (Y2). 2. Description of special registers ● D8140, D8141: The current value register of the pulse output for X-axis(Y0) of tri-axis movement, and the current value will be increased or decreased according to the output direction, D8141(High bit), D8140(Low bit). ● D8142, D8143: The current value register of the pulse output for Y-axis(Y1) of tri-axis movement, and the current value will be increased or decreased according to the output direction, D8143(High bit), D8142(Low bit). ● D8190, D8191: The current value register of the pulse output for Z-axis(Y2) of tri-axis movement, and the current value will be increased or decreased according to the output direction, D8191(High bit), D8190(Low bit). ● D8146、D8147: The maximum speed of LINI,LINA, which is used to restrict the

6-297 Chapter 6 Interpretation of Application Instructions Pulse output

maximum value of the linear speed. ● D8145: The base speed of LINI,LINA, which is used to restrict the minimum value of the linear speed. ● D8148:It indicates the acceleration time (The time taken when accelerating from the base speed to the maximum speed, while the actual acceleration time is determined by the value of S4. in proportion). ● D8157:It indicates the deceleration time (The time taken when decelerating from the maximum speed to the base speed, while the actual deceleration time is determined by the value of S4. in proportion).

6-298 Chapter 6 Interpretation of Application Instructions Pulse output

F211 LINI tri-axis absolute linear interpolation F Tri-axis absolute linear LINA S1· S2· S3· S4· 211 D interpolation

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * S3· * * * * S4· * * * * Note 1:AP300 series supports data register W. Note 2:AP100/AP200 series doesn't support the instruction. Instruction Format · · · · LINA S1 S2 S3 S4 S1· :Destination location of X-axis pulse output. S2· :Destination location of Y-axis pulse output. S3· :Destination location of Z-axis pulse output. S4· :Point-to-point output frequency. Function 1. S1· 、 S2· 、 S3 stand for the pulse output destination location(absolute specifying) of X-axis(Y0), Y-axis(Y1) and Z-axis (Y2) respectively, with the output number range of 2,147,483,648 ~﹢2,147,483,647. 2. The start location of X-axis(Y0) is (D8141,D8140), which is (D8143,D8142) for Y-axis(Y1) and (D8191,D8190) for Z-axis(Y2). 3. The positive/negative symbol of the destination location-start location indicates the direction. The direction of X-axis is Y4, the direction of Y-axis is Y5, and the direction of Z-axis is Y6. When the direction is forward, the current value register of the pulse, Y0 (D8141,D8140),Y1 (D8143,D8142) and Y2 (D8191,D8190), will be increased, and vice versa. 4. S4. is for setting the point-to-point movement speed. There will be acceleration/deceleration during the movement process. 5. D8145 is for setting the start/end point-to-point frequency. D8148 is for setting the acceleration time, D8157 is for setting the deceleration time. The acceleration/deceleration time can't be lower than 30ms. The value lower than 30ms will be set as 30ms, and the factory default value is 100ms. 6. The maximum output frequency (D8147,D8146) lower than 100Hz will be set as 100Hz, and the frequency higher than 200KHz will be set as 200KHz. If the setting value of S4. is beyond the maximum output frequency, S4. will be output with the maximum output frequency.

6-299 Chapter 6 Interpretation of Application Instructions Pulse output

Speed Acceleration Deceleration time time Max speed

Output pulse frequency S4·

Base speed

Instruction Time execution Finishing of instruction execution M8029 7. When the instruction is enabled, the start frequency of X-axis, Y-axis and Z-axis will take the value set for D8145, the acceleration time will take the value of D8148, the deceleration time will take the value of D8157. In addition, the instruction doesn't support immediately stop flag M8145、M8146 to stop the pulse output. To stop the output pulse, please disable the condition contact. 8. There is no restriction set on the using times of the instruction. However, if the output of X-axis, Y-axis or Z-axis is in use, it will fail to output for XYZ axis. 9. When the tri-axis output is finished, it will be indicated by setting M8029=ON.

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of dual-axis pulse output. ● M8143:Flag of finishing execution of pulse output for X-axis (Y0). ● M8144:Flag of finishing execution of pulse output Y-axis (Y1). ● M8153:Flag of finishing execution of pulse output Z-axis (Y2). ● M8147:Flag of executing pulse output X-axis (Y0). ● M8148:Flag of executing pulse output Y-axis (Y1). ● M8157:Flag of executing pulse output Z-axis (Y2). 2. Description of special registers ● D8140, D8141: The current value register of the pulse output for X-axis(Y0) of tri-axis movement, and the current value will be increased or decreased according to the output direction, D8141(High bit), D8140(Low bit). ● D8142, D8143: The current value register of the pulse output for Y-axis(Y1) of tri-axis movement, and the current value will be increased or decreased according to the output direction, D8143(High bit), D8142(Low bit). ● D8190, D8191: The current value register of the pulse output for Z-axis(Y2) of tri-axis movement, and the current value will be increased or decreased according to the output direction, D8191(High bit), D8190(Low bit). ● D8146、D8147: The maximum speed of LINI,LINA, which is used to restrict the

6-300 Chapter 6 Interpretation of Application Instructions Pulse output

maximum value of the linear speed. ● D8145: The base speed of LINI,LINA, which is used to restrict the minimum value of the linear speed. ● D8148:It indicates the acceleration time (The time taken when accelerating from the base speed to the maximum speed, while the actual acceleration time is determined by the value of S4. in proportion). ● D8157:It indicates the deceleration time (The time taken when decelerating from the maximum speed to the base speed, while the actual deceleration time is determined by the value of S4. in proportion).

6-301 Chapter 6 Interpretation of Application Instructions Pulse output

F212 CIMI dual-axis relative oval interpolation F Dual-axis relative oval CIMI S1· S2· S3· 212 D interpolation

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * S3· * * * * Note 1:AP300 series supports data register W. Note 2:AP100/AP200 series doesn't support the instruction. Instruction Format · · · DCIMI S1 S2 S3 S1· :Number of X-axis pulse output. S2· :Number of Y-axis pulse output. S3· : Speed and circular direction. Function 1. The channels of X-axis and Y-axis are specified by the instruction SLCH, which could be specified as channel Y0, Y1, or channel Y2, Y3. 2. The direction of pulse output is specified by the channel. The direction bit of channel Y0 is Y4, which is Y5 for channel Y1, Y6 for channel Y2 and Y7 for channel Y3. 3. When channel Y2, Y3 are selected, the minimum output frequency can't be smaller than 12Hz. It is recommended setting the output frequency≥1K. 4. When channel Y0, Y1 are selected, if Y0 or Y1 is occupied, the instruction won't be enabled. When channel Y2, Y3 are selected, if Y2 or Y3 is occupied, the instruction won't be enabled. 5. If channel Y0, Y1 are selected, the position of the start point on X-axis is (D8141,D8140), and (D8143,D8142) on Y-axis. If channel Y2, Y3 are selected, the position of the start point on X-axis is (D8191,D8190), and (D8201,D8200) on Y-axis. 6. S1· and S2· stand for the numbers of pulse output specified by X-axis and Y-axis respectively, with the output range of ﹣2,147,483,648~﹢2,147,483,647. The positive/negative symbol indicates the direction. When the direction is positive, the current values corresponding to X-axis and Y-axis will be increased. When the direction is negative, the current values corresponding to X-axis and Y-axis will be decreased. When there is output on the direction signal, it won't be OFF immediately after the pulse output ends. Instead, the direction signal will be OFF after the instruction condition contact is OFF. 7. The high 16-bit S3+1 of the 32-bit value S3. represents the time of drawing the circular, which is in 10ms. The time is restricted by the maximum frequency of the pulse. If the frequency of the

6-302 Chapter 6 Interpretation of Application Instructions Pulse output actual operation is larger than 200K, it will be operated as 200K. In this case, it will take longer time. The low 16-bit S3+0 represents the direction of drawing the circular. 0 indicates the clockwise direction, while 1 indicates the counter-clockwise direction.The direction value larger than 1 will be regarded as 1. 8. The instruction draws an oval with the angle of 90 degrees. Figure 1 shows the clockwise direction, while figure 2 shows the counter-clockwise direction. The maximum value of r1 and r2 can't be larger than 1,000,000,000, and the minimum value can't be smaller than 100. Y- Y- (S ,S ) (S ,S ) axis 1 2 axis 1 2

r1 r1

X- X- (0,0) (0,0) r2 axis r2 axis

Figure 1 Figure 2 9. If no settings for the start frequency and acceleration/deceleration time, 10. The direction of X-axis and Y-axis will be changed during the oval interpolation. To reflect the direction number timely, the direction of X-axis and Y-axis is changed during the interruption. Thus, the value Y indicating the direction will be changed out of the program during a scan cycle.

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of dual-axis pulse output. ● M8143:Flag of finishing execution of Y0 pulse output. ● M8144:Flag of finishing execution of Y1 pulse output. ● M8147:Flag of executing Y0 pulse output. ● M8148:Flag of executing Y1 pulse output. ● M8153:Flag of finishing execution of Y2 pulse output. ● M8154:Flag of finishing execution of Y3 pulse output. ● M8157:Flag of executing Y2 pulse output. ● M8158:Flag of executing Y3 pulse output. 2. Description of special registers ● D8140, D8141: The current value register of the pulse output Y0, and the current value will be increased or decreased according to the output direction, D8141(High bit), D8140(Low bit). ● D8142, D8143: The current value register of the pulse output Y1, and the current value will

6-303 Chapter 6 Interpretation of Application Instructions Pulse output

be increased or decreased according to the output direction, D8143(High bit), D8142(Low bit). ● D8190, D8191: The current value register of the pulse output Y2, and the current value will be increased or decreased according to the output direction, D8191(High bit), D8190(Low bit). ● D8200, D8201: The current value register of the pulse output Y3, and the current value will be increased or decreased according to the output direction, D8201(High bit), D8200(Low bit).

6-304 Chapter 6 Interpretation of Application Instructions Pulse output

F213 CIMA dual-axis absolute oval interpolation F Dual-axis absolute oval CIMA S1· S2· S3· 213 D interpolation

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * S2· * * * * S3· * * * * Note 1:AP300 series supports data register W. Note 2:AP100/AP200 series doesn't support the instruction. Instruction Format · · · DCIMA S1 S2 S3 S1· :Destination location of X-axis pulse output. S2· :Destination location of Y-axis pulse output. S3· : Speed and circular direction. Function 1. The channels of X-axis and Y-axis are specified by the instruction SLCH, which could be specified as channel Y0, Y1, or channel Y2, Y3. 2. The direction of pulse output is specified by the channel. The direction bit of channel Y0 is Y4, which is Y5 for channel Y1, Y6 for channel Y2 and Y7 for channel Y3. 3. When channel Y2, Y3 are selected, the minimum output frequency can't be smaller than 12Hz. It is recommended setting the output frequency≥1K. 4. When channel Y0, Y1 are selected, if Y0 or Y1 is occupied, the instruction won't be enabled. When channel Y2, Y3 are selected, if Y2 or Y3 is occupied, the instruction won't be enabled. 5. If channel Y0, Y1 are selected, the position of the start point on X-axis is (D8141,D8140), and (D8143,D8142) on Y-axis. If channel Y2, Y3 are selected, the position of the start point on X-axis is (D8191,D8190), and (D8201,D8200) on Y-axis. 6. S1· and S2· stand for the numbers of pulse output specified by X-axis and Y-axis respectively, with the output range of ﹣2,147,483,648~﹢2,147,483,647. The positive/negative symbol of the destination location-start location indicates the direction. When the direction is positive, the current values corresponding to X-axis and Y-axis will be increased. When the direction is negative, the current values corresponding to X-axis and Y-axis will be decreased. When there is output on the direction signal, it won't be OFF immediately after the pulse output ends. Instead, the direction signal will be OFF after the instruction condition contact is OFF. 7. The high 16-bit S3+1 of the 32-bit value S3. represents the time of drawing the circular, which is in 10ms. The time is restricted by the maximum frequency of the pulse. If the frequency of the

6-305 Chapter 6 Interpretation of Application Instructions Pulse output actual operation is larger than 200K, it will be operated as 200K. In this case, it will take longer time. The low 16-bit S3+0 represents the direction of drawing the circular. 0 indicates the clockwise direction, while 1 indicates the counter-clockwise direction.The direction value larger than 1 will be regarded as 1. 8. The instruction draws an oval with the angle of 90 degrees. Figure 1 shows the clockwise direction, while figure 2 shows the counter-clockwise direction. The maximum value of r1 and r2 can't be larger than 1,000,000,000, and the minimum value can't be smaller than 100.

Y-axis (S1,S2) Y-axis (S1,S2)

r1 r1

(0,0) X-axis (0,0) X-axis r2 r2

Figure 1 Figure 2 9. If no settings for the start frequency and acceleration/deceleration time, 10. The direction of X-axis and Y-axis will be changed during the oval interpolation. To reflect the direction number timely, the direction of X-axis and Y-axis is changed during the interruption. Thus, the value Y indicating the direction will be changed out of the program during a scan cycle.

《Description of related devices》 1. Description of flag signals ● M8029:Finishing execution of dual-axis pulse output. ● M8143:Flag of finishing execution of Y0 pulse output. ● M8144:Flag of finishing execution of Y1 pulse output. ● M8147:Flag of executing Y0 pulse output. ● M8148:Flag of executing Y1 pulse output. ● M8153:Flag of finishing execution of Y2 pulse output. ● M8154:Flag of finishing execution of Y3 pulse output. ● M8157:Flag of executing Y2 pulse output. ● M8158:Flag of executing Y3 pulse output. 2. Description of special registers ● D8140, D8141: The current value register of the pulse output Y0, and the current value will be increased or decreased according to the output direction, D8141(High bit), D8140(Low bit). ● D8142, D8143: The current value register of the pulse output Y1, and the current value will

6-306 Chapter 6 Interpretation of Application Instructions Pulse output

be increased or decreased according to the output direction, D8143(High bit), D8142(Low bit). ● D8190, D8191: The current value register of the pulse output Y2, and the current value will be increased or decreased according to the output direction, D8191(High bit), D8190(Low bit). ● D8200, D8201: The current value register of the pulse output Y3, and the current value will be increased or decreased according to the output direction, D8201(High bit), D8200(Low bit).

6-307 Chapter 6 Interpretation of Application Instructions Contact comparison

20 F224~F246 Contact Comparison

Contact comparison Function No. Mnemonic Name Page F224 LD (S1·)=(S2·) F225 LD (S1·)>(S2·) F226 LD (S1·)<(S2·) Contact status 6-309 F228 LD (S1·)≠(S2·) comparison LD F229 LD (S1·)≤(S2·) F230 LD (S1·)≥(S2·) F232 AND (S1·)=(S2·) F233 AND (S1·)>(S2·) Contact status F234 AND (S1·)<(S2·) comparison 6-310 F236 AND (S1·)≠(S2·) AND F237 AND (S1·)≤(S2·) F238 AND (S1·)≥(S2·) F240 OR (S1·)=(S2·) F241 OR (S1·)>(S2·) F242 OR (S1·)<(S2·) Contact status 6-311 F244 OR (S1·)≠(S2·) comparison OR F245 OR (S1·)≤(S2·) F246 OR (S1·)≥(S2·)

6-308 Chapter 6 Interpretation of Application Instructions Contact comparison

F224~F230 contact status comparison LD F LD Contact status comparison LD S1· S2· 224~230 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * Note:AP300 series supports data register W. S1· : Comparison value 1, S2· : Comparison value 2. Function The instruction is used to compare the content of S1· and S2·, and perform computation for the latter section of the comparison result. The instruction LD can be used with bus wire directly.

F No· 16-bit instruction 32-bit instruction Active conditions Inactive conditions 224 LD= D LD= S1·=S2· S1·≠S2· 225 LD> D LD> S1·>S2· S1·≤S2· 226 LD< D LD< S1·<S2· S1·≥S2· 228 LD<> D LD<> S1·≠S2· S1·=S2· 229 LD<= D LD<= S1·≤S2· S1·>S2· 230 LD<= D LD>= S1·≥S2· S1·<S2· When the highest bit of S1 and S2 (16-bit instruction: b15, 32-bit instruction: b31) is 1, the comparison value is regarded as negative value. When 32-bit counter is used in the instruction for comparison, if 16-bit instruction (LD) is used, its low 16-bit will be taken for comparison. However, it will easily lead to program error, so it is not recommended using 16-bit instruction in the 32-bit element.

For example:

LD= K200 C10 Y010 When C10 is equal to K200, Y10= ON X000 ● When D200 is larger than -30 and X0= ON, LD> D200 K-30 SET Y011 Y11= ON and hold.

DLD< K678493 C235 M50 ● When C235 is smaller than 678,493 or M3= M3 ON, M50=ON。

6-309 Chapter 6 Interpretation of Application Instructions Contact comparison

F232~F238 contact status comparison AND F Contact status comparison AND S1· S2· 232~238 D AND

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * Note:AP300 series supports data register W. S1· : Comparison value 1. S2· : Comparison value 2. Function The instruction is used to compare the content of S1· and S2·, and perform computation for the latter section of the comparison result. The instruction AND is for series connection with the contact.

F No· 16-bit instruction 32-bit instruction Active conditions Inactive conditions 232 AND= D AND= S1·=S2· S1·≠S2· 233 AND> D AND> S1·>S2· S1·≤S2· 234 AND< D AND< S1·<S2· S1·≥S2· 236 AND<> D AND<> S1·≠S2· S1·=S2· 237 AND<= D AND<= S1·≤S2· S1·>S2· 238 AND>= D AND>= S1·≥S2· S1·<S2· When the leftmost bit of S1 and S2 (16-bit instruction: b15, 32-bit instruction: b31) is 1, the comparison value is regarded as negative value. When 32-bit counter is used in the instruction for comparison, if 16-bit instruction (AND) is used, its low 16-bit will be taken for comparison. However, it will easily lead to program error, so it is not recommended using 16-bit instruction in the 32-bit element.

For example:

X000 When X0= ON, and the current value AND= K200 C10 Y010 of C10 is K200, Y10= ON. X001 ● When X1=on, and the content of AND> D200 K-30 SET Y011 register D200 is larger than -30, X002 DAND< K678493 C235 M50 Y11= ON and hold. M3 ● When X2=ON, C235 is smaller than 678,493 or M3= ON, M50=ON.

6-310 Chapter 6 Interpretation of Application Instructions Contact comparison

F240~F246 contact status comparison OR F OR contact status comparison AND S1· S2· 240~246 D

Bit element Word element

X Y M S K H KnX KnY KnM KnS T C D W V Z S1· * * * * * * * * * * * * S2· * * * * * * * * * * * * Note:AP300 series supports data register W. S1· : Comparison value 1. S2· : Comparison value 2. Function The instruction is used to compare the content of S1· and S2·, and perform computation for the latter section of the comparison result. 。 The instruction AND is for parallel connection with the contact.

F No· 16-bit instruction 32-bit instruction Active conditions Inactive conditions 240 OR= D OR= S1·=S2· S1·≠S2· 241 OR> D OR> S1·>S2· S1·≤S2· 242 OR< D OR< S1·<S2· S1·≥S2· 244 OR<> D OR<> S1·≠S2· S1·=S2· 245 OR<= D OR<= S1·≤S2· S1·>S2· 246 OR>= D OR>= S1·≥S2· S1·<S2· When the leftmost bit of S1 and S2 (16-bit instruction: b15, 32-bit instruction: b31) is 1, the comparison value is regarded as negative value. When 32-bit counter is used in the instruction for comparison, if 16-bit instruction (OR) is used, its low 16-bit will be taken for comparison. However, it will easily lead to program error, so it is not recommended using 16-bit instruction in the 32-bit element.

For example:

X001 ● When X1= ON, and the current value of C10 Y010 is K200, Y010= ON.

OR= K200 C10 ● When X2 and M30 are ON or 32-bit register X002 M30 D101 and D100 are larger than or equal to M50 K100,000, M50=ON.

DOR>= D100 K100000

6-311 Chapter 7 Communication Function Table of Contents

Chapter 7 Communication Function ...... 7-2 1 Summary ...... 7-2 1.1 Communication Port ...... 7-2 1.2 Communication Parameters ...... 7-5 2 Modbus Communication Function ...... 7-9 2.1 Communication Function ...... 7-9 2.2 Communication Address ...... 7-10 2.3 Communication Function Code ...... 7-13 3 Other Communication Functions ...... 7-21 3.1 Remote I/O (RMIO Instruction) ...... 7-21 3.2 Function of Data Link 2(Instruction DTLK2) ...... 7-22

1 Chapter 7 Communication Function Table of Contents

Chapter 7 Communication Function

1 Summary

PLC of AP series could satisfy your communication and network demands, which doesn't support simple network(Modbus protocol), but also support complicated network. PLC of AP series supports Modbus protocol, moreover, AP300 also supports CANopen protocol.

1.1 Communication Port

PLC of AP series has 4 communication ports: <1> PG communication port; <2> USB communication port; <3> RS485 communication port; <4> RS485, RS232 expansion card communication port 1 and 2. The positions are introduced as below: [1]:RS485 communication port [2]:USB communication port [3]:PG communication port

4 5 [4]:Expansion card communication port 1 3 [5]:Expansion card communication 2 port 2 Note: AP110 and AP114 don't have 1 expansion card communication port, while AP360 has the expansion card communication port 1 and 2. All other AP model types support expansion card communication port 1.

1. PG communication port Pin Figure of PG Communication Port

2 Chapter 7 Communication Function Table of Contents

1:RX- 5:VCC 2:RX+ 6:GND 3:GND 7:TX+ 4:TX- 8:GND Mini Din 8-core socket (Hole) PLC of AP series includes a built-in PG communication port.

2. USB communication port PLC of AP series includes a built-in USB communication port.

3. RS485 communication port PLC of AP series includes a built-in RS485 communication port. Pin D+ of RS485 communication port is signal “A”, and D- is signal “B”.

4. Expansion card communication port 1 and 2. The expansion card communication port on the PLC of AP series is available for the expansion card, such as 485BD, 232BD, RTCBD cards, and etc. This function is unavailable on AP110 and AP114, while two expansion card communication ports are available on AP360. All other AP model types is only equipped with one expansion card communication port.

Function Description Table for 4 Communication Ports Expansion PG USB RS485 card Communi Communi Communic communicat Description cation cation ation port ion port 1 port port and 2. It is used for PG connection programming Programming of user program and download and update ◎ Function of the system program. It is for system use only. It can used for PG computer link and Modbus slave ◎ ◎ ◎ ◎ HMI monitoring. The 4 communication (Only RTU) ports can set this function simultaneously. It is non-protocol communication, which can be enabled on two communication RS instruction ◎ ◎ ports simultaneously. It shall be used with the application instruction F80 RS.

3 Chapter 7 Communication Function Table of Contents

It is Modbus-protocol communication, MBUS which can be enabled on two Instruction(Onl ◎ ◎ communication ports simultaneously. It y RTU) shall be used with the application instruction F87 MBUS. It can't be enabled on two communication Remote I/O 〇 〇 ports simultaneously. It shall be used with the application instruction F191 RMIO. It can't be enabled on two communication Data link 2 〇 〇 ports simultaneously. It shall be used with (Data Link2) the application instruction F193 DTLK2. Register for setting of the D8320/ D8321 D8120 communicatio D8300 n format Remark Built-in Built-in Built-in Optional ◎:The function is available, which can be used by multiple ports simultaneously. 〇:The function is available, which can't be used by multiple ports simultaneously.

4 Chapter 7 Communication Function Table of Contents

1.2 Communication Parameters

PLC of AP series can set parameters for the communication ports. No. Function Description D8003 ID ID display, this register is read-only. When M8128=1, the value of D8128 will be ID D8128 Specify ID taken as the ID, with the valid range of 1~255. The value beyond the range will be preset as 1. PG Communication communication D8321 The communication format is 89Hex by default. format port Communication D8120 The communication format is 89Hex by default. format Remaining number of D8122 Remaining number of RS485 sending data RS485 sending data Number of data D8123 Number of data received received It is only valid in the instruction RS, which is D8124 Start character RS485 02Hex by default. Communication It is only valid in the instruction RS, which is D8125 End character port 03Hex by default. Set time before sending (0~30000)ms for Time before instructions of COIW, MCIR、MCIW, REGW, D8126 sending MRGR, MRGW, RS, MBUS, which is 10ms by default. Time for timeout It is only valid in the instruction RS. judgment D8129 Response It is valid in the instructions of COIW, MCIR, timeout MCIW, REGW, MRGR, MRGW, RS, MBUS. judgment Communication D8320 The communication format is 89Hex by default. format Remaining number of Expansion card D8322 Remaining number of RS485 sending data RS485 sending Communication data port 1 Number of data D8323 Number of data received received It is only valid in the instruction RS, which is D8324 Start character 02Hex by default.

5 Chapter 7 Communication Function Table of Contents

It is only valid in the instruction RS, which is D8325 End character 03Hex by default. Set time before sending(0~30000)ms for Time before instructions of COIW, MCIR、MCIW, REGW, D8326 sending MRGR, MRGW, RS, MBUS, which is 10ms by default. Time for timeout It is only valid in the instruction RS. judgment D8329 Response It is valid in the instructions of COIW, MCIR, timeout MCIW, REGW, MRGR, MRGW, RS, MBUS. judgment Communication D8300 The communication format is 89Hex by default. format Remaining number of D8302 Remaining number of RS485 sending data RS485 sending data Number of data D8303 Number of data received received It is only valid in the instruction RS, which is D8304 Start character Expansion card 02Hex by default. Communication It is only valid in the instruction RS, which is D8305 End character port 2 03Hex by default. Set time before sending (0~30000)ms for Time before instructions of COIW, MCIR、MCIW, REGW, D8306 sending MRGR, MRGW, RS, MBUS, which is 10ms by default. Time for timeout It is only valid in the instruction RS. judgment D8309 Response It is valid in the instructions of COIW, MCIR, timeout MCIW, REGW, MRGR, MRGW, RS, MBUS. judgment

◆ D8321 communication format setting (PG communication port) Name Bit number Description Length of data (B0) 1: 8 bit (0,0): No check bit (0,1):ODD check Parity check (B2,B1) (1,1):EVEN check Stop bit (B3) (0):1 bit (1):2 bit (0,1,1,1):9,600 (1,0,1,0):57,600 Baud rate (bps) (B7,B6,B5,B4) (1,0,0,0):19,200 (1,0,1,1):115,200

6 Chapter 7 Communication Function Table of Contents

(1,0,0,1):38,400 Note:1. PG communication port supports Modbus RTU and Modbus ASCII communication protocols, with a fixed Data length of 8bit. 2. The setting of D8321 will take effect in the next scan cycle after this communication ends. 3. After the power is on, D8321 is 89Hex by default. 4. If the value of D8321 is beyond the above range, the PG communication port adopts the default communication format: baud rate 19.2kbps, 8bit data, 2bit for stopping, and without parity check. 5. When any of B10, B11, B12, B13, B14 and B15 is none-zero, preset the baud rate as 19.2kbps, 8bit data, 2bit for stopping, and without parity check. 6. After the baud rate is modified, it requires re-connecting PLC with AP-PCLINK.

◆ D8120 communication format setting (RS485 communication port) & D8320 communication format setting(Expansion card communication port 1) & D8300 communication format setting (Expansion card communication port 2) Name Bit number Description Length of data (B0) (0):7 bit (1):8 bit (0,0): No check bit (0,1):ODD check Parity check (B2,B1) (1,1):EVEN check Stop bit (B3) (0):1 bit (1):2 bit (0,1,1,0):4,800 (1,0,1,1):115,200 (0,1,1,1):9,600 (1,1,0,0):128,000 Baud rate (bps) (B7,B6,B5,B4) (1,0,0,0):19,200 (1,1,0,1):307,200 (1,0,0,1):38,400 (1,1,1,0):500,000 (1,0,1,0):57,600 Start character (B8) (0):None (1) : Valid, default: STX(02H) End character (B9) (0):None (1) : Valid, default: ETX(02H) Note: 1. The communication format and baud rate set on B0~B7 are for all functions. 2. B8~B9 setting is only for RS instruction. 3. When any of B10, B11, B12, B13, B14 and B15 is none-zero, preset the baud rate as 19.2kbps, 8bit data, 2bit for stopping, and without parity check. 4. When RS485 communication port is used, please be sure to use the isolated twisted-wire, and adopt the class-III grounding method. 5. There is no connection in COM terminal block and FG terminal block. 6. The isolated twisted cable should be 0.5mm2 with unshielded end( 30mm or below) for connecting to the terminal block. 7. The terminal resistor is required for communication between multiple machines, with the

7 Chapter 7 Communication Function Table of Contents spec of 120Ω,1/4W. 8. When the power is on, D8120, D8320, D8300 are set as 89Hex by default. 9. The setting of D8120, D8320 and D8300 will take effect in the next scan cycle after this communication ends. 10. Please insert the communication expansion card before the host is powered on, so that the expansion card will work normally. If you insert the expansion card after the power is on, it won't work normally. 11. Modbus slave function only supports RTU mode.

8 Chapter 7 Communication Function Summary

2 Modbus Communication Function

2.1 Communication Function

1. Modbus Slave Communication Function The PG communication port(built-in), USB communication port(built-in), RS495 communication port(built-in), and expansion card communication port 1/2(optional), these four ports can realize Modbus slave communication function simultaneously and separately.

2. RS/MBUS Instruction Below is only for brief introduction. For more detail, please see the description for instructions F80 RS and F87 MBUS.

Application Instruction Format FUN80:RS S· m D· n K FUN87:MBUS S· m D· n K S· :Address of data sent. m: sent data length(RS:0~255;MBUS:0~253). D· :Address of data received. n: received data length (RS:0~255;MBUS:0~253). K : Serial port selection, 0:The built-in RS485 communication port is selected; constant 0~1. 1:RS485 expansion card communication port 1 is selected; 2:RS485 expansion card communication port 2 is selected;

● The instruction RS is a non-protocol communication instruction, which makes use of various communication units such as PC, barcode reader and printer, for data exchange based on the non-protocol communication. ● The instruction MBUS is available for Modbus master communication. It only supports RTU mode.

9 Chapter 7 Communication Function Summary

2.2 Communication Address

The address numbers of Modbus corresponding to the internal software numbers of PLC of AP series are as shown below: ◆ Coil Address Distribution Applicable to Coil Address Content point Remark AP100 AP200 AP300 0000H~00FFH X0~X377 256 points It is used in ○ ○ ○ 0100H~01FFH Y0~Y377 256 points the function ○ ○ ○ 0200H~07FFH M0~M1535 1536 points codes of ○ ○ ○ 0800H~0BFFH S0~S1023 1024 points 01H,05H, ○ ○ ○ 0C00H~0C27H T0~T39 40 points 0FH ○ ○ ○ 0C28H~0CC3H T40~T195 156 points (Read/Write) — ○ ○ 0CC4H~0CFFH T196~T255 60 points ○ ○ ○ 0D00H~0DFFH T256~T511 256 points — — ○ 0E00H~0E63H C0~C99 100 points ○ ○ ○ 0E64H~0EC7H C100~C199 100 points — ○ ○ 0EC8H~0EDBH C200~C219 20 points — ○ ○ 0EDCH~0EFFH C220~C255 36 points ○ ○ ○ 0F00H~10FFH M8000~M8511 512 points ○ ○ ○ 1100H~1CFFH S1024~S4095 3072 points — — ○ 1D00H~34FFH M1536~M7679 6144 points — — ○ 3500H~35FFH C256~C511 256 points — — ○ 3600H~3FFFH Reserved — — — — Note:AP series' input and output coil address is distributed in octal, such as X000~X007, X010~X017. Other coil addresses are distributed in decimal, such as M0~M7,M8,M9, M10…M1534,M1535.

10 Chapter 7 Communication Function Summary

◆ Register Address Distribution Applicable to Register address Content Bytes Remark AP100 AP200 AP300 4000H~4027H T0~T39 present value 80 bytes It is used in ○ ○ ○ 4028H~40C3H T40~T195 present value 312 bytes the function — ○ ○ 40C4H~40FFH T196~ T255 present value 120 bytes codes of ○ ○ ○ 4100H~41FFH T256~T511 present value 512 bytes 03H, — — ○ 4200H~4263H C0~C99 present value 200 bytes 06H,10H ○ ○ ○ 4264H~42C7H C100~C199 present value 200 bytes (Read/Write) — ○ ○ 42C8H~42EFH C200~C219 present 80 bytes — ○ ○ value[*1] 42F0H~4337H C220~C255 present 144 bytes ○ ○ ○ value[*1] 4338H~4537H D0~D511 present value 1024 bytes ○ ○ ○ 4538H~4B37H D512~D2047 present value 3072 bytes — ○ ○ 4B38H~6277H D2048~D7999 present 11904 bytes — — ○ value 6278H~6477H D8000~D8511 present 1024 bytes ○ ○ ○ value 6478H~6497H Z0, 0~Z15, 15 present value 64 bytes ○ ○ ○ 6498H~64BFH T0~T39 default value 80 bytes ○ ○ ○ 64C0H~655BH T40~T195 default value 312 bytes — ○ ○ 655CH~6597H T196~T255 default value 120 bytes ○ ○ ○ 6598H~6697H T256~T511 default value 512 bytes — — ○ 6698H~66FBH C0~C99 default value 200 bytes ○ ○ ○ 66FCH~675FH C100~C199 default value 200 bytes — ○ ○ 6760H~6787H C200~C219 default 80 bytes — ○ ○ value[*1] [*1] 6788H~67CFH C220~C255 default value 144 bytes ○ ○ ○ 67D0H~69CFH C256~C511default value[*2] 1024 bytes — — ○ 69D0H~6BCFH C256~C511default value[*2] 1024 bytes — — ○ 6BD0H~7FFFH Reserved — — — — 8000H~FFFFH W0~W32767 present value 65536 bytes — — ○ [*1]:Counter address mapping (C200~C234,32-bit counter;C235~C249,C250~C255, 32-bit high-speed counter ). [*2]:Counter address mapping(C256~C499,C509~C511,32-bit counter;C500~C508, 32-bit high-speed counter).

11 Chapter 7 Communication Function Summary

Description of 32-bit register address Word Register address Register Value High byte Low byte 42C8H C200 low word of present value Low word high bit Low word low bit 32-bit counter Present value 42C9H C200 high word of present value High word high bit High word low bit … … 4336H C255 low word of present value Low word high bit Low word low bit 4337H C255 high word of present value High word high bit High word low bit 6760H C200 low word of default value Low word high bit Low word low bit 32-bit counter Default value 6761H C200 high word of default value High word high bit High word low bit … … 67CEH C255 low word of default value Low word high bit Low word low bit 67CFH C255 high word of present value High word high bit High word low bit 67D0H C256 low word of present value Low word high bit Low word low bit 32-bit counter Present value 67D1H C256 high word of present value High word high bit High word low bit … … 69CEH C511 low word of present value Low word high bit Low word low bit 69CFH C511 high word of present value High word high bit High word low bit 69D0H C256 low word of default value Low word high bit Low word low bit 32-bit counter Default value 69D1H C256 high word of default value High word high bit High word low bit … … 6BCEH C511 low word of default value Low word high bit Low word low bit 6BCFH C511 high word of default value High word high bit High word low bit

12 Chapter 7 Communication Function Summary

2.3 Communication Function Code

Modbus communication instruction format for AP series ● Instruction format and response format: CRC verification range

<—————————————> Slave address Function code Data CRC-16 ● Error response format: CRC verification range

<—————————————> Slave address Function code Error code CRC-16 Description: Address of station Function code Data CRC-16 Error code number: verification 00H : All slaves A 01H:Read coil The data CRC Please range verification read the broadcast B 05H:Write single coil depends on range is the content the slave below for 01H:Slave 1 C 0FH:Write multiple coils function. address, the 0FH:Slave 15 D 03H:Read register Please see function description the code and of each 10H:Slave 16 E 06H:Write single register description data/error error code. … F 06H:Write multiple register of each code. function for : 0FFH Slave 255 G 08H:Diagnostics more detail. H 6CH:AP control I 11H:Read AP series ID Note: The reception timeout period on the PC shall be the maximum time of transmitting 256-byte communication instruction (calculated based on different baud rates) plus the waiting time of PLC in the scan period.

Error code Under the status of communication connection, when error occurs, the master will transmit the function code plus 80H(set the highest bit as 1), together with the error code, to the main system. Code Name Description 01 Illegal Function The function code is invalid to the slave. 02 Error data address The data address is invalid to the slave. 03 Error data value Illegal data 04 Slave error When executing the request, error is detected on the slave.

13 Chapter 7 Communication Function Summary

05 Confirmed Reserved 06 Slave is busy Reserved 07 Operation Error of function under operation mode/password mode mode/password mode

A. 01H read coil

Function 01H code Function The function code is used to read the states of multiple continuous coils. description AP series has a maximum of 2000 coils.

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 01H Function code 01H Function code 81H Coil High 00H Bytes 03H Error code 02H D address Low 13H Output status Low C1H Communic at CDH CRC-16 Coil High 00HX032-X023 High 91H ation a Quantity Low 15H Data Output status 6BH format Low 0CHX042-X033 CRC-16 High 00H Output status 05H X047-X043 Low 42H CRC-16 High 82H

The byte number is equal to the coil quantity/8. When the remainder is non-zero, 1 byte shall be added. Notes User shall set the start address and coil quantity as the multiples of 8, so as to increase the program efficiency. In above example: The coil quantity of instruction PC→PLC is 0015(H)=21(D). However, as 21/8=2, and the remainder is 5, the response byte number is2+1=3(D)=03(H)(=3×8=24 coil states). Thus, the byte number of PLC→PC will be 03H. The address of input coil and output coil is distributed in octal (X000~X007,X010~X017,…),so the start address in PC→PLC is 0013(H)=23(Oct). and output state of PLC→PC should be the 24 coil from X023, that is: X023,…,X027,X030,…X036,X037,X040,X041,…,X046 and X047, which are 21 coils states plus three 0s. It outputs the response quantity by 3 bytes, 8 bits are one byte, namely, X023~X032,X033~X042,X043~X047. It is the same case when the coil Y is read. In the Byte (X023~X032), X023 is the lowest valid bit and X032 is the highest valid bit. The bytes are arranged from High bit to Low bit, that is X032~X023. When the feedback state of

14 Chapter 7 Communication Function Summary

X032~X023 is (H), namely, 1100 1101(B), the state of X032~X023 shall be ON~ON~OFF~OFF~ON~ON~OFF~ON in order.

B. 05H write single coil

Function code 05H Function The function code is used to write ON/OFF of the single coil output. description

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 05H Function code 05H Function code 85H Coil High 01H Coil High 01H Error code 02H Communication address Low ACH address Low ACH Low C3H format Data Data CRC-16 Coil High FFH Coil High FFH High 51H value Low 00H value Low 00H Low 4DH Low 4DH CRC-16 CRC-16 High E7H High E7H

The coil value 0xFF00 indicates the coil output is ON. Notes The coil value 0x0000 indicates the coil output is OFF.

C. 0FH write multiple coils

Function code 0FH Function The function code is used to make the multiple continuous coils ON/OFF. description AP series has a maximum of 1968 coils.

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 0FH Function code 0FH Function code 8FH Coil High 00H Coil High 00H Error code 01H address Low 13H address Low 13H Low 85H Communication Data CRC-16 Coil High 00H Coil High 00H High F0H format Data Quantity Low 0AH Quantity Low 0AH Bytes 02H Low 24H CRC-16 *Input data High 09H Low XX CRC-16 High XX

Notes The byte number is equal to the coil quantity/8. When the remainder is non-zero, 1 byte shall be

15 Chapter 7 Communication Function Summary

added. The length of input data is the number of bytes. As shown in above example: The number of bytes=2, indicating the input data is of 2 bytes. XX indicates it depends on the input data. User shall set the start address and coil quantity as the multiples of 8, so as to increase the program efficiency.

D. 03H read register

Function code 03H Function It is to read the content of multiple continuous registers. description AP series has a maximum of 125 registers.

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 03H Function code 03H Function code 83H Start High 40H Bytes 06H Error code 02H Communication Data address Low 6BH *Output data Low C0H format Data CRC-16 Register High 00H Low XX High F1H CRC-16 quantity Low 03H High XX Low 61H CRC-16 High D7H

The start address is the address of the firstly read register. The byte number=register quantity ×2. (Each register has two bytes). The length of input data is the number of bytes. As shown in above example: The Notes number of bytes=6, indicating the output data is of 6 bytes. The first byte of each register is high bit, while the second byte is low bit. XX indicates it depends on the input data.

E. 06H write single register

Function 06H code Function Write content into single register description

16 Chapter 7 Communication Function Summary

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 06H Function code 06H Function code 86H

Communic D Register High 40H D Register High 40H Error code 03H ation a address a address Low 01H Low 01H CRC-1 Low 02H format t t a Input High 00H a Input High 00H 6 High 61H Data Low 03H Data Low 03H Low 8DH Low 8DH CRC-16 CRC-16 High CBH High CBH Notes

F. 10H write multiple registers

Function code 10H Function Write multiple data into registers with continuous addresses. description AP series has a maximum of 123 registers.

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 10H Function code 10H Function code 90H Start High 40H Start High 40H Error code 03H address Low 01H address Low 01H Low 0CH Communication Data CRC-16 register High 00H Register High 00H High 01H format Data Quantity Low 02H quantity Low 02H Bytes 04H Low 05H CRC-16 *Input data High C8H Low XX CRC-16 High XX

The start address is the address of the firstly written register. The byte number=register quantity ×2. (Each register has two bytes). Notes The length of input data is the number of bytes. As shown in above example: The number of bytes=4, indicating the input data is of 4 bytes. XX indicates it depends on the input data.

G. 08H diagnostics

It is mainly used to check the communication condition between the master and slaves, or

17 Chapter 7 Communication Function Summary check the error condition in the slaves. Function code Sub-function 0000 Function Return the query data description

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 08H Function code 08H Function code 88H High 00H High 00H Error code 02H Communication Sub-function Sub-function Low 00H Low 00H Low C7H format Data Data CRC-16 High A5H High A5H High C1H Data Data Low 37H Low 37H Low DAH Low DAH CRC-16 CRC-16 High 8DH High 8DH

Notes The data is any numeric value.

H. 6CH :PLC control

(6CH:Operation/stop program, write ID, and read operation/stop status ) a. Sub-function FF00: Run/Stop AP series user program Function code Sub-function FF00 Function Run/Stop AP series user program description

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 6CH Function code 6CH Function code ECH High FFH High FFH Error code 04H Communication Sub-function Sub-function Low 00H Low 00H Low 6DH format Data Data CRC-16 High 53H High 53H High 03H Data Data Low 54H Low 54H Low 9CH Low 9CH CRC-16 CRC-16 High D8H High D8H

If data=5255H, run program(ASCII code is ‘RU’). Notes If data=5354H, stop program(ASCII code is ‘ST’).

b. Sub-function FF01: Modify AP series ID (Address) Function code Sub-function FF01

18 Chapter 7 Communication Function Summary

Function Modify AP series ID(Address) description

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 6CH Function code 6CH Function code ECH High FFH High FFH Error code 04H Communication Sub-function Sub-function Low 01H Low 01H Low 6DH format Data Data CRC-16 High 00H High 00H High 03H ID data ID data Low 37H Low 37H Low B1H Low B1H CRC-16 CRC-16 High C1H High C1H

Notes ID data is the new ID(001~255). The high word must be set as 0.

c. Sub-function FF02: Read run/stop status of AP series Function code Sub-function FF02 Function Read run/stop status of AP series description

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 6CH Function code 6CH Function code ECH High FFH High FFH Error code 04H Communication Sub-function Sub-function Low 02H Low 02H Low 6DH format Data Data CRC-16 High 00H High 52H High 03H Data Data Low 00H Low 55H Low 00H Low FDH CRC-16 CRC-16 High 17H High 48H

If data=5255H, run program(ASCII code is ‘RU’). Notes If data=5354H, stop program(ASCII code is ‘ST’).

d. Sub-function FF03: set RTC value Function code Sub-function FF03 Function Set RTC value description

19 Chapter 7 Communication Function Summary

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 6CH Function code 6CH Function code ECH High FFH High FFH Error code 04H Sub-function Data Sub-function Low 03H Low 03H Low 6CH CRC-16 High Second Low C0H High C6H Data CRC-16 Low Minute High 34H Communication High Hour format Data Data Low Date High Month Data Low Year High Week Data Low 00 Low XX CRC-16 High XX

The data length is of 8 bytes, BCD code(Second, minute, hour, date, month, year, week, 00). XX indicates it depends on the input data. Notes The range of “year” is 2000~2099, which requires setting the last two digits by default. For example, if 26 is set, the corresponding year is 2026.

L. 11H :read AP series ID(address)

Function code 11H Function Read AP series ID(Address) description

PC→PLC PLC→PC(OK) PLC→PC(ERROR) Slave address 01H Slave address 01H Slave address 01H Function code 11H Function code 11H Function code 91H Communicatio Low C0H Bytes 01H Error code 04H n format CRC-16 Data High 2CH AP series ID 03H Low 4CH CRC-16 CRC- Low 10H High 53H 16 High 4CH

This function is only available for 1-to-1 connection. When it is used for connection of multiple machines, it will cause the bus data confusion. Notes When reading the AP series ID, the salve address in the instruction is a random number rather than 0. The returned AP series ID is the real device ID.

20 Chapter 7 Communication Function Modbus

3 Other Communication Functions

3.1 Remote I/O (RMIO Instruction)

Below is only a brief introduction. See the description for instruction F191 RMIO for more information. Item Description Communication EIA RS-485 standards Baud rate 4800bps~500000bps Number of slaves 4 slaves in maximum Input 36 points (M1200~M1235); Slave 1 Output 24 points (M1440~M1463) Input 36 points (M1240~M1275); Slave 2 Remote I/O zone Output 24 points (M1464~M1487) (set up by master) Input 36 points (M1280~M1315); Slave 3 Output 24 points (M1488~M1511) Input 36 points (M1320~M1355); Slave 4 Output 24 points (M1512~M1535) Insulated twisted cable, collinearity, 2 lines type, total Cable length: 1km(38400bit/s) Note:The remote I/O slave must be the basic unit of AP, which can't be the expansion module or other module.

Application Instruction Format FUN191:RMIO K K :Serial port selection, 0:The built-in RS485 communication port is selected; constant 0~2. 1:RS485 expansion card communication port 1 is selected; 2:RS485 expansion card communication port 2 is selected;

Function description AP adopts the mode to increase the I/O points of the master. The master of AP series can communicate with 4 AP slaves in maximum. When AP is taken as the slave under remote I/O mode, it can be only used for the expansion I/O function of the master, which can't execute other user programs.

21 Chapter 7 Communication Function Modbus

3.2 Function of Data Link 2(Instruction DTLK2)

Below is only a brief introduction. See the description for instruction F193 DTLK2 for more information. Specification Baud rate EIA RS-485 Baud rate 4800bps~500000bps Number of slaves 15 slaves in maximum The start address in the range of D0~D7999 and Linked zone W0~W32767 are set by instruction DTLK2. (Note:AP300 series supports data register W.) The maximum data length is 40 words, which can be set by Data length for each slave instruction DTLK2 Insulated twisted cable, collinearity, 2 lines type, total Cable length: 1km(38400bit/s)

Application Instruction Format FUN193:DTLK2 S1· S2· K S1· :Start address of data source, with the range of D0~D7999, W0~W32767. (Note:AP300 series supports data register W.) S2· :Data of length, with the range of 1~40. K : Serial port selection, 0:The built-in RS485 communication port is selected; constant 0~2. 1:RS485 expansion card communication port 1 is selected; 2:RS485 expansion card communication port 2 is selected;

Function description AP series adopts the mode to link the data in the system of small scale. The AP series master can communicate with a maximum of 15 AP slaves.

22 Chapter 8 Expansion Function Table of Contents

Chapter 8 Expansion Function ...... 8-3 1 Expansion card ...... 8-3 1.1 AP-485BD, AP-232BD ...... 8-4 1.2 AP-COBD ...... 8-4 1.3 AP-ENBD ...... 8-4 1.4 AP-4DBD, AP-4RBD, AP-2D2TBD ...... 8-5 1.5 AP-RTCBD ...... 8-6 1.6 AP-2AIBD, AP-1AOBD, AP-3MABD ...... 8-8 1.7 AP-CAMBD ...... 8-10 2 Expansion module ...... 8-11 2.1 Digital Module ...... 8-13 2.1.1 General Specification ...... 8-13 2.1.2 AP-8EMR Specification ...... 8-16 2.1.3 AP-8EMT Specification ...... 8-18 2.1.4 AP-8EMP Specification ...... 8-20 2.1.5 AP-8EYR Specification ...... 8-22 2.1.6 AP-8EYT Specification ...... 8-24 2.1.7 AP-8EYP Specification ...... 8-26 2.1.8 AP-8EXD Specification ...... 8-28 2.1.9 AP-16EMR Specification ...... 8-29 2.1.10 AP-16EMT Specification ...... 8-31 2.1.11 AP-16EMP Specification ...... 8-33 2.1.12 AP-16EYR Specification ...... 8-35 2.1.13 AP-16EYT Specification ...... 8-37 2.1.14 AP-16EYP Specification ...... 8-39 2.1.15 AP-16EXD Specification ...... 8-41 2.1.16 AP-32EMR Specification ...... 8-43 2.1.17 AP-32EMT Specification ...... 8-45 2.1.18 AP-32EMP Specification ...... 8-47 2.2 Analog Module ...... 8-49 2.2.1 General Specification ...... 8-49 2.2.2 AP-8AD Specification ...... 8-51 2.2.3 AP-2DA Specification ...... 8-54 2.2.4 AP-3MA Specification ...... 8-57 2.2.5 AP-4RD Specification ...... 8-61 2.2.6 AP-4RD-K Specification ...... 8-63 2.2.7 AP-4TM Specification ...... 8-65

8-1 Chapter 8 Expansion Function Table of Contents

2.2.8 Wiring ...... 8-67 2.2.9 Use Instructions ...... 8-69 2.3 Communication Module ...... 8-74 2.4 Power Supply Module ...... 8-75 2.4.1 5V Power Restriction ...... 8-75 2.4.2 Internal 24V Power Restriction ...... 8-77

8-2 Chapter 8 Expansion Function Table of Contents

Chapter 8 Expansion Function

1 Expansion card

Under AP series, each basic unit except AP110/AP114 can be installed with an expansion card, and AP360 can be installed with two. To use the expansion card, you must insert it before the host is powered on, otherwise, the expansion card won't work normally. When the expansion card is not in use, you shall install the standard cover of the expansion card, so as to protect it from dust, which may affect the connectivity of the connector. You must plug/unplug the expansion card when the power is off. After the expansion card is plugged, the host will identify the expansion card automatically, and display the ID in D8020(for expansion card communication port 1), D8021(expansion card communication port 2)(ID is 0 if error occurs when identification). The types of expansion cards are listed as below: Remar ID Type Description Power consumption k Built-i 0 AP-0CV Standard cover of expansion card N.A n 485 multi-function communication 1 AP-485BD DC3.3V:3mA port 232 multi-function communication 2 AP-232BD DC3.3V:11mA port DC3.3V :160mA 3 AP-COBD CANopen communication port DC5V:130mA 4 AP-ENBD Ethernet communication port DC3.3V:170mA 5 AP-4DBD Digital input×4 DC3.3V:13mA 6 AP-4RBD Relay output×4 DC24V:30mA Option Digital input×2 DC3.3V:8mA al 7 AP-2D2TBD Transistor output×2 DC5V :14mA 8 AP-RTCBD RTC 9 AP-2AIBD 0~10V analog input port×2 DC24V:2mA 10 AP-1AOBD Analog output port×1 DC24V:23mA 0~10V analog input port×2 11 AP-3MABD DC24V:25mA Analog output port×1 Electric cam movement control DC3.3V :190mA 12 AP-CAMBD (one axis) DC5V:70mA

8-3 Chapter 8 Expansion Function Table of Contents

1.1 AP-485BD, AP-232BD

AP-485BD and AP-232BD are communication expansion cards for RS485 and RS232 communication respectively. In AP series, such instructions as COIW, MCIR, MCIW, REGW, MRGR, MRGW, RS and MBUS can all make communications by using expansion cards AP-485BD and AP-232BD.

AP-485BD AP-232BD

1.2 AP-COBD

AP-COBD

1.3 AP-ENBD

AP-ENBD

8-4 Chapter 8 Expansion Function Table of Contents

1.4 AP-4DBD, AP-4RBD, AP-2D2TBD

AP-4DBD, AP-4RBD and AP-2D2TBD are digital expansion cards, which are used to expand digital input and output for PLC of AP series.

AP-4DBD AP-4RBD AP-2D2TBD

Type Description AP-4DBD 4-channel digital input AP-4RBD 4-channel relay output AP-2D2TBD 2-channel digital input 2-channel transistor output The numbers of the digital expansion card are arranged from X370 and Y370 respectively.

Use Instructions: When AP-4DBD is used, the numbers of four inputs on the card are X370~X373 (Expansion card port 1)/ X374~X377(Expansion card port 2). When AP-4RBD is used, the numbers of four inputs on the card are Y370~Y373 (Expansion card port 1)/ X374~X377(Expansion card port 2). When AP-2D2TBD is used, the number of two inputs and two outputs are respectively X370~X371 and Y370~Y371 (Expansion card port 1)/ X374~X375, Y374~Y375 (Expansion card port 2).

8-5 Chapter 8 Expansion Function Table of Contents

1.5 AP-RTCBD

AP-RTCBD expansion card is used to realize RTC function.

AP-RTCBD RTC description for AP series. AP100 Series AP-110 AP-114 AP-120 AP-130 RTC expansion card can be plugged RTC description N/A into for RTC function. AP200 Series AP-224 AP-232 AP-240 AP-260 RTC function can be made on the basic module, or obtained by plugging in RTC description the RTC expansion card. AP300 Series AP-324 AP-332 AP-340 AP-360 RTC description RTC function of basic module

Detailed description for RTC Built-in: Second (D8013), Minute (D8014), Hour (D8015), Date (D8016), Storage device Month (D8017), Year (D8018), Week (D8019), with ±30s offset F160 TCMP: time compare F161 TZCP:time zone compare Exclusive application F162 TADD: time addition instruction F163 TSUB:time subtraction F166 TRD:read time F167 TWR:write clock data Error ±45seconds/month (25℃ ) Leap error Auto correction Memory holding in In case of power failure, D8013~D8019 will hold data with the power case of power failure supplied by lithium battery.

8-6 Chapter 8 Expansion Function Table of Contents

The RTC operation can be performed from the following special coils and special registers. Special Special Content Description Content coils registers When it is ON, the clock stops D8013 Second(0~59) timing.When it is ON~OFF, the D8014 Minute(0~59) Clock stop clock is preset based on the data of M8015 and preset D8013~D8019, which will be D8015 Hour(0~23) started. When the power is on, it will be reset. When it is ON, the clock stops D8016 Day(1~31) Stop reading/displaying time. It will be M8016 displaying reset when a power supply is D8017 Month(1~12) clock time connected. When it is ON, it will be +/-30s offset for internal time. It will be M8017 ±30s offset D8018 Year(2000~2099) reset when a power supply is connected. Installation ON status indicates clock is M8018 D8019 Week(0~6) detection installed. M8019 Clock error ON status indicates clock error

8-7 Chapter 8 Expansion Function Table of Contents

1.6 AP-2AIBD, AP-1AOBD, AP-3MABD

AP-2AIBD, AP-1AOBD and AP-3MABD are analog expansion cards. They are used to realize analog input and output. The profile of AP-2AIBD and AP-1AOBD is the same as AP-3MABD.

AP-3MABD Note:1. Only the expansion card port 1 supports the functions of expansion cards AP-2AIBD, AP-1AOBD and AP-3MABD, which are unavailable for the expansion card port 2. Please don't plug the above three expansion cards into the expansion card port 2. 2. When the expansion cards AP-2AIBD, AP-1AOBD and AP-3MABD are used, the high-speed output function of Y3 will be disabled. Please pay attention to it.

AP-2AIBD:2-channel analog input port[Note](Precision2%, namely 0.2V), 0~10V input, with the corresponding setting range: 0~1000(10bit). AP-1AOBD:1-channel analog output port[Note](Precision2%, namely 0.2V), 0~10V input, with the corresponding setting range: 0~4000. AP-3MABD:2-channel analog input port[Note](Precision2%, namely 0.2V), 0~10V input, with the corresponding setting range: 0~1000(10bit). 1-channel analog output port[Note](Precision2%, namely 0.2V), 0~10V input, with the corresponding reading range: 0~4000. [Note]:Software filter of input-type analog expansion card D8260: 0: The software filter is disabled; 1~3: Software filter mode 1~3(For more details, please see 2.2.9 "System Settings for System Memory" in this document).

The configuration relation between the data storage device and the channel of the analog expansion module Input-type analog expansion card (System will read data in the channel and write them in the corresponding data address every time after the scan is completed) Channel Channel Channel Channel Channel Channel Channel Channel 1 2 3 4 5 6 7 8 D8360 D8361 D8362 D8363 D8364 D8365 D8366 D8367 Output-type analog expansion card(System will read data from corresponding address and output them to individual channels during the scan) Channel Channel Channel Channel — — — — 1 2 3 4

8-8 Chapter 8 Expansion Function Table of Contents

D8368 D8369 D8370 D8371 — — — — When the analog expansion card is used, the AD input registers of the expansion card are arranged from D8360. The DA output registers are arranged from D8366. Use Instructions: When AP-2AIBD is used, D8360 and D8361 will be used to store the data corresponding to the input voltage of the matching channel. When AP-1AOBD is used, D8368 will be used to set the value corresponding to the output voltage. When AP-3MABD is used, the relation of the analog input/output channels corresponding to the registers is the same as that of AP-2AIBD and AP-1AOBD.

8-9 Chapter 8 Expansion Function Table of Contents

1.7 AP-CAMBD

AP-CAMBD

8-10 Chapter 8 Expansion Function Expansion card

2 Expansion module

Under AP series, each basic unit except AP110/AP114/AP120 can be connected with the expansion modules. To use the expansion module, it requires plugging it before the power is on, otherwise, the expansion module won't work normally. When the expansion module is not in use, please install the terminal connector. You must connect the expansion module when the power is off. The types of expansion modules are listed as below: Type Description AP-8EMR 4-point input/4-point output(Relay) AP-8EMT 4-point input/4-point output(NPN transistor) AP-8EMP 4-point input/4-point output(PNP transistor) AP-8EYR 8-point output(Relay) AP-8EYT 8-point output(NPN transistor) AP-8EYP 8-point output(PNP transistor) AP-8EXD 8-point input AP-16EMR 8-point input/8-point output(Relay) Digital AP-16EMT 8-point input/8-point output(NPN transistor) module AP-16EMP 8-point input/8-point output(PNP transistor) AP-16EYR 16-point output(Relay) AP-16EYT 16-point output(NPN transistor) AP-16EYP 16-point output(PNP transistor) AP-16EXD 16-point input AP-32EMR-A 16-point input/16-point output(Relay) AP-32EMT-A 16-point input/16-point output(NPN transistor) AP-32EMP-A 16-point input/16-point output(PNP transistor) AP-4RD PT-100 temperature input×4-channel AP-4RD-K PT-1000 temperature input×4-channel AP-4TM J/K temperature input×4-channel Analog AP-2DA 0~10V,±10V,0~20mA,4~20mA analog output×2-channel module 0~10V,0~20mA analog input×2-channel AP-3MA 0~10V,±10V,0~20mA,4~20mA analog output×1-channel AP-8AD 0~10V,0~20mA analog input×8-channel TP03-PBUS Profibus-DP slave Communicat TP03-DNET DeviceNet slave ion module EN01 TCP/IP

8-11 Chapter 8 Expansion Function Expansion card

Power Expanded power supply(Used when the expansion module is TP03-01SPS-A supply added)

8-12 Chapter 8 Expansion Function Expansion card

2.1 Digital Module

The basic module of AP100 30-point, AP200 and AP300 can be connected with the digital expansion module: AP100 can be expanded with 128 points in maximum, AP200 can be expanded with 256 points in maximum, and AP100an be expanded with 384 points in maximum.

2.1.1 General Specification

Type AP-8EM AP-8EY AP-16EM AP-16EY AP-32EM AP-8EXD AP-16EXD Item R/T/P R/T/P R/T/P R/T/P R/T/P-A Expansion unit Brick type outline Input point 4 0 8 8 0 16 16 Output point 4 8 0 8 16 0 16 Terminal Block Unremovable Dimension(mm) 47×90×85 57×90×85 124×90×85 (W×H×D) Expanded power Not required Not required 100~240VAC supply Operation 0~55℃ (32~131F) (Operating ambient temperature) temperature Storage ﹣25~﹢70℃ temperature Relative Level RH1,10~95%(non-condensing) humidity Surrounding 2 (IEC 60664) pollution degree Installation class II Enclosure IP20 Anti-erosive No erosive gas Altitude Operation:0~2,000m(0~6,565 inch); Transport:0~3,000m(0~9,840 inch) Frequency range Hz Continuous Accidental Vibration 5≤f<8.4 1.75mm amplitude 3.5mm amplitude resistance 8.4≤f≤150 0.5g continuously accelerating 1.0g continuously accelerating

147 m/s2 (15g), 11 ms duration, 3 shocks per axis, on three mutually perpendicular Shock resistance axis(IEC61131-2) Noise immunity 1,000Vpp,1us @ 30~100Hz Dielectric 1,500VAC > 1min between all terminals to ground ( terminal block for relay )

8-13 Chapter 8 Expansion Function Expansion card

withstand Dielectric 1,500VAC > 1min between all terminals to ground ( other terminal blocks ) withstand Insulation 500VDC> 10MΩ between all terminals to ground resistance Grounding ≤100Ω Note:Don't use it in the environment with the pressure exceeding the atmosphere, or it may cause malfunction.

8-14 Chapter 8 Expansion Function Expansion card

Outline figure:

AP-8EMR 8-point digital module AP-8EMT AP-8EMP AP-8EYR AP-8EYT AP-8EYP AP-8EXD

AP-16EMR 16-point digitalmodule AP-16EMT AP-16EMP\ AP-16EYR AP-16EYT AP-16EYP AP-16EXD

32-point digitalmodule

AP-32EMR-A AP-32EMT-A AP-32EMP-A

8-15 Chapter 8 Expansion Function Expansion card

2.1.2 AP-8EMR Specification

Item Specification Outline figure point 4 Voltage DC 24V±10% 7mA @ 24VDC Current (The current consumed by 24V connected with the input end is 7mA) Impedance 3.3kΩ Type. ON voltage/curre 15VDC(4.2mA) or above(min) In nt level pu Upside terminal block OFF t voltage/curre 9VDC(2.5mA) or below(max) nt level Response OFF→ON:3ms time ON→OFF:3ms X0 X2 * LED indicator is ON when input is S/S X1 X3 Indicator ON Insulation Photo-coupling insulation method point 4 Voltage AC 250V/DC 30V Current 2A/1 point; 5A/1 common terminal Type Relay Mechanical 20,000,000 times lifespan Y0 Y2 C0 Y1 Y3 * O Electric 100,000 times @ 2A ut lifespan pu Response 10ms t time Minimum 1mA @ 5VDC load Downside terminal block LED indicator is ON when input is Indicator ON Insulation Relay method PWR:5V Power LED(Green) Indicator OE:Output Enable LED(Green) Internal power 5VDC:Max current consumption supply 45mA

8-16 Chapter 8 Expansion Function Expansion card

24VDC:Max current consumption 30mA Expansion cable(TP03-304EC: Accessory 4cm,26pin) Terminal block description Symbol Content Symbol Content Signal input terminal(Input Output wiring terminal Upside X0~X3 Y0~Y3 terminal) Downside block(Output terminal) termin terminal Common circuit terminal al Common circuit terminal S/S block C0 block(Common block block(Common terminal) terminal) Note:4 output points share a common terminal. Internal circuit 5V 1

RY Input Output S/S COM

1

8-17 Chapter 8 Expansion Function Expansion card

2.1.3 AP-8EMT Specification

Item Specification Outline figure point 4 Voltage DC 24V±10% 7mA @ 24VDC Current (The current consumed by 24V connected with the input end is 7mA) Impedance 3.3kΩ Type. ON In voltage/curre 15VDC(4.2mA) or above(min) nt level pu Upside terminal block t OFF voltage/curre 9VDC(2.5mA) or below(max) nt level Response OFF→ON:3ms time ON→OFF:3ms X0 X2 * LED indicator is ON when input is S/S X1 X3 Indicator ON Insulation Photo-coupling insulation method point 4 Voltage DC 24V 0.3A/1 point; 1.2A/1 common Current terminal Type Transistor NPN O Response Y0 Y2 * ut Smaller than 1ms C0 Y1 Y3 time pu Minimum t 1mA @ 5VDC load LED indicator is ON when input is Indicator ON Downside terminal block Insulation Photo-coupling insulation method PWR:5V Power LED(Green) Indicator OE:Output Enable LED(Green) 5VDC:Max current consumption Internal power 45mA supply 24VDC:Max current consumption 30mA Accessory Expansion cable(TP03-304EC :

8-18 Chapter 8 Expansion Function Expansion card

4cm,26pin) Terminal block description Symbol Content Symbol Content Upside Signal input terminal(Input Downsi Output wiring terminal X0~X3 Y0~Y3 termin terminal) de block(Output terminal) al Common circuit terminal terminal Common circuit terminal S/S C0 block block(Common terminal) block block(Common terminal) Note:4 output points share a common terminal. Internal circuit 5V COM Trigger Input Output Circuit S/S Y0 1

8-19 Chapter 8 Expansion Function Expansion card

2.1.4 AP-8EMP Specification

Item Specification Outline figure point 4 Voltage DC 24V±10% 7mA @ 24VDC(The current consumed Current by 24V connected with the input end is 7mA) Impedance 3.3kΩ Type. ON voltage/curre 15VDC(4.2mA) or above(min) In nt level pu OFF Upside terminal block t voltage/curre 9VDC(2.5mA) or below(max) nt level Response OFF→ON:3ms time ON→OFF:3ms X0 X2 LED indicator is ON when input is S/S X1 X3 * Indicator ON Insulation Photo-coupling insulation method point 4 Voltage DC 24V 0.3A/1 point; 1.2A/1 common Current terminal Type Transistor PNP O Response Y0 Y2 ut Smaller than 1ms C0 Y1 Y3 * time pu Minimum t 1mA @ 5VDC load LED indicator is ON when input is Indicator ON Downside terminal block Insulation Photo-coupling insulation method PWR:5V Power LED(Green) Indicator OE:Output Enable LED(Green) 5VDC:Max current consumption Internal power 45mA supply 24VDC:Max current consumption 30mA Accessory Expansion cable(TP03-304EC :

8-20 Chapter 8 Expansion Function Expansion card

4cm,26pin) Terminal block description Symbol Content Symbol Content Upside Signal input terminal(Input Downsi Output wiring terminal X0~X3 Y0~Y3 termin terminal) de block(Output terminal) al Common circuit terminal terminal Common circuit terminal S/S C0 block block(Common terminal) block block(Common terminal) Note:4 output points share a common terminal. Internal circuit

5V COM

Trigger Input Output Circuit S/S Y0 1

8-21 Chapter 8 Expansion Function Expansion card

2.1.5 AP-8EYR Specification

Item Specification Outline figure In pu point 0 t point 8 Upside terminal block Voltage AC 250V/DC 30V Current 2A/1 point; 5A/1 common terminal Type Relay Mechanical 20,000,000 times lifespan Y0 Y2 C0 Y1 Y3 * O Electric 100,000 times @ 2A ut lifespan pu Response 10ms t time Minimum 1mA @ 5VDC load LED indicator is ON when input is Indicator ON Insulation Relay Y4 Y6 method C1 Y5 Y7 * PWR:5V Power LED(Green) Indicator OE:Output Enable LED(Green) 5VDC:Max current consumption Internal power 25mA supply 24VDC:Max current consumption Downside terminal block 70mA Expansion cable(TP03-304EC : Accessory 4cm,26pin) Terminal block description Symbol Content Symbol Content Output wiring terminal Down Output wiring terminal Upside Y0~Y3 Y4~Y7 block(Output terminal) side block(Output terminal) termin termin al Common circuit terminal Common circuit terminal C0 al C1 block block(Common terminal) block(Common terminal) block Note:4 output points share a common terminal. Internal circuit

8-22 Chapter 8 Expansion Function Expansion card

Y0

Trigger Output Circuit

COM

8-23 Chapter 8 Expansion Function Expansion card

2.1.6 AP-8EYT Specification

Item Specification Outline figure In pu point 0 t Upside terminal block point 8 Voltage DC 24V 0.3A/1 point; 1.2A/1 common Current terminal Type Transistor NPN Y0 Y2 * O C0 Y1 Y3 Response ut Smaller than 1ms time pu Minimum t 1mA @ 5VDC load LED indicator is ON when input is Indicator ON Insulation Photo-coupling insulation method PWR:5V Power LED(Green) Y4 Y6 * Indicator C1 Y5 Y7 OE:Output Enable LED(Green) 5VDC:Max current consumption Internal power 25mA supply 24VDC:Max current consumption

70mA Downside terminal block Expansion cable(TP03-304EC : Accessory 4cm,26pin) Terminal block description Symbol Content Symbol Content Upsi Output wiring terminal Output wiring terminal Y0~Y3 Dow Y4~Y7 de block(Output terminal) block(Output terminal) nside term termi inal Common circuit terminal Common circuit terminal C0 nal C1 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit

8-24 Chapter 8 Expansion Function Expansion card

COM Outp Trigger Circuit ut Y0

8-25 Chapter 8 Expansion Function Expansion card

2.1.7 AP-8EYP Specification

Item Specification Outline figure In pu point 0 Upside terminal block t point 8 Voltage DC 24V 0.3A/1 point; 1.2A/1 common Current terminal Y0 Y2 Type Transistor PNP C0 Y1 Y3 * O Response ut Smaller than 1ms time pu Minimum t 1mA @ 5VDC load LED indicator is ON when input is Indicator ON Insulation Photo-coupling insulation method PWR:5V Power LED(Green) Indicator Y4 Y6 * OE:Output Enable LED(Green) C1 Y5 Y7 5VDC:Max current consumption Internal power 25mA supply 24VDC:Max current consumption 70mA Expansion cable(TP03-304EC : Downside terminal block Accessory 4cm,26pin) Terminal block description Symbol Content Symbol Content Upsi Output wiring terminal Output wiring terminal Y0~Y3 Dow Y4~Y7 de block(Output terminal) block(Output terminal) nside term termi inal Common circuit terminal Common circuit terminal C0 nal C1 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit

8-26 Chapter 8 Expansion Function Expansion card

Y0

Outp Trigger Circuit ut COM

8-27 Chapter 8 Expansion Function Expansion card

2.1.8 AP-8EXD Specification

Item Specification Outline figure point 8 Voltage DC 24V±10% Current 7mA @ 24VDC Upside terminal block Impedance 3.3kΩ Type. ON voltage/curre 15VDC(4.2mA) or above(min) nt level X0 X2 OFF S/S0 X1 X3 * Input voltage/curre 9VDC(2.5mA) or below(max) nt level Response OFF→ON:3ms time ON→OFF:3ms LED indicator is ON when input Indicator is ON Insulation Photo-coupling insulation method

Output point 0 X4 X6 S/S1 X5 X7 * Indicator PWR:5V Power LED(Green) 5VDC:Max current consumption 50mA Internal power supply 24VDC:Max current consumption 2mA Downside terminal block Expansion cable(TP03-304EC : Accessory 4cm,26pin) Terminal block description Symbol Content Symbol Content Signal input Signal input terminal(Input Upside X0~X3 Downside X4~X7 terminal(Input terminal) terminal) terminal terminal Common circuit terminal Common circuit terminal block S/S0 block S/S1 block(Common terminal) block(Common terminal) Note:4 output points share a common terminal. Internal circuit 5V

Input S/S

1

8-28 Chapter 8 Expansion Function Expansion card

2.1.9 AP-16EMR Specification

Item Specification Outline figure point 8 Voltage DC 24V±10% Current 7mA @ 24VDC Impedance 3.3kΩ Type. ON voltage/curre 15VDC(4.2mA) or above(min) nt level In OFF pu voltage/curre 9VDC(2.5mA) or below(max) t Upside terminal block nt level Response OFF→ON:3ms time ON→OFF:3ms LED indicator is ON when input is Indicator ON X0 X2 X4 X6 * Insulation S/S X1 X3 X5 X7 Photo-coupling insulation method point 8 Voltage AC 250V/DC 30V Current 2A/1 point; 5A/1 common terminal Type Relay Mechanical 20,000,000 times lifespan O Electric 100,000 times @ 2A ut lifespan Y0 Y2 C1 Y5 Y7 C0 Y1 Y3 Y4 Y6 pu Response 10ms t time Minimum 1mA @ 5VDC load LED indicator is ON when input is Indicator ON Downside terminal block Insulation Relay method PWR:5V Power LED(Green) Indicator OE:Output Enable LED(Green) 5VDC:Max current consumption Internal power 55mA supply 24VDC:Max current consumption 70mA

8-29 Chapter 8 Expansion Function Expansion card

Expansion cable(TP03-304EC : Accessory 4cm,26pin) Terminal block description Symbol Content Symbol Content Upsi Signal input terminal(Input Output wiring terminal X0~X7 Dow Y0~Y7 de terminal) block(Output terminal) nside term termi inal Common circuit terminal Common circuit terminal S/S nal C0~C1 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit 5V 1

Inpu Outp RY

S/S t ut COM

1

8-30 Chapter 8 Expansion Function Expansion card

2.1.10 AP-16EMT Specification

Item Specification Outline figure point 8 Voltage DC 24V±10% Current 7mA @ 24VDC Impedance 3.3kΩ Type. ON voltage/curre 15VDC(4.2mA) or above(min) nt level In OFF pu voltage/curre 9VDC(2.5mA) or below(max) Upside terminal block t nt level Response OFF→ON:3ms time ON→OFF:3ms LED indicator is ON when input is Indicator ON X0 X2 X4 X6 S/S X1 X3 X5 X7 * Insulation Photo-coupling insulation method point 8 Voltage DC 24V 0.3A/1 point; 1.2A/1 common Current terminal Type Transistor NPN O Response ut Smaller than 1ms time pu Y0 Y2 C1 Y5 Y7 Minimum C0 Y1 Y3 Y4 Y6 t 1mA @ 5VDC load LED indicator is ON when input is Indicator ON Insulation Photo-coupling insulation method Downside terminal block PWR:5V Power LED(Green) Indicator OE:Output Enable LED(Green) 5VDC:Max current consumption Internal power 55mA supply 24VDC:Max current consumption 70mA Expansion cable(TP03-304EC : Accessory 4cm,26pin) Terminal block description

8-31 Chapter 8 Expansion Function Expansion card

Symbol Content Symbol Content Upsi Signal input terminal(Input Output wiring terminal X0~X7 Dow Y0~Y7 de terminal) block(Output terminal) nside term termi inal Common circuit terminal Common circuit terminal S/S nal C0~C1 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit

5V COM

Inpu Outp Trigger Circuit t S/S ut Y0 1

8-32 Chapter 8 Expansion Function Expansion card

2.1.11 AP-16EMP Specification

Item Specification Outline figure point 8 Voltage DC 24V±10% Current 7mA @ 24VDC Impedance 3.3kΩ Type. ON voltage/curre 15VDC(4.2mA) or above(min) nt level In OFF pu voltage/curre 9VDC(2.5mA) or below(max) Upside terminal block t nt level Response OFF→ON:3ms time ON→OFF:3ms LED indicator is ON when input is Indicator ON X0 X2 X4 X6 S/S X1 X3 X5 X7 * Insulation Photo-coupling insulation method point 8 Voltage DC 24V 0.3A/1 point; 1.2A/1 common Current terminal Type Transistor PNP O Response ut Smaller than 1ms time pu Y0 Y2 C1 Y5 Y7 Minimum C0 Y1 Y3 Y4 Y6 t 1mA @ 5VDC load LED indicator is ON when input is Indicator ON Insulation Photo-coupling insulation method Downside terminal block PWR:5V Power LED(Green) Indicator OE:Output Enable LED(Green) 5VDC:Max current consumption Internal power 55mA supply 24VDC:Max current consumption 70mA Expansion cable(TP03-304EC : Accessory 4cm,26pin) Terminal block description

8-33 Chapter 8 Expansion Function Expansion card

Symbol Content Symbol Content Upsi Signal input terminal(Input Output wiring terminal X0~X7 Dow Y0~Y7 de terminal) block(Output terminal) nside term termi inal Common circuit terminal Common circuit terminal S/S nal C0~C1 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit 5V COM Inpu Outp Trigger Circuit t S/S ut Y0 1

8-34 Chapter 8 Expansion Function Expansion card

2.1.12 AP-16EYR Specification

Item Specification Outline figure Input point 0 point 16 Voltage AC 250V/DC 30V Upside terminal block Current 2A/1 point; 5A/1 common terminal Type Relay Mechanica 20,000,000 times l lifespan

Electric Y0 Y2 C1 Y5 Y7 100,000 times @ 2A C0 Y1 Y3 Y4 Y6 Outp lifespan ut Response 10ms time Minimum 1mA @ 5VDC load LED indicator is ON when input is Indicator ON Insulation Relay method Y10 Y12 C3 Y15 Y17 PWR:5V Power LED(Green) C2 Y11 Y13 Y14 Y16 Indicator OE:Output Enable LED(Green) 5VDC:Max current consumption Internal power 35mA supply 24VDC:Max current consumption 140mA Downside terminal block Expansion cable(TP03-304EC : Accessory 4cm,26pin) Terminal block description Symbol Content Symbol Content Upsi Output wiring terminal Output wiring terminal Y0~Y7 Dow Y10~Y17 de block(Output terminal) block(Output terminal) nside term termi inal Common circuit terminal Common circuit terminal C0~C1 nal C2~C3 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit

8-35 Chapter 8 Expansion Function Expansion card

Y0 Outp Trigger ut Circuit

CO

8-36 Chapter 8 Expansion Function Expansion card

2.1.13 AP-16EYT Specification

Item Specification Outline figure In pu point 0 t Upside terminal block point 16 Voltage DC 24V 0.3A/1 point; 1.2A/1 common Current terminal Type Transistor NPN Y0 Y2 C1 Y5 Y7 O C0 Y1 Y3 Y4 Y6 Response ut Smaller than 1ms time pu Minimum t 1mA @ 5VDC load LED indicator is ON when input is Indicator ON Insulation Photo-coupling insulation method PWR:5V Power LED(Green) Y10 Y12 C3 Y15 Y17 Indicator C2 Y11 Y13 Y14 Y16 OE:Output Enable LED(Green) 5VDC:Max current consumption Internal power 35mA supply 24VDC:Max current consumption 140mA Downside terminal block Expansion cable(TP03-304EC : Accessory 4cm,26pin) Terminal block description Symbol Content Symbol Content Upsi Output wiring terminal Output wiring terminal Y0~Y7 Dow Y10~Y17 de block(Output terminal) block(Output terminal) nside term termi inal Common circuit terminal Common circuit terminal C0~C1 nal C2~C3 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit

8-37 Chapter 8 Expansion Function Expansion card

Y0 Outp ut Trigger Circuit

COM

8-38 Chapter 8 Expansion Function Expansion card

2.1.14 AP-16EYP Specification

Item Specification Outline figure In pu point 0 t Upside terminal block point 16 Voltage DC 24V 0.3A/1 point; 1.2A/1 common Current terminal Type Transistor PNP Y0 Y2 C1 Y5 Y7 O C0 Y1 Y3 Y4 Y6 Response ut Smaller than 1ms time pu Minimum t 1mA @ 5VDC load LED indicator is ON when input is Indicator ON Insulation Photo-coupling insulation method PWR:5V Power LED(Green) Y10 Y12 C3 Y15 Y17 Indicator C2 Y11 Y13 Y14 Y16 OE:Output Enable LED(Green) 5VDC:Max current consumption Internal power 35mA supply 24VDC:Max current consumption 140mA Downside terminal block Expansion cable(TP03-304EC : Accessory 4cm,26pin) Terminal block description Symbol Content Symbol Content Upsi Output wiring terminal Output wiring terminal Y0~Y7 Dow Y10~Y17 de block(Output terminal) block(Output terminal) nside term termi inal Common circuit terminal Common circuit terminal C0~C1 nal C2~C3 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit

8-39 Chapter 8 Expansion Function Expansion card

COM Trigger Output Circuit

Y0

8-40 Chapter 8 Expansion Function Expansion card

2.1.15 AP-16EXD Specification

Item Specification Outline figure point 16 Voltage DC 24V±10% Current 7mA @ 24VDC Impedance 3.3kΩ Type. Upside terminal block ON voltage/curre 15VDC(4.2mA) or above(min) nt level In OFF pu voltage/curre 9VDC(2.5mA) or below(max) X0 X2 X4 X6 t S/S0 X1 X3 X5 X7 * nt level Response OFF→ON:3ms time ON→OFF:3ms LED indicator is ON when input is Indicator ON Insulation Photo-coupling insulation method O ut point 0 X10 X12 X14 X16 pu S/S1 X11 X13 X15 X17 * t Indicator PWR:5V Power LED(Green) 5VDC:Max current consumption Internal power 75mA supply 24VDC:Max current consumption Downside terminal block 2mA Expansion cable(TP03-304EC : Accessory 4cm,26pin) Terminal block description Symbol Content Symbol Content Upsi Signal input terminal(Input Signal input terminal(Input X0~X7 Dow X10~X17 de terminal) terminal) nside term termi inal Common circuit terminal Common circuit terminal S/S0 nal S/S1 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit

8-41 Chapter 8 Expansion Function Expansion card

5V

Inpu

t S/S

1

8-42 Chapter 8 Expansion Function Expansion card

2.1.16 AP-32EMR Specification

Symbol Content Symbol Content point 16 point 16 Voltage DC 24V±10% Voltage AC 250V/DC 30V 2A/1 point; 5A/1 common Current 7mA @ 24VDC Current terminal Impedanc 3.3kΩ Type. Type Relay e ON Mechanic voltage/c 15VDC(4.2mA) or al 20,000,000 times urrent above(min) lifespan level Inpu OFF Outp t voltage/c 9VDC(2.5mA) or ut Electric 100,000 times @ 2A urrent below(max) lifespan level Response OFF→ON:3ms 10ms Response time time Minimum ON→OFF:3ms 1mA @ 5VDC load LED indicator is ON when LED indicator is ON when Indicator Indicator input is ON input is ON Insulation Insulation Photo-coupling insulation Relay method method Indicator PWR:5V Power LED(Green) OE:Output Enable LED(Green) Internal power 5VDC : Max current consumption 24VDC:Max current consumption supply 77mA 73mA Accessory Expansion cable(TP03-304EC:4cm,26pin) Outline figure Upside terminal block

8-43 Chapter 8 Expansion Function Expansion card

OUT 0V X0 X2 X4 X6 X10 X12 X14 X16 24VDC S/SX1X3X5X7X11X13X15X17 *

FG * C0 Y1 Y3 Y4 Y6 C2 Y11 Y13 Y14 Y16 * L N * Y0 Y2 C1 Y5 Y7 Y10 Y12 C3 Y15 Y17

Downside terminal block Terminal block description Symbol Content Symbol Content Upsi X0~X7; Signal input terminal(Input Y0~Y7; Output wiring terminal Dow de X10~X17 terminal) Y10~Y17 block(Output terminal) nside term termi inal Common circuit terminal Common circuit terminal S/S nal C0~C3 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit 5V 1

Inpu Outp RY

S/S t ut COM

1

8-44 Chapter 8 Expansion Function Expansion card

2.1.17 AP-32EMT Specification

Symbol Content Symbol Content point 16 point 16 Voltage DC 24V±10% Voltage DC 24V 0.3A/1 point; 1.2A/1 Current 7mA @ 24VDC Current common terminal Impedanc 3.3kΩ Type. Type Transistor NPN e ON voltage/c 15VDC(4.2mA) or Response Smaller than 1ms urrent above(min) time level Inpu OFF Outp t voltage/c 9VDC(2.5mA) or ut Minimum 1mA @ 5VDC urrent below(max) load level LED indicator is ON when OFF→ON:3ms Indicator Response input is ON time Insulation ON→OFF:3ms Photo-coupling insulation method LED indicator is ON when Indicator input is ON Insulation Photo-coupling insulation method Indicator PWR:5V Power LED(Green) OE:Output Enable LED(Green) Internal power 5VDC : Max current consumption 24VDC:Max current consumption supply 77mA 73mA Accessory Expansion cable(TP03-304EC:4cm,26pin) Outline figure

8-45 Chapter 8 Expansion Function Expansion card

Upside terminal block

OUT 0V X0 X2 X4 X6 X10 X12 X14 X16 24VDC S/SX1X3X5X7X11X13X15X17 *

FG * C0 Y1 Y3 Y4 Y6 C2 Y11 Y13 Y14 Y16 * L N * Y0 Y2 C1 Y5 Y7 Y10 Y12 C3 Y15 Y17

Downside terminal block Terminal block description Symbol Content Symbol Content Upsi X0~X7; Signal input terminal(Input Y0~7; Output wiring terminal Dow de X10~X17 terminal) Y10~17 block(Output terminal) nside term termi inal Common circuit terminal Common circuit terminal S/S nal C0~C3 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit 5V COM

Inpu Outp Trigger Circuit t S/S ut Y0 1

8-46 Chapter 8 Expansion Function Expansion card

2.1.18 AP-32EMP Specification

Symbol Content Symbol Content point 16 point 16 Voltage DC 24V±10% Voltage DC 24V 0.3A/1 point; 1.2A/1 Current 7mA @ 24VDC Current common terminal Impedanc 3.3kΩ Type. Type Transistor PNP e ON voltage/c 15VDC(4.2mA) or Response Smaller than 1ms urrent above(min) time level Inpu OFF Outp t voltage/c 9VDC(2.5mA) or ut Minimum 1mA @ 5VDC urrent below(max) load level LED indicator is ON when OFF→ON:3ms Indicator Response input is ON time Insulation ON→OFF:3ms Photo-coupling insulation method LED indicator is ON when Indicator input is ON Insulation Photo-coupling insulation method Indicator PWR:5V Power LED(Green) OE:Output Enable LED(Green) Internal power 5VDC : Max current consumption 24VDC:Max current consumption supply 77mA 73mA Accessory Expansion cable(TP03-304EC:4cm,26pin) Outline figure Upside terminal block

8-47 Chapter 8 Expansion Function Expansion card

OUT 0V X0 X2 X4 X6 X10 X12 X14 X16 24VDC S/SX1X3X5X7X11X13X15X17 *

FG * C0 Y1 Y3 Y4 Y6 C2 Y11 Y13 Y14 Y16 * L N * Y0 Y2 C1 Y5 Y7 Y10 Y12 C3 Y15 Y17

Downside terminal block Terminal block description Symbol Content Symbol Content Upsi X0~X7; Signal input terminal(Input Y0~Y7; Output wiring terminal Dow de X10~X17 terminal) Y10~Y17 block(Output terminal) nside term termi inal Common circuit terminal Common circuit terminal S/S nal C0~C3 bloc block(Common terminal) block(Common terminal) block k Note:4 output points share a common terminal. Internal circuit 5V COM Inpu Outp Trigger Circuit t S/S ut Y0 1

8-48 Chapter 8 Expansion Function Expansion card

2.2 Analog Module

The basic unit of AP100 30-point, AP200 and AP300 can be connected with the analog expansion module: 7 AP input-type analog expansion modules and 4 AP output-type analog expansion modules. That is, it has 56 channels of analog input and 8 channels of analog output in maximum.

2.2.1 General Specification

Item Analog expansion unit Dimension(mm) W57×H90×D85 Expanded 24VDC power supply Operation 0~55℃ temperature Storage ﹣25~70℃ temperature Humidity range 5~90%HR(Non-condensing) Frequency Continuous Accidental range Hz Vibration 5≤f<8.4 1.75mm amplitude 3.5mm amplitude resistance 8.4≤f≤150 0.5g continuously 1.0g continuously accelerating accelerating Shock 147 m/s2 (15g), 11 ms duration, 3 shocks per axis, on three mutually resistance perpendicular axis(IEC61131-2) Installation Install directly or DIN rail method Grounding ≤100Ω Insulation Photo-coupling isolation system Insulation 10M Ω or above, 500V DC (between output terminal and secondary circuit) impedance Withstand 500VAC/min (between output terminal and secondary circuit) voltage for

8-49 Chapter 8 Expansion Function Expansion card

insulation Operation LED (5V power LED indicator: Green) indicator Note: Please don't use it in the environment with the pressure exceeding the atmosphere, or it may cause malfunction.

Outline figure:

AP-4RD Analog module module Analog AP-4RD-K AP-4TM AP-2DA AP-3MA AP-8AD

8-50 Chapter 8 Expansion Function Expansion card

2.2.2 AP-8AD Specification

Specification(Analog input unit, 8 12-bit voltage/current input Item channels ) Voltage Current Analog 0V~10V or 1V~5V 0mA~20mA or 4mA~20mA Input range Input impedance 30KΩ Input impedance 250Ω 0000(0V)~4000(10V) or 0000(0mA)~2000(20mA) or Value range 0000(1V)~2000(5V) 0000(4mA)~2000(20mA) Resolution 2.5mV 10μA Accuracy ±1%(at 20℃ ) ±1%(at 20℃ ) Transmit speed 1scan time/ 8 channels Total number of 8 channels channels Analog input terminal(Input A0~A7 terminal) Upside terminal block A0~A7 common circuit C0~C7 terminal(Common terminal) All shielded terminals SHLD Terminal are internally connected. block SHLD Please connect shielded description 0V C0 C1 C2 C3 terminals to FG on the House. +24V A0 A1 A2 A3 ﹢24V 24V 24VDC power input terminal (+) 0V 24V 24VDC power input terminal (-) I A0 is current input S0 V A0 is voltage input Voltage/current input : switch I A7 is current input S7 V V7 is voltage input SHLD C4 C5 C6 C7 PWR:24V Power SHLD A4 A5 A6 A7 Power indicator LED(Green) LNK:Link LED(Green) Internal power supply 5VDC:Max current 30mA 24VDC±20% External power supply (Max current consumption Downside terminal block 50mA) Expansion Accessory cable(TP03-304EC : 4cm , 26pin)

8-51 Chapter 8 Expansion Function Expansion card

Note: When choosing current/voltage mode for 8AD module, the side switch should be on the corresponding level.

8-52 Chapter 8 Expansion Function Expansion card

Circuit diagram

External Shielding Selection device twisted cable A0 switch S0 I0 Optical To basic C0 coupling unit

A/D converte External Shielding Selection r device twisted cable switch A7 S7 I7 C7

Shielding twisted cable 24V 24V Regulator 0V 0V

Regulate voltage/current supply

8-53 Chapter 8 Expansion Function Expansion card

2.2.3 AP-2DA Specification

Specification(Analog output unit, 2 12-bit voltage/current output Item channels ) Voltage Current V0-C0 0V~10V or I0-C0 0mA~20mA or V1-C1 1V~5V I1-C1 4mA~20mA Analog V0±-C2 ﹣10V~﹢10V NA Output range V1±-C3 External connection impedance External connection impedance should be >500Ω should be <500Ω 0000(0V)~4000(10V) or 0000(0mA)~2000(20mA) or Value range 0000(1V)~2000(5V) 0000(4mA)~2000(20mA) Resolution 2.5mV 10μA Accuracy ±1%(at 20℃ ) ±1%(at 20℃ ) Transmit speed 1scan time/ 2 channels Total number of 2 channels channels Upside terminal block Voltage output terminal, V0~V1 outputs voltage signal between V and C Current output terminal, I0~I1 outputs current signal between I 0V I0 SHLD I1 SHLD and C +24V V0 C0 V1 C1 Common ground point of C0~C1 V0~V2 or I0~I2 Voltage output terminal, outputs voltage signal between V and V0±~ Terminal C(﹣10V~﹢10V) V1± block (V,V± can't be used description simultaneously) Common ground point of C2~C3 V0±~V1± * **SHLD SHLD All shielded terminals SHLD * V0㊣ C2 V1㊣ C3 are internally connected. SHLD Please connect shielded terminals to FG on the House. 24V 24VDC power input ﹢24V terminal (+) Downside terminal block 24V 24VDC power input 0V terminal (-) Power indicator PWR:24V Power LED(Green)

8-54 Chapter 8 Expansion Function Expansion card

LNK:Link LED(Green) Internal power supply 5VDC:Max current 30mA 24VDC±20% External power supply (Max current consumption 100mA) Expansion Accessory cable(TP03-304EC:4cm, 26pin)

8-55 Chapter 8 Expansion Function Expansion card

Circuit diagram

Voltage output V0±

External Shielding device twisted cable V0

I0 To basic Optical unit C0 coupling

D/A converte r Current ouput V1± External Shielding device twisted cable V1

I1

C1

Shielding twisted cable 24V 24V Regulator 0V 0V

Regulate voltage/current supply

8-56 Chapter 8 Expansion Function Expansion card

2.2.4 AP-3MA Specification

Specification(Analog input/output unit, Item 2 12-bit analog input channels and 1 12-bit analog output channel) Voltage Current Analog 0V~10V or 1V~5V 0mA~20mA or 4mA~20mA Input Input impedance 30KΩ Input impedance 250Ω range Value 0000(0V)~4000(10V) or 0000(0mA)~2000(20mA) or Input range 0000(1V)~2000(5V) 0000(4mA)~2000(20mA) Total number of 2 channels(However, 4-channel register will be occupied) channels 0V~10V or 0mA~20mA or V2-C2 I2-C2 Analog 1V~5V 4mA~20mA Output V2±-C2 ﹣10V~﹢10V N.A. range External connection impedance External connection impedance should be >500Ω should be <500Ω Output Value 0000(0V)~4000(10V) or 0000(0mA)~2000(20mA) or range 0000(1V)~2000(5V) 0000(4mA)~2000(20mA) Total number of 1 channels(However, 2-channel register will be occupied) channels Resolution 2.5mV 10μA Accuracy ±1%(at 25℃ ) ±1% (at 0~55℃ ) Transmit speed 1scan time/ 3 channels Voltage input terminal, V0~V1 inputs voltage signal between V and C Current input terminal, inputs I0~I1 current signal between I and C, with short circuit to I Common ground point of Terminal C0~C1 V0~V1 or I0~I1 Upside terminal block block Voltage output terminal, outputs description voltage signal between V2 and V2 or C2(﹣10V~﹢10V) V2± (V2, V2± can't be used simultaneously) Current output terminal, I2 outputs current signal between I2 and C2

8-57 Chapter 8 Expansion Function Expansion card

Common ground point of V2, C2 V2± or I2 All shielded terminals SHLD are internally connected. SHLD Please connect shielded 0V I0 SHLD I1 SHLD terminals to FG on the House. +24V V0 C0 V1 C1 24V 24VDC power input ﹢24V terminal (+) 24V 24VDC power input 0V terminal (-) PWR:24V Power Power indicator LED(Green) LNK:Link LED(Green) Internal power supply 5VDC:Max current 30mA 24VDC±20% * I2 SHLD * * * V2 V2㊣ C2 * External power supply (Max current consumption 85mA)

Expansion Accessory cable(TP03-304EC:4cm, 26pin) Downside terminal block

8-58 Chapter 8 Expansion Function Expansion card

Circuit diagram Analog input circuit digram

External Shielding Selection device twisted cable A0 switch S0 I0 Optical To basic C0 coupling unit

A/D converter External Shielding Selection device twisted cable switch A7 S7 I7 C7

Shielding twisted cable 24V 24V Regulator 0V 0V

Regulating voltage/current supply

Analog output circuit diagram

8-59 Chapter 8 Expansion Function Expansion card

Voltage output Vout±

External Shielding device twisted cable Vout

Iout To basic Optical D/A unit COM converte coupling r

Current output

Shielding twisted cable 24V 24V Regulator 0V 0V

Regulating voltage/current supply

8-60 Chapter 8 Expansion Function Expansion card

2.2.5 AP-4RD Specification

Item Specification(Analog input unit, 4 12-bit PT100 input channels ) Temperature input Pt100:﹣100~600℃℃ (60Ω~313Ω) range Digital output ﹣1000~6000 (﹣100℃℃ ~600 ) Resolution 2.5mV Accuracy ±1% FSR (﹣100℃℃ ~600 ) RTD;α=0.00385;2 or 3 Sensor type wires Transmit speed 1scan time/ 4 channels Upside terminal block Total number of 4 channels channels Thermistor (Pt100) signal input A0~A3 A Thermistor (Pt100) signal input B0~B3 0V b0 SHLD b1 SHLD B +24V A0 B0 A1 B1 Thermistor (Pt100) signal input b0~b3 b Terminal All shielded terminals SHLD block are internally connected. description SHLD Please connect shielded terminals to FG on the House. 24V 24VDC power input ﹢24V terminal (+)

24V 24VDC power input SHLDb2 SHLD b3 SHLD 0V SHLD A2 B2 A3 B3 terminal (-) PWR:24V Power LED(Green) Power indicator LNK:Link LED(Green) Internal power supply 5VDC:Max current 50mA 24VDC±20% External power supply (Max current consumption Downside terminal block 100mA) Expansion Accessory cable(TP03-304EC:4cm, 26pin) Note: The channels set on the master should be corresponding to the channels used by the module, and the idle channels should be set with non-operating method. Otherwise, error will occur.

8-61 Chapter 8 Expansion Function Expansion card

Circuit diagram

Shielding cable External device外部設備 屏蔽綫 A0 Optical coupling PT100 B0 b0 pia coup Optical

SHLD A/D 光耦閤 A/D converter 至基本組

轉換器 ling To basic unit

External device 外部設備 屏蔽綫Shielding cable A3 PT100 B3 b3

SHLD

Shielding twisted cable 屏蔽雙絞綫 24V 24V Regulator 穩壓器 0V 0V

穩定電壓/電流供應 Regulating

voltage/current supply

8-62 Chapter 8 Expansion Function Expansion card

2.2.6 AP-4RD-K Specification

Item Specification(Analog input unit, 4 12-bit PT1000 input channels ) Temperature input Pt1000:﹣50℃℃ ~200 (803Ω~1758Ω) range Digital output ﹣500~2000 (﹣50℃℃ ~200 ) Resolution 2.5mV Accuracy ±1% FSR (﹣50℃℃ ~200 ) RTD;α=0.00385;2 or 3 Sensor type wires Transmit speed 1scan time/ 4 channels Upside terminal block Total number of 4 channels channels Thermistor (Pt1000) signal A0~A3 input A Thermistor (Pt1000) signal B0~B3 0V b0 SHLD b1 SHLD input B +24V A0 B0 A1 B1 Thermistor (Pt1000) signal b0~b3 input b Terminal All shielded terminals SHLD block are internally connected. description SHLD Please connect shielded terminals to FG on the House. 24V 24VDC power input ﹢24V terminal (+)

24V 24VDC power input SHLDb2 SHLD b3 SHLD 0V SHLD A2 B2 A3 B3 terminal (-) PWR:24V Power LED(Green) Power indicator LNK:Link LED(Green) Internal power supply 5VDC:Max current 50mA 24VDC±20% External power supply (Max current consumption Downside terminal block 100mA) Expansion Accessory cable(TP03-304EC:4cm, 26pin)

8-63 Chapter 8 Expansion Function Expansion card

Circuit diagram

External device外部設備 屏蔽綫Shielding cable A0 B0 PT1000 b0 Optical coupling

SHLD converter A/D A/D 光耦閤 轉換器 至基本組 To basic unit

External外部設備 device Shielding屏蔽綫 cable A3 B3 PT1000 b3

SHLD

Shielding twisted cable 屏蔽雙絞綫 24V 24V Regulator 穩壓器 0V 0V

穩定電壓/電流供應 Regulating

voltage/current supply

8-64 Chapter 8 Expansion Function Expansion card

2.2.7 AP-4TM Specification

Specification(Analog input unit, 4 12-bit J/K temperature input Item channels ) J type K type Temperature input ﹣100℃℃ ~700 ﹣100℃℃ ~1200 range Digital output ﹣1000~7000 ﹣1000~12000 Resolution 2.5mV Upside terminal block Accuracy ±1% FSR Sensor type Thermocouple J/K type Transmit speed 1scan time/ 4 channels Total number of 4 channels channels 0V **** TC0﹢~ Thermistor (J,K type) signal +24V TC0+ TC0- TC1+ TC1- TC3﹢ input+ terminal TC0﹣~ Thermistor (J,K type) signal Terminal TC3﹣ input- terminal block 24V 24VDC power input description ﹢24V terminal (+) 24V 24VDC power input 0V terminal (-) PWR:24V Power LED(Green) Power indicator LNK:Link LED(Green) ***** * TC2+ TC2- TC3+ TC3- Internal power supply 5VDC:Max current 50mA 24VDC±20% External power supply (Max current consumption 150mA) Expansion cable(TP03-304EC: Accessory 4cm,26pin) Downside terminal block

8-65 Chapter 8 Expansion Function Expansion card

Circuit diagram External device Shielding twisted cable TC0+ J,K To basic Type Optical unit coupling TC0-

A/D converter External device Shielding twisted cable TC3+ J,K Type

TC3-

Shielding 24V 24V twisted cable Regulator 0V 0V

Regulating voltage/current supply

8-66 Chapter 8 Expansion Function Expansion card

2.2.8 Wiring

Wiring figure of analog expansion unit for input(A/D):

V+ CH1 com Inverter

CH2 V+

com

1. The cable for analog input should be standard isolated twisted cable, which should be away from the power line or other wires that may cause interruption. (It is recommended that the cable should be less than 3m in length) 2. Connect the common terminal to system ground, and then ground the system properly. Both voltage and current inputs are available for analog unit: However, the signal should be less than 15V or 30mA, or the analog unit will be damaged.

Wiring figure of analog expansion unit for output(D/A):

V+ CH1 com Inverter

CH2 V+

com

1. The cable for analog input should be isolated twisted cable, which should be away from the power line or other wires that may cause interruption. (It is recommended that the cable should be less than 3m in length) 2. The improper wiring will result in wrong operation or damage the basic unit. The short circuit in the voltage output will damage the basic unit permanently. Please pay attention to that.

You can choose the voltage output or current output for the analog output unit:

8-67 Chapter 8 Expansion Function Expansion card

External device

External device

Isolation amplifier ● Keep the wire without the shield as short as possible (30mm or shorter). Connect the shield-net with the SHLD terminal, which should be connected with Flame grand through the conducting wire of apx. 1.25mm2. ● Use 24VDC power supply or 24V output of basic unit for the D/DA module.

8-68 Chapter 8 Expansion Function Expansion card

2.2.9 Use Instructions

7 AP analog expansion modules for input (If 7 AP-8AD units are used, there will be 56 input channels. For AP-4RD, there will be 28 input channels) and 4 AP analog expansion units for output (If 4 AP-2DA are used, there will be 8 output channels). That is, the basic unit can expand to 56-channel analog input and 8-channel analog output maximumly. When using it, you should pay attention to the following points: 1. One expansion unit with both input and output(AP-3MA) will occupy two expansion units, one of which is for input, while the other is for output. 2. The total channels of each analog expansion unit is determined by the special function of each unit. ( For the information about channels of each module, please refer to the respective specification in the chapter below) 3. AP expansion analog unit should be connected with the expansion port of AP basic unit. The corresponding channels are numbered from the left to the right expansion port of the basic unit. 4. AP-3MA will occupy 4 AD channels. The first two are corresponding with the practical analog input,while the other two are null. AP-3MA will occupy 2 DA output channels. The first one is corresponding with the practical analog output, while the other one is null.

Example 1: AD channel Basic unit AP-130BT-A AP-8AD AP-3MA AP-8AD AP-4RD

Number of Corresponding Channel Channel Channel Channel Channel 11 and 12 AD channel: 1~8 9~10 13~20 21~24 are unavailable

8-69 Chapter 8 Expansion Function Expansion card

Example 2: Max basic system configuration Max basic unit includes: TP03-01SPS-A+multiple common I/O expansion units (AP100 can expand 128 points maximumly, AP200 can expand 256 points maximumly, and AP300 can expand 384 points maximumly)+(AP-8AD)×7+(AP-2DA)×4

Basic unit AP-130BT-AMultiple digital modules7 AP-8ADs 4 AP-2DAs

Note: 1. The last unit should be plugged with the loop terminal connector (TP-200EC). 2. The figure above is only the logic relationship instead of the practical connection. In practice, different numbers of power modules will be added into due to different applications. (Please see 2.4 Power Supply Module of this document)

Channel Configuration Relationship Analog expansion unit for input Analog expansion unit for output (System will read data in the channel (System will read data from Channel and write them in the corresponding corresponding address and output data address every time after the scan them to individual channels during is completed) the scan) Data address Data address Channel 1 D8436 D8381 Channel 2 D8437 D8382 Channel 3 D8438 D8383 … … … Channel 9 D8444 D8389 Channel 10 D8445 D8390 … … Channel 59 D8494 Channel 60 D8495 Channel 61 D8496(Reserved) Channel 62 D8497(Reserved) Channel 63 D8498(Reserved) Channel 64 D8499(Reserved)

8-70 Chapter 8 Expansion Function Expansion card

System Setting for System Memory Please set the system memory in advance, so that the system will obtain the number of modules in use. System memory Setting Default Remark Set number of modules in use for AP D8257 0~7 0 analog expansion unit for input Set number of modules in use for AP D8259 0~8 0 analog expansion unit for output Software filter for analog expansion unit for input(AD) D8260 0: no software filter 0 1~3:Software filter mode 1~3 D8261 Operation mode for AD module: to set 4 HEX codes H**** in AD channel 1~4 D8262 register # D8261~ # D8276, in which the low word is AD channel 5~8 corresponding to the AD channel with small number. Register … … content) =0:AD mode is disabled; =4:PT100 D8274 =1:0~10V voltage input =5:PT1000 0 AD channel 53~56 D8275 mode(0~4000) =6:J AD channel 57~60 =2:0~20mA current input =7:K mode(0~2000) Reserved D8276 =3:4~20mA current input mode AD channel 61~64 or 1~5V voltage input mode(0~2000) Operation mode for DA module: to set 4 HEX codes H**** in D8277 register # D8277~ # D8279, in which the low word is DA channel 1~4 corresponding to the DA channel with small number. Register content D8278 DA channel 5~8 =0:DA mode is disabled; 0 =1:0~10V voltage output mode(0~4000) =2:0~20mA current output mode(0~2000) D8279 DA channel 9~10 =3:4~20mA current output mode or 1~5V voltage input mode(0~2000) Number error for AD modules: M8257 OFF ON:D8257 set value is out of range Channel number error for DA modules: M8258 OFF ON:D8259 set value is out of range

8-71 Chapter 8 Expansion Function Expansion card

For example: AD mode D8261=H0123 AD CH1=3,4~20mA current input mode or 1~5V voltage input mode (0~2000); AD CH2=2,0~20mA current input mode(0~2000); AD CH3=1,0~10V voltage input mode(0~4000); AD CH4=0,AD mode is disabled. For example: DA mode D8278=H3210 DA CH5=0,DA mode is disabled; DA CH6=1,0~10V voltage output mode(0~4000); DA CH7=2,0~20mA current output mode(0~2000); AD CH1=3,4~20mA current output mode or 1~5V voltage output mode (0~2000);

A. Software filter for analog expansion unit for input Software filter: (Mode 1): Refresh data in each scan time. Sample the latest 5 AD data, then eliminate the max and min data, finally get the average value of the remained 3 data. (Mode 2): Refresh data in every 5 scan times. Sample the 5 consecutive data from mode 1, then get the average of the 5 data. (Mode 3): Refresh data in every 25 scan times. Sample the 5 consecutive data from mode 2, then get the average of the max and min data. 1234567891011

Data memory changes For time ①②③④⑤⑥⑦⑧⑨⑩

⑴⑵⑸exam ple: Sampling data 1=161, Sampling data 2=120, Sampling data 3=154, Sampling data 4=160, Sampling data 5=190, Sampling data 6=169, Sampling data 7=110, Sampling data 8=121, Sampling data 9=150, Sampling data 10=198, Sampling data 11=199. ■ Mode 1: ①Refresh data=(161+154+160) / 3=158—filter(1,2,3,4,5) The data of maximum value 190 and minimum value 120 will be deleted. ②Refresh data=(154+160+169) / 3=161—filter(2,3,4,5,6) The data of maximum value 190 and minimum value 120 will be deleted. ③Refresh data=(154+160+169) / 3=161—filter(3,4,5,6,7) The data of maximum value 190 and minimum value 110 will be deleted.

8-72 Chapter 8 Expansion Function Expansion card

: : ⑦Refresh data=(121+150+198) / 3=156—filter(7,8,9,10,11) The data of maximum value 199 and minimum value 110 will be deleted. ■ Mode 2: Get the average value of the 5 data from mode 1 (①+②+③+④+⑤) / 5 ■ Mode 3: Get the average value of the max and min data among 5 consecutive data from mode 2. This mode can efficiently filter the ripple or ripple noise. (max + min)/2, wherein the range of max and min value is within ( ⑴⑵⑶⑷⑸ ),

8-73 Chapter 8 Expansion Function Expansion card

2.3 Communication Module

Type Expanded Input/Outpu power Description Dimension t points supply TP03-PBUS N.A Profibus-DP slave TP03-DNET 24VDC N.A DeviceNet slave W38×H90×D59mm EN01 N.A TCP/IP

Outline figure:

TP03-PBUS TP03-DNET EN01

8-74 Chapter 8 Expansion Function Expansion card

2.4 Power Supply Module

TP03-01SPS-A is an expansion power module of AC 100~240V for serial connection with the expansion modules. AP basic units supplies 5V and internal 24V power for the modules in front of the expansion power supply(on the left), while the expansion power module supplies power for other modules(on the right).

TP03-01SPS-A Dimension: W57×H90×D83mm Specification: 5V output 250mA Internal 250mA 24V External 400mA 24V

According to the specification, PLC of AP series can expand the digital I/O to 128 points(AP100), 256 points (AP200), 384 points(AP300) in maximum, which can expand the analog of 56-channel input and 8-channel output. However, it shall consider the power restriction in practice. Power supply module shall be added in case of insufficient power. Before connected with the power module, you should calculate the total power required by all expansion modules to be connected with AP basic unit. If the AP basic unit can't satisfy, you should add power module in proper position(add one or more power modules upon demands), so that all expansion modules can be supplied with power properly.

The restriction of power supply mainly considers whether the internal 5V power supply and internal 24V output of the basic unit can satisfy the expansion.

2.4.1 5V Power Restriction

5V Power Specification Series type AP-130 AP200 Series AP300 Series AP-32E 5V output(mA) 300 500 500 500

8-75 Chapter 8 Expansion Function Expansion card

5V power consumption 5Vpower consumed by the basic unit Basic unit type 5V current (mA)(max) Module Type 5V current (mA)(max) AP-130 130 AP-324 150~160 AP-224 150 AP-332 160~170 AP-232 150 AP-340 180~190 AP-240 180 AP-360 230~240 AP-260 230

5V power consumed by the expansion module Module Type 5V current (mA)(max) Module Type 5V current (mA)(max) AP-8EMR 15 AP-16EMR 30 AP-8EMT 15 AP-16EMT 30 AP-8EMP 15 AP-16EMP 30 AP-8EYR 25 AP-16EYR 40 AP-8EYT 25 AP-16EYT 40 AP-8EYP 25 AP-16EYP 40 AP-8EXD 10 AP-16EXD 20 AP-32EMR-A 30 AP-4RD 30 AP-32EMT-A 30 AP-4RD-K 30 AP-32EMP-A 30 AP-4TM 30 AP-2DA 30 AP-3MA 30 AP-8AD 30

8-76 Chapter 8 Expansion Function Expansion card

2.4.2 Internal 24V Power Restriction

Internal 24V Power Specification Type 24V current (mA)(max) Type 24V current (mA)(max) AP-110 200 AP-260 500 AP-114 200 AP-324 300 AP-120 200 AP-332 300 AP-130 300 AP-340 500 AP-224 300 AP-360 500 AP-232 300 AP-32E 300 AP-240 500

8-77 Chapter 8 Expansion Function Expansion card

Internal 24V Power Consumption When the main unit and each output point is ON, the power consumption is 8mA. Thus, if the 24V power specification of the main unit is 300mA, it could drive 37 output points ON in maximum simultaneously.

For example: AP-130BR-A+3×AP-16EMR+1×AP-8AD. It doesn't require the expansion power supply module to judge whether it is available. Step 1, calculate the consumed 5V current based on the 5V power consumption table. AP-130BR-A+3×AP-16EMR+AP-8AD 5V Configuration Quantity Total(mA) consumption(mA) AP-16EMR 3 30 AP-8AD 1 30 250 AP-130BR-A 1 130

Step 2, calculate the maximum consumption of internal 24V AP-130BR-A+3×AP-16EMR+AP-8AD Output Internal 24V Configuration Quantity Total(mA) point consumption(mA) AP-16EMR 3 8 64 AP-8AD 1 0 0 304 AP-130BR-A 1 14 112

Step 3, fill in the table below. It will be judged as OK if the actual value is within the specification. If all items are OK, it could be connected directly. If the power supply exceeds the specification, it requires adding power supply. Item Digital I/O points AD/DA points 5V power supply(mA) Internal 24V power(mA) Specification 128 56/8 300 300 Actual value 78 8/0 250 304 Judge OK OK OK NG

Conclusion: The internal 24V power supply can't satisfy the demands, so it requires adding power supply module.

8-78 Chapter 9 Supplementary Interpretation of Basic Functions Table of Contents

Chapter 9 Supplementary Interpretation of Basic Functions ...... 2 1 Additional Interpretation for Special Devices ...... 2 2 Relation of Control Instructions of Program Flow ...... 7 3 ASCII Character Arrangement ...... 9 4 Error Code List ...... 10 5 Special Device List ...... 17 5.1 Auxiliary Relay M ...... 17 5.2 Data register D ...... 35

9-1

Chapter 9 Supplementary Interpretation of Basic Functions Table of Contents

Chapter 9 Supplementary Interpretation of Basic Functions

1 Additional Interpretation for Special Devices

PLC Operation Flags M8000,M8001 M8000 and M8001 are RUN monitoring flags for the PLC operation status, which are taken as driving conditions for the normally enabled operation.

M8000 “Normal operation” Y000

During run, the Frequent output drive expected constant is ON When M8001 is RUN, the constant is OFF

M8002,M8003 After the PLC starts to run, the initial pulse M8002 is only ON during the first computation cycle, which will keep OFF in the left time. The pulse is taken as the initial setting signal for program initialization, writing specified values and other conditions.

M8002 Clearing of data F40 ZRST D200 D299 registers for holding D200~D299 Initial pulse(Contact a)

M8003 is OFF for one computation cycle after RUN, and it keeps ON in other left time. Time sequence of mark action RUN input In RUNIn STOP In RUN

M8000 RUN monitoring(Contact a) ON ON

M8001 ON RUN monitoring(Contact b) M8002 Initial pulse(Contact a) ON ON

M8003 ON ON Initial pulse(Contact b)

9-2

Chapter 9 Supplementary Interpretation of Basic Functions Table of Contents

Computation time (monitoring of scan time) Computation time of PLC is stored in D8010~D8012.

D8010 Current value Scan Peripheral equipment Can be used To D8011 Min value cycle monitor the values of each device. D8012 Max value The machine offers the following four internal clocks. When the PLC is powered on, the four types of time will keep oscillating.

10ms M8011 (10ms)

100ms M8012 (100ms)

1s M8013 (1s)

1min M8014 (1min)

Note:Note: even the PLC is STOP, the clock still keeps operating. Therefore, falling edge of RUN monitoring (M8000) is not synchronous with the start time of the clock.

RTC

Clock setting of PLC

Y: D8018 M: D8017 D: D8016 WK: D8019

H: D8015 M: D8014 S: D8013

M8015 M8015 Stop timing Reset clock and start ON OFF

The clock is stopped by setting M8015 ON. User could input the time value to be calibrated in each time register(D8013~D8019), and set M8015 OFF, and then the clock will be started with the new time.

9-3

Chapter 9 Supplementary Interpretation of Basic Functions Table of Contents

For example: The figure shows how to set time by executing the normal program. Set X000 on to set time, and then set X000 OFF to start clock.

X000 M8015 PLF M0 M0 MOV K30 D8013 MOV K20 D8014 MOV K10 D8015 MOV K25 D8016 MOV K4 D8017 MOV K0 D8018 MOV K2 D8019

Notes for clock calibration 1. When M8015 is OFF, no change can be done to the time register. 2. Please input new time when M8015 is ON. 3. When the setting time is input, the time several minutes earlier than current time shall be set. 4. When it reaches the setting time, M8015 is changed from ON to OFF, the state changes, and the new time takes effect and starts timing. 5. When the input time does not exist, the time can not be changed and the correct time data shall be input for a second time. 6. The setting range for D8018 is 2000~2099(representing the years2000 ~2099). 7. When the power is ON, M8015, M8016 and M8017 will be reset.

ID of expansion card D8020: ID for the storage expansion card 1; D8021: ID for the storage expansion card 2. After the expansion card is plugged, it will be identified when the main unit is powered on. Also the ID will be displayed on D8020 and D8021. 0 1 2 3 4 5 Without card AP-485BD AP-232BD AP-COBD AP-ENBD AP-4DBD 6 7 8 9 10 11 AP-4RBD AP-2D2TBD AP-RTCBD AP-2AIBD AP-1AOBD AP-3MABD

9-4

Chapter 9 Supplementary Interpretation of Basic Functions Table of Contents

Instruction execution finishing flag M8029:Instruction execution finishing. It is on for a scan cycle when the following instructions are finished, F57 PLSY, F59 PLSR, F63 INCD, F67 RAMP, F69 SORT, F71 HKY, F72 DSW, F74 SEGL, F77 PR, F156 ZRN, F158 DRVI, F159 DRVA, F200 PPMI, F201 PPMA, F202 DCWI, F203 DCWA, F204 PTPO, F205 CLLM, F206 VSPO, F210 DLINI, F211 DLINA, F212 DCIMI, F213 DCIMA.

ID and specifying ID D8003:Store ID value, Default value is 1. M8128:When M8128 is 1, the value in D8128 will be taken as ID. After the power is ON, M8128 will be reset. In addition, ID could be set under "ID setting" in AP-PCLINK. After the ID is changed, it requires re-downloading the program.

Memory holds in stop mode M8033:Output holding in STOP. The special auxiliary relay M8033 is driven in advance. Even after the PLC is changed from RUN to STOP, it still keeps the output state in operation. After the power is ON, M8033 will be reset.

Instruction for all outputs prohibited M8034:Prohibit all outputs. All output relays become OFF by driving M8034, and the PLC still operates on the image memory. After a power supply is connected, M8034 will be reset.

M8034 All outputs prohibited(Affect RUN)

Constant scan mode Fixing the computation processing time The auxiliary relay M8039 is driven, and the target scan time is written into the data register D8039 with 1ms as unit in advance, and computation cycle of the PLC will not be less than the value. Even the computation ends earlier, it will wait in the left time, and return to the step 0. M8000 M8039 Constant scan mode

Set constant scan F12 MOVP K20 D8039 time at 20ms

9-5

Chapter 9 Supplementary Interpretation of Basic Functions Table of Contents

When the scan synchronous instructions like FUN67(RAMP), FUN71(HKY), FUN74(SEGL), FUN75(ARWS), FUN77(PR) and etc. are executed, it is recommended using constant scan mode or timing interrupted by the timer to drive. Especially the instruction FUN71(HKY) is used, filtration wave for button input will lead to response delay, and the scan time must be set above 20ms. After a power supply is connected, M8039 will be reset. Note:In the scan time of D8010~8012, it includes the specified time of constant scan mode.

Transfer prohibited between states M8040:Transfer prohibited. After driving M8040, even all the transfer conditions are provided, state transfer can not be performed and output in the stop state will continue acting. Please refer to the step instruction interpretation for the output reset.

Specify I/O expansion M8110:I/O expansion function enable. When M8110=OFF, it is the same as the original I/O expansion. When M8110=ON, the expansion quantity is determined by D8110 and D8111. After a power supply is connected, M8110 will be reset. D8110:The total number of the input points X(including main body). When M8110=ON, the value of D8110 will determine the total number of input points X. The value of D8110 shall be smaller than the maximum I/O points of the corresponding model (See section 3.1 for more information). When the value of D8110 is smaller than the X points of the controller body, the specified expansion X points are preset as 0, and the main body X will work normally. When the specified value is not the multiple of 8, the minimum multiple of 8 larger than the specified value will be taken as the specified points. For example: D8110=23, the controller will specify the points as 24, and the expansion quantity is 24﹣16=8. D8111:The total number of the input points Y(including main body). When M8110=ON, the value of D8111 will determine the total number of input points Y. The value of D8111 shall be smaller than the maximum I/O points of the corresponding model (See section 3.1 for more information). When the value of D8111 is smaller than the Y points of the controller body, the specified expansion Y points are preset as 0, and the main body Y will work normally. When the specified value is not the multiple of 8, the minimum multiple of 8 larger than the specified value will be taken as the specified points. For example: D8111=17, the controller will specify the points as 24, and the expansion quantity is 24﹣16=8.

9-6

Chapter 9 Supplementary Interpretation of Basic Functions Additional Interpretation for Special devices

2 Relation of Control Instructions of Program Flow

Relation of the instruction MC-MCR and the instruction CJ has been described in the instruction F0CJ. See the following for the relations of other instructions of program flow. In the following table, ◎ represents the relation of inclusion, and ∞represents repeating of the last and next inter-sections. Example 1:◎ Example 2:∞ Upper Upper instruction Left Left instruction instruction instruction

MC—CJ—P—MCR MC—CJ—MCR—P

MC-MCR CJ-P EI-DI FOR-NEXT STL-RET ◎○ ◎○ example 1 ◎○ ◎○ ◎○ MC-MCR ∞△ ∞△ example 2 ∞△ ∞×(6607) ∞×(6605) ◎○ ◎○ ◎○ ◎○ ◎○ CJ-P ∞△ ∞△ ∞△ ∞△ ∞△ ◎○ ◎○ ◎○ ◎○ ◎○ EI-DI ∞△ ∞△ ∞△ ∞△ ∞△ ◎×(6607) ◎○ ◎○ ◎○16 layers ◎×(6607) FOR-NEXT ∞×(6607) ∞△ ∞△ ∞△*2 ∞×(6607) ◎×(6605) ◎○ ◎○ ◎○in 1 STL ◎○ STL-RET ∞×(6605) ∞△ ∞△ ∞×(6607) ∞△ ◎×(6606) ◎○ ◎○ ◎○ ◎×(6606) P-SRET ∞×(6608) ∞△ ∞△ ∞×(6607) ∞×(6605) ◎×(6606) ◎○ ◎○ ◎○ ◎×(6606) I-IRET ∞×(6606) ∞△ ∞△ ∞×(6607) ∞×(6606) ◎○ ◎○ ◎○ ◎○ ◎○ FEND-END ∞×(6608) ∞△×(6701) ∞△ ∞×(6607) ∞×(6605) ◎○ ◎○ ◎○ ◎○ ◎○ O-FEND ∞△×(6608) ∞△ ∞△ ∞×(6607) ∞×(6605) O-END ◎○ ◎○ ◎○ ◎○ ◎○ (No FEND) ∞×(6608) ∞×(6701) ∞△ ∞×(6607) ∞×(6605) ○:It can be combined without problem. ×:Combined use prohibited, number ( )is error code. △:Although it is not strictly prohibited, it may lead to complication of actions, which shall be avoided as much as possible.

9-7

Chapter 9 Supplementary Interpretation of Basic Functions Additional Interpretation for Special devices

P-SRET I-IRET FEND-END Remark ◎×(6608) ◎×(6608) ◎×(6608) 1. No abnormality display, and DI ∞×(6606) ∞×(6606) ∞×(6608) state forgotten. ◎△ ◎△ ◎△ 2. R FOR NEXT NEXT, such as real ∞△ ∞△ ∞△ line action. ◎○ ◎○ ◎○ 3. FEND and END in the are ∞○ ∞○ ∞○ valid. Not the programs to be written ◎×(6607) ◎×(6607) ◎×(6607) or executed. No abnormality display. ∞×(6701) ∞×(6607) ∞×(6607) ◎×(6605) ◎×(6605) ◎×(6605) Some instructions are exception. ∞×(6606) ∞×(6606) ∞×(6605) The instructions of inclusion relation ◎×(6606) ◎×(6606) ◎×(6709) can be used in combined form and the following exceptions must be paid ∞×(6606) ∞×(6606) ∞×(6709) attention to. ◎×(6606) ◎×(6606) ◎×(6606) 1. MC-MCR can't be used in such ∞×(6606) ∞×(6606) ∞×(6606) instructions as FOR~NEXT, STL-RET, ◎○ ◎○ ◎ P-SRET and I-IRET. ∞×(6709) ∞×(6709) ∞ 2. STL-RET can't be used in such ◎×(6606) ◎×(6606) ◎ instructions as FOR~NEXT, STL-RET, ∞×(6709) ∞×(6606) ∞ P-SRET and I-IRET. ◎×(6606) ◎×(6606) ◎ 3. MC-MCR, FOR-NEXT, P-SRET, I-IRET can not use I, IRET, ∞×(6709) ∞×(6706) ∞ SRET, FEND, END and other instructions. ○:It can be combined without problem. ×:Combined use prohibited, number ( )is error code. △:Although it is not strictly prohibited, it may lead to complication of actions, which shall be avoided as much as possible.

9-8

Chapter 9 Supplementary Interpretation of Basic Functions Program flow

3 ASCII Character Arrangement

《ASC II code list (Represented by 7-bit code and hexadecimal system)》 Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F system 0 DLE SP 0 @P 、 p 1 SOH DC1 ! 1 A Q a q 2 STX DC2 ” 2 B R b r 3 ETX DC3 # 3 C S c s 4 EOT DC4 $ 4 D T d t. 5 ENQ NAK % 5 E U e u 6 ACK SYN & 6 F V f v 7 BEL ETB ’ 7 G W g w 8 BS CAN ( 8 H X h x 9 HT EM ) 9 I Y i y A LF SUB * : J Z j z B VT ESC + ; K [ k { C FF FS , < L \ l ︱ D CR GS - = M ] m } E SO RS ﹒ > N ^ n ~ F SI US / ? O _ o DEL

《Example of ASC II code》 ASC II ASC II ASC II ASC II Decimal English English English (Hexadecimal (Hexadecimal (Hexadecimal (Hexadecimal system letter letter letter system) system) system) system) 0 30 A 41 L 4C W 57 1 31 B 42 M 4D X 58 2 32 C 43 N 4E Y 59 3 33 D 44 O 4F Z 5A 4 34 E 45 P 50 5 35 F 46 Q 51 6 36 G 47 R 52 ASC II 7 37 H 48 S 53 Code (Hexadecimal 8 38 I 49 T 54 system) 9 39 J 4A U 55 STX 02 K 4B V 56 ETX 03

9-9

Chapter 9 Supplementary Interpretation of Basic Functions ASCII Code List

4 Error Code List

Action Error when error Error code description Solution Code occurs Expansion card error[M8060(D8060)] Continue to 0000 No exception — operate No expansion communication (No Continue to expansion card is installed, but the Please check whether the expansion card 6006 operate expansion card related instruction is is installed correctly applied) PLC hardware check[M8061(D8061)] Continue to 0000 No exception — operate Turn on the power supply again. If the 6101 RAM error error still occurs, please return it to the factory for repair. Turn on the power supply again. If the 6102 ROM error error still occurs, please return it to the factory for repair. 6103 Body I/O bus error Return it to the factory for repair. Re-write the user program. If the error 6104 Stop User program error still occurs, please return it to the factory operation for repair. The scan cycle is beyond the range 6105 Watchdog time detecting over time (D8000), please check the user program. Turn on the power supply again. If the 6106 RAM address line error error still occurs, please return it to the factory for repair. Turn on the power supply again. If the 6107 RAM operation error error still occurs, please return it to the factory for repair. Communication error[M8063(D8063)] Continue to 0000 No exception — operate Continue to Confirm the communication parameters, 6301 DTLK2 error operate and connections 9-10

Chapter 9 Supplementary Interpretation of Basic Functions ASCII Code List

Action Error when error Error code description Solution Code occurs Confirm the communication parameters, 6302 RMIO error and connections Parameter error[M8064(D8064)] Continue to 0000 No exception — operate Program and parameter After stopping PLC, set the parameters 6401 mismatching correctly After stopping PLC, set the parameters 6402 Memory capacity setting error Stop correctly operation After stopping PLC, set the parameters 6406 Insufficient RAM correctly After stopping PLC, set the parameters 6409 Other errors correctly Syntax error [M8065(D8065)] Continue to 0000 No exception — operate Instruction address combination Check whether the instructions are 6501 error applied correctly Stop 6504 Repeated pointer Check whether P and I are used correctly operation Check whether the instructions are 6505 Device address is beyond range applied correctly Check whether the instructions are 6506 Using undefined instruction applied correctly and rewrite them into user program Stop If the P symbol is larger than 127, check 6507 Pointer definition error operation whether P is used correctly 6508 Interruption pointer definition error Check whether I is used correctly Check whether the instructions are 6509 Others applied correctly Circuit error[M8066(D8066)] Continue to 0000 No exception — operate Stop MPS continuously used for more 6603 Check the times of using MPS operation than 8 times

9-11

Chapter 9 Supplementary Interpretation of Basic Functions ASCII Code List

Action Error when error Error code description Solution Code occurs Check the relation between MPS, MRD 6604 MPS, MRD and MPP relation error and MPP STL continuously used for more 6605 Check the times of using STL than 16 times 6606 Pointer doesn't exist Check whether P is used correctly Main program has I ,IRET and Check the program, and check whether P 6607 SRET and I are used correctly FOR,NEXT include STL,RET, Check whether the instructions are 6608 MC,MCR, applied correctly SMCS,SMCR,JCS,JCR 6609 CALL has more than 16 levels nest. Check the times of using CALL nesting 6610 FOR and NEXT mismatching Check the use of FOR,NEXT Check the use of supporting JCS and 6611 with JCS and without JCR JCR Check the use of supporting STL and 6612 with STL and without RET RET Check the use of supporting MC and 6613 with MC and without MCR MCR Check the use of supporting SMCS and 6614 with SMCS and without SMCR SMCR 6615 with I and without IRET Check the use of supporting I and IRET MC,MCR,SMCS,SMCR and Check whether the instructions are 6616 SRET exist between STL_RET applied correctly FOR , NEXT has more than 16 6617 Check the times of using FOR,NEXT levels nest. Check the program, and rewrite the 6618 No end program Address returned from IRET is Check whether the interruption program 6619 wrong. is correct Check whether the instructions are 6621 Other errors applied correctly Computation error [M8067(D8067)] Continue to 0000 No exception — operate

9-12

Chapter 9 Supplementary Interpretation of Basic Functions ASCII Code List

Action Error when error Error code description Solution Code occurs Check the operand of the instruction F40 6705 Address conflict ZRST according to the error step number Continue to D8068. operate Check the parameters of the error 6706 Parameter error instruction according to the error step number D8068. Check the settings of the related registers 6707 Related register setting error according to the error step number D8068. Check the parameter settings of F42 6709 Other errors ENCO or F100 STORE according to the error step number D8068. Check the parameter settings of F36 6710 Parameter mismatching WSFR and F37 WSFL according to the error step number D8068. 6711 Over high CSFO input frequency

PID sampling time TS is out of 6730 Check setting of PID sampling time TS range(Ts<0) PID input filter constant is out of Check the setting of PID input filter 6732 Continue to range constant operate PID proportional gain is out of Check the setting of PID proportional 6733 range gain 6734 PID integral time is out of range Check the setting of PID integral time 6735 PID derivative gain is out of range Check the setting of PID derivative gain Check the setting of PID derivative 6736 PID derivative time is out of range time PID sampling time ≤ computation 6740 Check the setting of PID sampling time cycle Overflow of variational value about 6742 Check the setting of PID measuring value measuring in PID Check the setting of related PID 6743 Overflow of deviated value in PID parameters Overflow of integration Check the setting of related PID 6744 computation in PID parameters

9-13

Chapter 9 Supplementary Interpretation of Basic Functions ASCII Code List

Action Error when error Error code description Solution Code occurs Overflow of differential gain leads Check the setting of related PID 6745 to overflow of differential value in parameters PID Overflow of differential Check the setting of related PID 6746 computation in PID parameters Overflow of PID computation Check the setting of related PID 6747 results parameters 6750 PID auto tuning result error Check the setting of PID auto tuning PID auto tuning operation direction 6751 Check the setting of PID auto tuning is inconsistent 6752 PID auto tuning operation error Check the setting of PID auto tuning Error step number D8068 Error Preserve application instruction step — — error step number number Expansion error [M8069(D8069)] Continue to 0000 No exception — operate Check whether the connection wire of the 6903 Expansion I/O error expansion module or the terminal connector works normally. Check whether the number of AD 6904 Continue to AD/DA setting error modules and number of DA channels are operate set correctly. AD unit is not connected with power supply or more than one Check the power supply of AD module 6905 channel set by TP03-4RD is idle and TP03-4RD is loaded load Check whether the expansion point X or Continue to The expansion I/O points are out of 6906 Y of the expansion module is beyond the operate range acceptable maximum value. FROM/TO error[M8070(D8070)] Continue to 0000 No exception — operate

9-14

Chapter 9 Supplementary Interpretation of Basic Functions ASCII Code List

Action Error when error Error code description Solution Code occurs Check whether the configuration and 7001 No response connection are correct SUM verification error for returned Check whether the configuration and 7002 data connection are correct Check whether the configuration and 7003 ASC format error for returned data connection are correct Start/end character error for Check whether the configuration and 7004 returned data connection are correct Functional code error for returned Check whether the configuration and 7005 data connection are correct Module number error for returned Check whether the configuration and 7006 data connection are correct Check whether the configuration and 7007 Number error for returned data Continue to connection are correct operate Check whether the configuration and 7008 Length error for returned command connection are correct SUM verification error for data Check whether the configuration and 7010 received by module connection are correct ASC format error for data received Check whether the configuration and 7011 by module connection are correct Functional code error for data Check whether the configuration and 7012 received by module connection are correct Length error for data received by Check whether the configuration and 7013 module connection are correct BFM range error for data received Check whether the configuration and 7014 by module connection are correct Number out of range for data Check whether the configuration and 7015 received by module connection are correct Communication error[M8124(Built-in communication port)/M8324(Expansion card communication port 1)/M8304(Expansion card communication port 2) (D8345)] Continue to 0000 No exception — operate Continue to Check whether the configuration and 6760 CRC verification error operate connection are correct

9-15

Chapter 9 Supplementary Interpretation of Basic Functions ASCII Code List

Action Error when error Error code description Solution Code occurs Check whether the configuration and 6761 No response connection are correct Check whether the configuration and 6762 Response exception connection are correct Check whether the configuration and 6763 Can't identify returned data connection are correct Error step number D8346 Error Save step number of step — — communication error number

9-16

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

5 Special Device List

5.1 Auxiliary Relay M

Applicable to No. Name Action . Function AP100 AP200 AP300 PLC Status M8000 RUN monitor (NO contact) It is ON when RUN, and OFF when STOP ○ ○ ○ M8001 RUN monitor (NC contact) It is ON when RUN, and OFF when STOP ○ ○ ○ It is ON for a scan period when M8002 Initial pulse (NO contact) ○ ○ ○ STOP→RUN It is ON for a scan period when M8003 Initial pulse (NC contact) ○ ○ ○ STOP→RUN When M8061, M8064, M8065 and M8066 M8004 Error occurrence are ON, it will be ON, and PLC will be ○ ○ ○ forced to stop. It will be ON when M8063, M8067 and M8005 Warning error occurrence ○ ○ ○ M8069 are ON. M8006 Low battery voltage It is ON when battery voltage is too low. × ○ ○ It is ON when battery voltage is too low, Latch for low battery M8007 while OFF when a power supply is × ○ ○ voltage connected. Clock M8011 10ms period oscillation 5ms ON / 5ms OFF ○ ○ ○ M8012 100ms period oscillation 50ms ON / 50ms OFF ○ ○ ○ M8013 1s period oscillation 0.5s ON / 0.5s OFF ○ ○ ○ M8014 1min period oscillation 30s ON / 30s OFF ○ ○ ○ 1:Stop timing 1→0 : Preset clock based on data of M8015 Clock stop and preset D8013~D8019, and enable clock. ○ ○ ○ It will be reset when a power supply is connected. Stop reading/displaying clock time. It will M8016 Stop displaying clock time ○ ○ ○ be reset when a power supply is connected. M8017 ±30s offset +/-30s offset for internal time. It will be ○ ○ ○ 9-17

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 reset when a power supply is connected. Installation detection for internal time. ON M8018 Installation detection ○ ○ ○ status indicates clock exists. M8019 RTC error ON status indicates clock error ○ ○ ○ Flag Computation result is 0 (F20 ADD, F21 SUB, F39 SFRD, F43 SUM, F48 SQR, M8020 Zero ○ ○ ○ F120 EADD, F121 ESUB, F129 INT, F162 TADD, F163 TSUB) Computation result is smaller than the minimum negative number. (F20 ADD, M8021 Borrow ○ ○ ○ F21 SUB, F48 SQR, F129 INT, F162 TADD, F163 TSUB) Computation result is larger than the maximum positive number. (F20 ADD, M8022 Carry F21 SUB,F30 ROR,F31 ROL,F32 ○ ○ ○ RCR , F33 RCL , F38 SFWR , F129 INT,F162 TADD,F163 TSUB) M8024 BMOV direction 0: forward; 1: reverse for F15 BMOV ○ ○ ○ M8026 RAMP mode 0: reset; 1: keep for F67 RAMP ○ ○ ○ M8027 PR mode 0: 8 bytes; 1: 16 bytes for F77 PR ○ ○ ○ FROM/TO interruption Interruption is permitted when executing M8028 × ○ ○ enabled FROM/TO instruction. It is on when the following instructions are finished, F57 PLSY, F59 PLSR, F63 INCD, F67 RAMP, F69 SORT, F71 HKY, F72 DSW, F74 SEGL, F77 PR, F156 ZRN, M8029 Instruction execution ends F158 DRVI, F159 DRVA, F200 PPMI, ○ ○ ○ F201 PPMA, F202 CWI, F203 CWA, F204 PTPO, F205 CLLM, F206 VSPO, F210 LINI, F211 LINA, F212 CIMI, F213 CIMA. PLC Mode M8033 Memory holds in stop mode Memory hold ○ ○ ○

9-18

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 0:Save as required when STOP→RUN 1:Save all when STOP→RUN It will be reset when a power supply is connected. 1:output 0; 0:output Y; M8034 Output prohibit ○ ○ ○ It will be reset when a power supply is connected. When M8035 is ON, the X specified by D8035 can be used for RUN/STOP control. M8035 Force RUN mode ○ ○ ○ It will be reset when a power supply is connected. When M8036 is on, the PLC will switch from STOP to RUN. M8036 Force RUN mode ○ ○ ○ It will be reset when a power supply is connected. When M8037 is on, the PLC will switch from RUN to STOP. M8037 Enforced stop instruction ○ ○ ○ It will be reset when a power supply is connected. 1:Constant mode; 0:Non-constant mode; M8039 Constant scan mode ○ ○ ○ It will be reset when a power supply is connected. Step Ladder M8040 Transfer disabled Transfer is disabled when M8040 is ON. ○ ○ ○ It is the condition to transfer the initial M8041 Transfer start ○[*2] ○ ○ status S2 to the next status. Instant action when pressing the start M8042 Enable pulse ○[*2] ○ ○ button When M8047 is ON and any one of M8046 STL state ON ○ ○ ○ S0~S899 is ON, M8064 will be ON. As long as M8047 is ON, D8040~D8047 M8047 Enable STL monitor ○ ○ ○ are enabled.

9-19

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 When M8049 is ON and any one of M8048 Annunciator ON ○ ○ ○ S900~S999 is ON, M8048 will be ON. As long as M8049 is ON, D8049 is M8049 Enable Annunciator ○ ○ ○ enabled. Interruption Disable Input interruption M8050 ○ ○ ○ disable(I00*) Input interruption M8051 ○ ○ ○ disable(I10*) Input interruption M8052 ○ ○ ○ disable(I20*) Input interruption M8053 ○ ○ ○ disable(I30*) Input interruption M8054 ○ ○ ○ disable(I40*) Input interruption M8055 ○ ○ ○ disable(I50*) Disable Interruption in ON status Input interruption M8055 Initialize to ON when status changes from ○ ○ ○ disable(I50*) STOP to RUN Input interruption M8080 ○ ○ ○ disable(IA0*) Input interruption M8081 ○ ○ ○ disable(IB0*) Input interruption M8082 ○ ○ ○ disable(IC0*) Timing interruption M8083 ○ ○ ○ disable(IDxx) Timing interruption M8057 ○ ○ ○ disable(I7xx) Timing interruption M8058 ○ ○ ○ disable(I8xx) Interruption disable for I010~I060 Counting interruption M8059 Disable Interruption in ON status ○ ○ ○ disable Initialize to ON when status changes from

9-20

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 STOP to RUN Error Detection M8060 Expansion card error ○ ○ ○ M8061 PLC hardware check PLC hardware exception ○ ○ ○ M8063 Communication error ○ ○ ○ M8064 Parameter error ○ ○ ○ M8065 Syntax error ○ ○ ○ M8066 Loop error ○ ○ ○ M8067 Computation error ○ ○ ○ M8068 Reserved ○ ○ ○ M8069 Expansion error ○ ○ ○ M8070 FROM/TO error × ○ ○ Expansion Function When it is OFF, it remains the same as the original expansion I/O. When it is ON, the number of expansion I/O is determined by D8110 and D8111. I/O expansion function When the basic unit is connected with a M8110 ○ ○ ○ enable power supply, and no terminal connector is added, the enabling operation is valid. Otherwise, it is invalid. After a power supply is connected, M8110 will be reset. When it is OFF, filter function is unavailable. When it is ON, the filter time is determined by D8112(Filter function is available for M8112 Input filter function enable ○ ○ ○ X0~X5 of AP series, while it is unavailable for other inputs). After a power supply is connected, M8112 will be reset. Communication/Connection(RS485 communication port) RS, MBUS instructions of RS485 M8121 Ready to send data ○ ○ ○ communication port

9-21

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 RS, MBUS instructions of RS485 M8122 Sending flag ○ ○ ○ communication port RS, MBUS instructions of RS485 Flag of finishing reception communication port M8123 COIW, MCIR, MCIW, REGW, MRGR, ○ ○ ○ Flag of finishing MRGW instructions of RS485 communication communication port MBUS, COIW, MCIR, MCIW, REGW, M8124 Communication error MRGR, MRGW instructions of RS485 ○ ○ ○ communication port PLC Status Specifying ID enabled, which is 0 initially M8128 Specifying ID enabled After the power is ON, M8128 will be ○ ○ ○ reset. Communication/Connection(RS485 communication port) RS instruction of RS485 communication M8129 Timeout judgment ○ ○ ○ port High Speed Platform/Position M8130 Reserved ○ ○ ○ M8131 Reserved ○ ○ ○ M8132 Reserved ○ ○ ○ M8133 Reserved ○ ○ ○ M8134 Reserved ○ ○ ○ M8135 Reserved ○ ○ ○ M8136 Reserved ○ ○ ○ M8137 Reserved ○ ○ ○ M8138 Reserved ○ ○ ○ M8139 Reserved ○ ○ ○ Enable CLR signal output of ZRN instruction M8140 CLR signal output ○ ○ ○ AP100/AP200: Available for Y0/Y1 AP300:Available for Y0 Enable CLR signal output of ZRN M8141 CLR signal output × × ○ instruction

9-22

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 AP300:Available for Y1 M8142 Reserved ○ ○ ○ M8143 Y000 pulse output finished ○ ○ ○ M8144 Y001 pulse output finished ○ ○ ○ Flag of Y000 pulse output M8145 ○ ○ ○ stopped Flag of Y001 pulse output M8146 ○ ○ ○ stopped Y000 pulse output M8147 ○ ○ ○ monitoring (busy/read) Y001 pulse output M8148 ○ ○ ○ monitoring (busy/read) Enable simultaneous output of Y000 and M8149 Simultaneous output ○ ○ ○ Y001 Enable CLR signal output of ZRN M8150 CLR signal output instruction × × ○ AP300:Available for Y2 Enable CLR signal output of ZRN M8151 CLR signal output instruction × × ○ AP300:Available for Y3 M8153 Y002 pulse output finished × × ○ M8154 Y003 pulse output finished × × ○ Flag of Y002 pulse output M8155 × × ○ stopped Flag of Y003 pulse output M8156 × × ○ stopped Y002 pulse output M8157 × × ○ monitoring (busy/read) Y003 pulse output M8158 × × ○ monitoring (busy/read) Expansion Function M8160 SWAP function In F17 XCH ○ ○ ○ In instructions of F76 ASC, F80 RS, F82 M8161 8 octal processing mode ASCI, F83 HEX, F84, CCD, F87 MBUS, ○ ○ ○ F188 CRC. M8167 HEX data processing In F71 HKY ○ ○ ○ M8168 BIN-BCD conversion flag In F13 SMOV ○ ○ ○ 9-23

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 processing If M8170 is off, C252 will be reset by X002. M8170 The reset of C252 ○ ○ ○ If M8170 is on, C252 will be reset by X005. Counter Setting/Monitoring Up/Down counting set for M8200~M8255 will be reset after a power M8200 × ○ ○ C200 supply is connected. Up/Down counting set for M8201 × ○ ○ C201 Up/Down counting set for M8202 × ○ ○ C202 Up/Down counting set for M8203 × ○ ○ C203 Up/Down counting set for M8204 × ○ ○ C204 Up/Down counting set for M8205 × ○ ○ C205 Up/Down counting set for M8206 × ○ ○ C206 Up/Down counting set for M8207 × ○ ○ C207 Up/Down counting set for M8208 × ○ ○ C208 Up/Down counting set for M8209 × ○ ○ C209 Up/Down counting set for M8210 × ○ ○ C210 Up/Down counting set for M8211 × ○ ○ C211 Up/Down counting set for M8212 × ○ ○ C212 Up/Down counting set for M8213 × ○ ○ C213

9-24

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 Up/Down counting set for M8214 × ○ ○ C214 Up/Down counting set for M8215 × ○ ○ C215 Up/Down counting set for M8216 × ○ ○ C216 Up/Down counting set for M8217 × ○ ○ C217 Up/Down counting set for M8218 × ○ ○ C218 Up/Down counting set for M8219 × ○ ○ C219 Up/Down counting set for M8220 ○ ○ ○ C220 Up/Down counting set for M8221 ○ ○ ○ C221 Up/Down counting set for M8222 ○ ○ ○ C222 Up/Down counting set for M8223 ○ ○ ○ C223 Up/Down counting set for M8224 ○ ○ ○ C224 Up/Down counting set for M8225 ○ ○ ○ C225 Up/Down counting set for M8226 ○ ○ ○ C226 Up/Down counting set for M8227 ○ ○ ○ C227 Up/Down counting set for M8228 ○ ○ ○ C228 Up/Down counting set for M8229 ○ ○ ○ C229 Up/Down counting set for M8230 ○ ○ ○ C230

9-25

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 Up/Down counting set for M8231 ○ ○ ○ C231 Up/Down counting set for M8232 ○ ○ ○ C232 Up/Down counting set for M8233 ○ ○ ○ C233 Up/Down counting set for M8234 ○ ○ ○ C234 Up/Down counting set for M8235 ○ ○ ○ C235 Up/Down counting set for M8236 ○ ○ ○ C236 Up/Down counting set for M8237 ○ ○ ○ C237 Up/Down counting set for M8238 ○ ○ ○ C238 Up/Down counting set for M8239 ○ ○ ○ C239 Up/Down counting set for M8240 ○ ○ ○ C240 Up/Down counting set for M8241 ○ ○ ○ C241 Up/Down counting set for M8242 ○ ○ ○ C242 Up/Down counting set for M8243 ○ ○ ○ C243 Up/Down counting set for M8244 ○ ○ ○ C244 Up/Down counting set for M8245 ○ ○ ○ C245 Counting direction M8246 ○ ○ ○ monitoring for C246 Counting direction M8247 ○ ○ ○ monitoring for C247

9-26

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 Counting direction M8248 ○ ○ ○ monitoring for C248 Counting direction M8249 ○ ○ ○ monitoring for C249 Counting direction M8250 × ○ ○ monitoring for C250 Counting direction M8251 ○ ○ ○ monitoring for C251 Counting direction M8252 ○ ○ ○ monitoring for C252 Counting direction M8253 ○ ○ ○ monitoring for C253 Counting direction M8254 ○ ○ ○ monitoring for C254 Counting direction M8255 × ○ ○ monitoring for C255 AD/DA Total number of AD M8257 ○ ○ ○ modules is wrong Total number of DA module M8258 ○ ○ ○ channels is wrong Communication/connection(Expansion communication port 2) RS, MBUS instructions of expansion M8301 Ready to send data × × ○ communication port 2 RS, MBUS instructions of expansion M8302 Sending flag × × ○ communication port 2 RS, MBUS, COIW, MCIR, MCIW, M8303 Flag of finishing reception REGW, MRGR, MRGW instructions of × × ○ expansion communication port 2 MBUS, COIW, MCIR, MCIW, REGW, M8304 Communication error MRGR, MRGW instructions of expansion × × ○ communication port 2 RS instruction of expansion M8309 Timeout judgment × × ○ communication port 2

9-27

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 Communication/connection(Expansion communication port 1) RS, MBUS instructions of expansion M8321 Ready to send data ○ ○ ○ communication port 1 RS, MBUS instructions of expansion M8322 Sending flag ○ ○ ○ communication port 1 RS, MBUS, COIW, MCIR, MCIW, M8323 Flag of finishing reception REGW, MRGR, MRGW instructions of ○ ○ ○ expansion communication port 1 MBUS, COIW, MCIR, MCIW, REGW, M8324 Communication error MRGR, MRGW instructions of expansion ○ ○ ○ communication port 1 RS instruction of expansion M8329 Timeout judgment ○ ○ ○ communication port 1 Communication/Connection(RMIO) Communication error in M8336 RMIO data transmission error ( master) ○[*2] ○ ○ master Communication error in M8337 RMIO data transmission error (slave 1) ○[*2] ○ ○ slave 1 Communication error in M8338 RMIO data transmission error (slave 2) ○[*2] ○ ○ slave 2 Communication error in M8339 RMIO data transmission error (slave 3) ○[*2] ○ ○ slave 3 Communication error in M8340 RMIO data transmission error (slave 4) ○[*2] ○ ○ slave 4 Expansion communication Expansion communication port 1 is RMIO M8341 ○[*2] ○ ○ port 1 is under RMIO mode 485 communication port 1 M8342 485 communication port 1 is RMIO mode ○[*2] ○ ○ is under RMIO Expansion communication Expansion communication port 2 is RMIO M8343 × × ○ port 2 is under RMIO mode Communication/Connection(DTLK2) Communication error in M8400 DTLK2 data transmission error ( master) ○[*2] ○ ○ master M8401 Communication error in DTLK2 data transmission error (slave 1) ○[*2] ○ ○

9-28

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 slave 1 Communication error in M8402 DTLK2 data transmission error (slave 2) ○[*2] ○ ○ slave 2 Communication error in M8403 DTLK2 data transmission error (slave 3) ○[*2] ○ ○ slave 3 Communication error in M8404 DTLK2 data transmission error (slave 4) ○[*2] ○ ○ slave 4 Communication error in M8405 DTLK2 data transmission error (slave 5) ○[*2] ○ ○ slave 5 Communication error in M8406 DTLK2 data transmission error (slave 6) ○[*2] ○ ○ slave 6 Communication error in M8407 DTLK2 data transmission error (slave 7) ○[*2] ○ ○ slave 7 Communication error in M8408 DTLK2 data transmission error (slave 8) ○[*2] ○ ○ slave 8 Communication error in M8409 DTLK2 data transmission error (slave 9) ○[*2] ○ ○ slave 9 Communication error in M8410 DTLK2 data transmission error (slave 10) ○[*2] ○ ○ slave 10 Communication error in M8411 DTLK2 data transmission error (slave 11) ○[*2] ○ ○ slave 11 Communication error in M8412 DTLK2 data transmission error (slave 12) ○[*2] ○ ○ slave 12 Communication error in M8413 DTLK2 data transmission error (slave 13) ○[*2] ○ ○ slave 13 Communication error in M8414 DTLK2 data transmission error (slave 14) ○[*2] ○ ○ slave 14 Communication error in M8415 DTLK2 data transmission error (slave 15) ○[*2] ○ ○ slave 15 M8416 Data communication status DTLK2 data communication status ○[*2] ○ ○ Expansion communication Expansion communication port 1 is M8417 ○[*2] ○ ○ port 1 is under DTLK2 DTLK2 mode 485 communication port 1 M8418 485 communication port 1 is DTLK2 mode ○[*2] ○ ○ is under DTLK2

9-29

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 Expansion communication Expansion communication port 2 is M8419 × × ○ port 2 is under DTLK2 DTLK2 mode AD/DA Exception of AD module M8436 ○[*1] ○ ○ channel 1 Exception of AD module M8437 ○[*1] ○ ○ channel 2 Exception of AD module M8438 ○[*1] ○ ○ channel 3 Exception of AD module M8439 ○[*1] ○ ○ channel 4 Exception of AD module M8440 ○[*1] ○ ○ channel 5 Exception of AD module M8441 ○[*1] ○ ○ channel 6 Exception of AD module M8442 ○[*1] ○ ○ channel 7 Exception of AD module M8443 ○[*1] ○ ○ channel 8 Exception of AD module M8444 ○[*1] ○ ○ channel 9 Exception of AD module M8445 ○[*1] ○ ○ channel 10 Exception of AD module M8446 ○[*1] ○ ○ channel 11 Exception of AD module M8447 ○[*1] ○ ○ channel 12 Exception of AD module M8448 ○[*1] ○ ○ channel 13 Exception of AD module M8449 ○[*1] ○ ○ channel 14 Exception of AD module M8450 ○[*1] ○ ○ channel 15 M8451 Exception of AD module ○[*1] ○ ○

9-30

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 channel 16 Exception of AD module M8452 ○[*1] ○ ○ channel 17 Exception of AD module M8453 ○[*1] ○ ○ channel 18 Exception of AD module M8454 ○[*1] ○ ○ channel 19 Exception of AD module M8455 ○[*1] ○ ○ channel 20 Exception of AD module M8456 ○[*1] ○ ○ channel 21 Exception of AD module M8457 ○[*1] ○ ○ channel 22 Exception of AD module M8458 ○[*1] ○ ○ channel 23 Exception of AD module M8459 ○[*1] ○ ○ channel 24 Exception of AD module M8460 ○[*1] ○ ○ channel 25 Exception of AD module M8461 ○[*1] ○ ○ channel 26 Exception of AD module M8462 ○[*1] ○ ○ channel 27 Exception of AD module M8463 ○[*1] ○ ○ channel 28 Exception of AD module M8464 ○[*1] ○ ○ channel 29 Exception of AD module M8465 ○[*1] ○ ○ channel 30 Exception of AD module M8466 ○[*1] ○ ○ channel 31 Exception of AD module M8467 ○[*1] ○ ○ channel 32 M8468 Exception of AD module ○[*1] ○ ○

9-31

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 channel 33 Exception of AD module M8469 ○[*1] ○ ○ channel 34 Exception of AD module M8470 ○[*1] ○ ○ channel 35 Exception of AD module M8471 ○[*1] ○ ○ channel 36 Exception of AD module M8472 ○[*1] ○ ○ channel 37 Exception of AD module M8473 ○[*1] ○ ○ channel 38 Exception of AD module M8474 ○[*1] ○ ○ channel 39 Exception of AD module M8475 ○[*1] ○ ○ channel 40 Exception of AD module M8476 ○[*1] ○ ○ channel 41 Exception of AD module M8477 ○[*1] ○ ○ channel 42 Exception of AD module M8478 ○[*1] ○ ○ channel 43 Exception of AD module M8479 ○[*1] ○ ○ channel 44 Exception of AD module M8480 ○[*1] ○ ○ channel 45 Exception of AD module M8481 ○[*1] ○ ○ channel 46 Exception of AD module M8482 ○[*1] ○ ○ channel 47 Exception of AD module M8483 ○[*1] ○ ○ channel 48 Exception of AD module M8484 ○[*1] ○ ○ channel 49 M8485 Exception of AD module ○[*1] ○ ○

9-32

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 channel 50 Exception of AD module M8486 ○[*1] ○ ○ channel 51 Exception of AD module M8487 ○[*1] ○ ○ channel 52 Exception of AD module M8488 ○[*1] ○ ○ channel 53 Exception of AD module M8489 ○[*1] ○ ○ channel 54 Exception of AD module M8490 ○[*1] ○ ○ channel 55 Exception of AD module M8491 ○[*1] ○ ○ channel 56 Exception of AD module M8492 ○[*1] ○ ○ channel 57 Exception of AD module M8493 ○[*1] ○ ○ channel 58 Exception of AD module M8494 ○[*1] ○ ○ channel 59 Exception of AD module M8495 ○[*1] ○ ○ channel 60 Counter Setting/Monitoring Up/Down counting set for M8500 × × ○ C500 Up/Down counting set for M8501 × × ○ C501 Up/Down counting set for M8502 × × ○ C502 Up/Down counting set for M8503 × × ○ C503 Up/Down counting set for M8504 × × ○ C504 Up/Down counting set for M8505 × × ○ C505

9-33

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 Counting direction M8506 × × ○ monitoring for C506 Counting direction M8507 × × ○ monitoring for C507 Counting direction M8508 × × ○ monitoring for C508 ○:Supported;×:Unsupported. *1:AP100 1.1 and above versions are supported. *2:AP100 1.2 and above versions are supported.

9-34

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

5.2 Data register D

Applicable to No. Name Action . Function AP100 AP200 AP300 PLC Status D8000 Monitor timer value ○ ○ ○ D8001 Model type ○ ○ ○ D8002 Version 10 represents 1.0 ○ ○ ○ D8003 ID ○ ○ ○ Save the corresponding buffer value when D8004 Error code M8061, M8064, M8065 and M8066 are ○ ○ ○ ON. Please refer to error detection(D) Save the corresponding buffer value when D8005 Warning code M8060, M8063, M8067 ad M8069 are ON. ○ ○ ○ Please refer to error detection(D) The maximum capacity is 4K for AP100, D8006 Content memory ○ ○ ○ 8K for AP200 and 24K for AP300. Clock D8010 Present scan time Present scan time(unit: 1ms) ○ ○ ○ D8011 Min scan time ○ ○ ○ D8012 Max scan time ○ ○ ○ D8013 Second(0~59) ○ ○ ○ D8014 Minute(0~59) ○ ○ ○ D8015 Hour(0~23) ○ ○ ○ D8016 日(1~31) ○ ○ ○ D8017 Month(1~12) ○ ○ ○ D8018 Year(2000~2099) ○ ○ ○ D8019 Week ○ ○ ○ Expansion Function

0: No card 1:AP-485BD expansion card ID of expansion card D8020 2:AP-232BD expansion card ○ ○ ○ (Expansion card port 1) 3:AP-COBD expansion card 4:AP-EMBD expansion card

9-35

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 5:AP-4DBD expansion card 6:AP-4RBD expansion card 7:AP-2D2TBD expansion card ID of expansion card 8:AP-RTCBD expansion card D8021 (Expansion card port 2) 9:AP-2AIBD expansion card 10:AP-1AOBD expansion card 11:AP-3MABD expansion card 12:AP-CAMBD expansion card PLC Mode Corresponding X is specified for D8035 Force RUN Specifying ○ ○ ○ RUN/STOP control when M8035 is ON. D8039 Constant scan time Unit: ms ○ ○ ○ Step Ladder D8040 Save state address ○ ○ ○ The minimum address number for ON state D8041 Save state address ○ ○ ○ among S0~S899 is saved in D8040, and the D8042 Save state address ○ ○ ○ address numbers for ON state following it D8043 Save state address ○ ○ ○ are saved in D8041~D8047. Based on this D8044 Save state address ○ ○ ○ order, 8 components are saved, among D8045 Save state address ○ ○ ○ which the largest component is saved in D8046 Save state address ○ ○ ○ D8047. It is operated in RUN status. D8047 Save state address ○ ○ ○ Save the minimum address for ON state D8049 Save state address ○ ○ ○ among (S900 ~ S999) Error Detection See the Error Code List for more D8060 Expansion card error ○ ○ ○ information See the Error Code List for more D8061 PLC hardware check ○ ○ ○ information See the Error Code List for more D8063 Communication detection ○ ○ ○ information See the Error Code List for more D8064 Parameter error ○ ○ ○ information See the Error Code List for more D8065 Syntax error ○ ○ ○ information

9-36

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 See the Error Code List for more D8066 Loop error ○ ○ ○ information See the Error Code List for more D8067 Computation error ○ ○ ○ information Preserve application instruction error step D8068 Wrong step number ○ ○ ○ number See the Error Code List for more D8069 Expansion error ○ ○ ○ information See the Error Code List for more D8070 FROM/TO error × ○ ○ information Expansion Function The total number of input X(including host input). When M8110 is ON, the total D8110 The total number of input X ○ ○ ○ number of input X is determined by D8110. The total number of input Y(including host D8111 The total number of input Y input). When M8111 is ON, the total ○ ○ ○ number of input Y is determined by D8111. It is the input filter time in ms. When D8112 Input filter time M8112 is ON, the input filter time is ○ ○ ○ filtered by D8112. Communication/Connection(RS485 communication port) Communication format for built-in RS485 D8120 Communication format ○ ○ ○ communication port is 89Hex by default. Remaining number of Remaining number of data sent by built-in D8122 ○ ○ ○ RS485 sending data RS485 communication port Remaining number of data received by D8123 Number of data received ○ ○ ○ built-in RS485 communication port RS instruction of RS485 communication D8124 Start character ○ ○ ○ port is 02Hex by default. RS instruction of RS485 communication D8125 End character ○ ○ ○ port is 03Hex by default. Set time before sending(0~30000)ms for D8126 Time before sending ○ ○ ○ instructions of COIW, MCIR, MCIW,

9-37

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 REGW, MRGR, MRGW, RS, MBUS in RS485 communication port, which is 10ms by default. PLC Status When M8128=1, it is taken as the ID. D8128 Specify ID Beyond the range of 1~255, the default ○ ○ ○ value is 1. Communication/Connection(RS485 communication port) RS instruction of RS485 communication Time for timeout judgment port D8129 Instructions of COIW, MCIR, MCIW, ○ ○ ○ Response timeout judgment REGW, MRGR, MRGW, RS, MBUS of RS485 communication port High Speed Platform/Position D8136 Total number of pulses output from Y000 ○ ○ ○ Total pulse number to Y001 D8137 ○ ○ ○ D8136(low word), D8137(high word) D8140 Total number of pulses output to Y000 ○ ○ ○ Total pulse number D8141 D8140(low word), D8141(high word) ○ ○ ○ D8142 Total number of pulses output to Y001 ○ ○ ○ Total pulse number D8143 D8142(low word), D8143(high word) ○ ○ ○ AP100/AP200: Base speed of Y000 and D8145 Base speed Y001 ○ ○ ○ AP300: Base speed of Y000 D8146 AP100/AP200: Maximum speed of Y000 ○ ○ ○ and Y001 Maximum speed D8147 AP300: Maximum speed of Y000 ○ ○ ○ D8146(low word), D8147(high word) AP100/AP200: Acceleration/Deceleration D8148 Acceleration time time for Y000 and Y001 ○ ○ ○ AP300: Acceleration time for Y000 Idle speed step number for Y000 when D8149 Idle speed step number × ○ ○ executing F205 CLLM D8150 Idle speed step number Idle speed step number for Y001 when × ○ ○

9-38

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 executing F205 CLLM Proportion of feedback Feedback number for Y000 when D8151 × ○ ○ number executing F205 CLLM Proportion of feedback Feedback number for Y001 when D8152 × ○ ○ number executing F205 CLLM Idle speed step number for Y002 when D8153 Idle speed step number × × ○ executing F205 CLLM Idle speed step number for Y003 when D8154 Idle speed step number × × ○ executing F205 CLLM Proportion of feedback Feedback number for Y002 when D8155 × × ○ number executing F205 CLLM Proportion of feedback Feedback number for Y003 when D8156 × × ○ number executing F205 CLLM D8157 Deceleration time AP300:Deceleration time of Y000 × × ○ PWM Output D8158 Y000 parameter time base 0:Parameter is in the unit of 1ms ○ ○ ○ 1:Parameter is in the unit of 0.1ms D8159 Y001 parameter time base ○ ○ ○ 2:Parameter is in the unit of 0.01ms High Speed Platform/Position D8165 Base speed AP300; Base speed of Y001 × × ○ D8166 AP300; Maximum speed of Y001 × × ○ Maximum speed D8167 D8166(Low word), D8167(High word) × × ○ D8168 Acceleration time AP300;Acceleration time of Y001 × × ○ D8169 Deceleration time AP300;Deceleration time of Y001 × × ○ Communication/Connection(DTLK2) D8173 Station number Slave the local station number ○[*2] ○ ○ D8174 Total slave number Save the total slave number ○[*2] ○ ○ D8175 Reserved ○ ○ ○ D8176 Set station number Slave the local station number ○[*2] ○ ○ D8177 Set total slave number Set the total slave number ○[*2] ○ ○ D8178 Reserved ○ ○ ○ D8179 Set retry times Set retry times ○[*2] ○ ○ D8180 Set communication timeout Set communication timeout ○[*2] ○ ○ High Speed Platform/Position

9-39

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 D8190 AP300;Total number of pulses output to × × ○ Total pulse number Y002 D8191 × × ○ D8190(Low word), D8191(High word) D8195 Base speed AP300; Base speed of Y002 × × ○ D8196 AP300; Maximum speed of Y002 × × ○ Maximum speed D8197 D8196(Low word), D8197(High word) × × ○ D8198 Acceleration time AP300;Acceleration time for Y002 × × ○ D8199 Deceleration time AP300; Deceleration time for Y002 × × ○ D8200 AP300;Total number of pulses output to × × ○ Total pulse number Y003 D8201 × × ○ D8200(Low word), D8201(High word) D8205 Base speed AP300; Base speed of Y003 × × ○ D8206 AP300; Maximum speed of Y003 × × ○ Maximum speed D8207 D8196(Low word), D8197(High word) × × ○ D8208 Acceleration time AP300;Acceleration time for Y003 × × ○ D8209 Deceleration time AP300; Deceleration time for Y003 × × ○ AD/DA D8257 Number of AD modules ○ ○ ○ Number of DA module To make a 2DA work normally, please set D8259 ○ ○ ○ channels the value as 2. 0:No software filter; 1~3:Software filter D8260 AD filter method ○ ○ ○ mode 1~3 D8261 AD1~4 channel mode Set module AD 1~4 channel mode ○ ○ ○ D8262 AD5~8 channel mode Set module AD 5~8 channel mode ○ ○ ○ D8263 AD9~12 channel mode Set module AD 9~12 channel mode ○ ○ ○ D8264 AD13~16 channel mode Set module AD 13~16 channel mode ○ ○ ○ D8265 AD17~20 channel mode Set module AD 17~20 channel mode ○ ○ ○ D8266 AD21~24 channel mode Set module AD 21~24 channel mode ○ ○ ○ D8267 AD25~28 channel mode Set module AD 25~28 channel mode ○ ○ ○ D8268 AD29~32 channel mode Set module AD 29~32 channel mode ○ ○ ○ D8269 AD33~36 channel mode Set module AD 33~36 channel mode ○ ○ ○ D8270 AD37~40 channel mode Set module AD 37~40 channel mode ○ ○ ○ D8271 AD41~44 channel mode Set module AD 41~44 channel mode ○ ○ ○ D8272 AD45~48 channel mode Set module AD 45~48 channel mode ○ ○ ○ 9-40

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 D8273 AD49~52 channel mode Set module AD 49~52 channel mode ○ ○ ○ D8274 AD53~56 channel mode Set module AD 53~56 channel mode ○ ○ ○ D8275 AD57~60 channel mode Set module AD 57~60 channel mode ○ ○ ○ D8276 Reserved ○ ○ ○ DA1~4 channel operation D8277 Set operation mode for DA 1~4 channels ○ ○ ○ mode DA5~8 channel operation D8278 Set operation mode for DA 5~8 channels ○ ○ ○ mode DA9~10 channel operation Set operation mode for DA 9~10 D8279 ○ ○ ○ mode channels Communication/connection(Expansion communication port 2) Communication format for expansion D8300 Communication format × × ○ communication port 2 is 89Hex by default. Remaining number of Remaining number of data sent by D8302 × × ○ RS485 sending data expansion communication port 2 Number of data received by expansion D8303 Number of data received × × ○ communication port 2 Start character of expansion D8304 Start character communication port 2, RS instruction × × ○ 02Hex End character of expansion communication D8305 End character × × ○ port 2, RS instruction 03Hex Set time before sending(0~30000)ms for instructions of COIW, MCIR, MCIW, D8306 Time before sending REGW, MRGR, MRGW, RS, MBUS in × × ○ expansion communication port 2, which is 10ms by default. Time for timeout judgment for expansion Time for timeout judgment communication port 2, in RS instruction Response timeout judgment for expansion D8309 × × ○ communication port 2, in instructions of Response timeout judgment COIW, MCIR, MCIW, REGW, MRGR, MRGW, RS, MBUS Communication/connection(Expansion communication port 1)

9-41

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 Communication format for expansion D8320 Communication format ○ ○ ○ communication port 1 is 89Hex by default. Communication format for The communication format for PG port is D8321 ○ ○ ○ PG port 89Hex by default. Remaining number of Remaining number of data sent by D8322 ○ ○ ○ RS485 sending data expansion communication port 1 Number of data received by expansion D8323 Number of data received ○ ○ ○ communication port 1 Start character of expansion D8324 Start character communication port 1, RS instruction ○ ○ ○ 02Hex End character of expansion communication D8325 End character ○ ○ ○ port 1, RS instruction 03Hex Set time before sending(0~30000)ms for instructions of COIW, MCIR, MCIW, D8326 Time before sending REGW, MRGR, MRGW, RS, MBUS in ○ ○ ○ expansion communication port 1, which is 10ms by default. Time for timeout judgment for expansion Time for timeout judgment communication port 1, in RS instruction Response timeout judgment for expansion D8329 ○ ○ ○ communication port 1, in instructions of Response timeout judgment COIW, MCIR, MCIW, REGW, MRGR, MRGW, RS, MBUS Communication/Connection(RMIO) D8331 Current network scan time Current network scan time for RMIO ○[*2] ○ ○ Maximum network scan D8332 Maximum network scan time for RMIO ○[*2] ○ ○ time Error counting number Communication error count of RMIO D8333 ○[*2] ○ ○ (master) master Error counting number Communication error count of RMIO slave D8334 ○[*2] ○ ○ (slave 1) 1 Error counting number Communication error count of RMIO slave D8335 ○[*2] ○ ○ (slave 2) 2

9-42

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 Error counting number Communication error count of RMIO slave D8336 ○[*2] ○ ○ (slave 3) 3 Error counting number Communication error count of RMIO slave D8337 ○[*2] ○ ○ (slave 4) 4 Communication error code of RMIO D8338 Error code(master) ○[*2] ○ ○ master Communication error code of RMIO slave D8339 Error code (slave 1) ○[*2] ○ ○ 1 Communication error code of RMIO slave D8340 Error code (slave 2) ○[*2] ○ ○ 2 Communication error code of RMIO slave D8341 Error code (slave 3) ○[*2] ○ ○ 3 Communication error code of RMIO slave D8342 Error code (slave 4) ○[*2] ○ ○ 4 Error Detection See the Error Code List for more D8345 Communication error ○ ○ ○ information D8346 Wrong step number Save step number of communication error ○ ○ ○ AD/DA D8351 4TM module 1 data Save the temperature data of module 1 ○ ○ ○ D8352 4TM module 2 data Save the temperature data of module 2 ○ ○ ○ D8353 4TM module 3 data Save the temperature data of module 3 ○ ○ ○ D8354 4TM module 4 data Save the temperature data of module 4 ○ ○ ○ D8355 4TM module 5 data Save the temperature data of module 5 ○ ○ ○ D8356 4TM module 6 data Save the temperature data of module 6 ○ ○ ○ D8357 4TM module 7 data Save the temperature data of module 7 ○ ○ ○ D8358 4TM module 8 data Save the temperature data of module 8 ○ ○ ○ Value of channel 1 on AD Save the data of channel 1 read from AD D8360 ○ ○ ○ expansion card 1 expansion card 1 Value of channel 2 on AD Save the data of channel 2 read from AD D8361 ○ ○ ○ expansion card 1 expansion card 1 Value of channel 3 on AD Save the data of channel 3 read from AD D8362 ○ ○ ○ expansion card 1 expansion card 1 D8363 Value of channel 4 on AD Save the data of channel 4 read from AD ○ ○ ○

9-43

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 expansion card 1 expansion card 1 Value of channel 1 on AD Save the data of channel 1 read from AD D8364 ○ ○ ○ expansion card 2 expansion card 2 Value of channel 2 on AD Save the data of channel 2 read from AD D8365 ○ ○ ○ expansion card 2 expansion card 2 Value of channel 3 on AD Save the data of channel 3 read from AD D8366 ○ ○ ○ expansion card 2 expansion card 2 Value of channel 4 on AD Save the data of channel 4 read from AD D8367 ○ ○ ○ expansion card 2 expansion card 2 Value of channe1 1 on DA Save the data written in channel 1 on DA D8368 ○ ○ ○ expansion card 1 expansion card 1 Value of channe1 1 on DA Save the data written in channel 1 on DA D8369 ○ ○ ○ expansion card 2 expansion card 2 Value of channe1 2 on DA Save the data written in channel 2 on DA D8370 ○ ○ ○ expansion card 1 expansion card 1 Value of channe1 2 on DA Save the data written in channel 2 on DA D8371 ○ ○ ○ expansion card 2 expansion card 2 Communication/Connection(RMIO) Station number setting state for RMIO D8373 Station number(read only) ○[*2] ○ ○ local station Slave number setting state for RMIO D8374 Slave number(read only) ○[*2] ○ ○ communication slave Station number setting state for RMIO D8376 Set station number ○[*2] ○ ○ local station Slave number setting state for RMIO D8377 Set slave number ○[*2] ○ ○ communication slave D8379 Set retry times Set RMIO retry times ○[*2] ○ ○ D8380 Timeout setting RMIO timeout setting ○[*2] ○ ○ AD/DA Number of DA module Save the data written in channel 1 on DA D8381 ○ ○ ○ channel 1 expansion card Number of DA module Save the data written in channel 2 on DA D8382 ○ ○ ○ channel 2 expansion card D8383 Number of DA module Save the data written in channel 3 on DA ○ ○ ○

9-44

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 channel 3 expansion card Number of DA module Save the data written in channel 4 on DA D8384 ○ ○ ○ channel 4 expansion card Number of DA module Save the data written in channel 5 on DA D8385 ○ ○ ○ channel 5 expansion card Number of DA module Save the data written in channel 6 on DA D8386 ○ ○ ○ channel 6 expansion card Number of DA module Save the data written in channel 7 on DA D8387 ○ ○ ○ channel 7 expansion card Number of DA module Save the data written in channel 8 on DA D8388 ○ ○ ○ channel 8 expansion card Number of DA module Save the data written in channel 9 on DA D8389 ○ ○ ○ channel 9 expansion card Number of DA module Save the data written in channel 10 on DA D8390 ○ ○ ○ channel 10 expansion card Communication/Connection(DTLK2) D8401 Current network scan time DTLK2 current network scan time ○[*2] ○ ○ Maximum network scan D8402 DTLK2 maximum network scan time ○[*2] ○ ○ time Error counting number Communication error count of DTLK2 D8403 ○[*2] ○ ○ (master) master Error counting number Communication error count of DTLK2 D8404 ○[*2] ○ ○ (slave 1) slave 1 Error counting number Communication error count of DTLK2 D8405 ○[*2] ○ ○ (slave 2) slave 2 Error counting number Communication error count of DTLK2 D8406 ○[*2] ○ ○ (slave 3) slave 3 Error counting number Communication error count of DTLK2 D8407 ○[*2] ○ ○ (slave 4) slave 4 Error counting number Communication error count of DTLK2 D8408 ○[*2] ○ ○ (slave 5) slave 5 Error counting number Communication error count of DTLK2 D8409 ○[*2] ○ ○ (slave 6) slave 6 D8410 Error counting number Communication error count of DTLK2 ○[*2] ○ ○

9-45

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 (slave 7) slave 7 Error counting number Communication error count of DTLK2 D8411 ○[*2] ○ ○ (slave 8) slave 8 Error counting number Communication error count of DTLK2 D8412 ○[*2] ○ ○ (slave 9) slave 9 Error counting number Communication error count of DTLK2 D8413 ○[*2] ○ ○ (slave 10) slave 10 Error counting number Communication error count of DTLK2 D8414 ○[*2] ○ ○ (slave 11) slave 11 Error counting number Communication error count of DTLK2 D8415 ○[*2] ○ ○ (slave 12) slave 12 Error counting number Communication error count of DTLK2 D8416 ○[*2] ○ ○ (slave 13) slave 13 Error counting number Communication error count of DTLK2 D8417 ○[*2] ○ ○ (slave 14) slave 14 Error counting number Communication error count of DTLK2 D8418 ○[*2] ○ ○ (slave 15) slave 15 Communication error code of DTLK2 D8419 Error code(master) ○[*2] ○ ○ master Communication error code of DTLK2 D8420 Error code (slave 1) ○[*2] ○ ○ slave 1 Communication error code of DTLK2 D8421 Error code (slave 2) ○[*2] ○ ○ slave 2 Communication error code of DTLK2 D8422 Error code (slave 3) ○[*2] ○ ○ slave 3 Communication error code of DTLK2 D8423 Error code (slave 4) ○[*2] ○ ○ slave 4 Communication error code of DTLK2 D8424 Error code (slave 5) ○[*2] ○ ○ slave 5 Communication error code of DTLK2 D8425 Error code (slave 6) ○[*2] ○ ○ slave 6 Communication error code of DTLK2 D8426 Error code (slave 7) ○[*2] ○ ○ slave 7 D8427 Error code (slave 8) Communication error code of DTLK2 ○[*2] ○ ○

9-46

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 slave 8 Communication error code of DTLK2 D8428 Error code (slave 9) ○[*2] ○ ○ slave 9 Communication error code of DTLK2 D8429 Error code (slave 10) ○[*2] ○ ○ slave 10 Communication error code of DTLK2 D8430 Error code (slave 11) ○[*2] ○ ○ slave 11 Communication error code of DTLK2 D8431 Error code (slave 12) ○[*2] ○ ○ slave 12 Communication error code of DTLK2 D8432 Error code (slave 13) ○[*2] ○ ○ slave 13 Communication error code of DTLK2 D8433 Error code (slave 14) ○[*2] ○ ○ slave 14 Communication error code of DTLK2 D8434 Error code (slave 15) ○[*2] ○ ○ slave 15 AD/DA Data of AD module channel Save the data of channel 1 read from AD D8436 ○ ○ ○ 1 expansion module Data of AD module channel Save the data of channel 2 read from AD D8437 ○ ○ ○ 2 expansion module Data of AD module channel Save the data of channel 3 read from AD D8438 ○ ○ ○ 3 expansion module Data of AD module channel Save the data of channel 4 read from AD D8439 ○ ○ ○ 4 expansion module Data of AD module channel Save the data of channel 5 read from AD D8440 ○ ○ ○ 5 expansion module Data of AD module channel Save the data of channel 6 read from AD D8441 ○ ○ ○ 6 expansion module Data of AD module channel Save the data of channel 7 read from AD D8442 ○ ○ ○ 7 expansion module Data of AD module channel Save the data of channel 8 read from AD D8443 ○ ○ ○ 8 expansion module Data of AD module channel Save the data of channel 9 read from AD D8444 ○ ○ ○ 9 expansion module

9-47

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 Data of AD module channel Save the data of channel 10 read from AD D8445 ○ ○ ○ 10 expansion module Data of AD module channel Save the data of channel 11 read from AD D8446 ○ ○ ○ 11 expansion module Data of AD module channel Save the data of channel 12 read from AD D8447 ○ ○ ○ 12 expansion module Data of AD module channel Save the data of channel 13 read from AD D8448 ○ ○ ○ 13 expansion module Data of AD module channel Save the data of channel 14 read from AD D8449 ○ ○ ○ 14 expansion module Data of AD module channel Save the data of channel 15 read from AD D8450 ○ ○ ○ 15 expansion module Data of AD module channel Save the data of channel 16 read from AD D8451 ○ ○ ○ 16 expansion module Data of AD module channel Save the data of channel 17 read from AD D8452 ○ ○ ○ 17 expansion module Data of AD module channel Save the data of channel 18 read from AD D8453 ○ ○ ○ 18 expansion module Data of AD module channel Save the data of channel 19 read from AD D8454 ○ ○ ○ 19 expansion module Data of AD module channel Save the data of channel 20 read from AD D8455 ○ ○ ○ 20 expansion module Data of AD module channel Save the data of channel 21 read from AD D8456 ○ ○ ○ 21 expansion module Data of AD module channel Save the data of channel 22 read from AD D8457 ○ ○ ○ 22 expansion module Data of AD module channel Save the data of channel 23 read from AD D8458 ○ ○ ○ 23 expansion module Data of AD module channel Save the data of channel 24 read from AD D8459 ○ ○ ○ 24 expansion module Data of AD module channel Save the data of channel 25 read from AD D8460 ○ ○ ○ 25 expansion module Data of AD module channel Save the data of channel 26 read from AD D8461 ○ ○ ○ 26 expansion module

9-48

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 Data of AD module channel Save the data of channel 27 read from AD D8462 ○ ○ ○ 27 expansion module Data of AD module channel Save the data of channel 28 read from AD D8463 ○ ○ ○ 28 expansion module Data of AD module channel Save the data of channel 29 read from AD D8464 ○ ○ ○ 29 expansion module Data of AD module channel Save the data of channel 30 read from AD D8465 ○ ○ ○ 30 expansion module Data of AD module channel Save the data of channel 31 read from AD D8466 ○ ○ ○ 31 expansion module Data of AD module channel Save the data of channel 32 read from AD D8467 ○ ○ ○ 32 expansion module Data of AD module channel Save the data of channel 33 read from AD D8468 ○ ○ ○ 33 expansion module Data of AD module channel Save the data of channel 34 read from AD D8469 ○ ○ ○ 34 expansion module Data of AD module channel Save the data of channel 35 read from AD D8470 ○ ○ ○ 35 expansion module Data of AD module channel Save the data of channel 36 read from AD D8471 ○ ○ ○ 36 expansion module Data of AD module channel Save the data of channel 37 read from AD D8472 ○ ○ ○ 37 expansion module Data of AD module channel Save the data of channel 38 read from AD D8473 ○ ○ ○ 38 expansion module Data of AD module channel Save the data of channel 39 read from AD D8474 ○ ○ ○ 39 expansion module Data of AD module channel Save the data of channel 40 read from AD D8475 ○ ○ ○ 40 expansion module Data of AD module channel Save the data of channel 41 read from AD D8476 ○ ○ ○ 41 expansion module Data of AD module channel Save the data of channel 42 read from AD D8477 ○ ○ ○ 42 expansion module Data of AD module channel Save the data of channel 43 read from AD D8478 ○ ○ ○ 43 expansion module

9-49

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 Data of AD module channel Save the data of channel 44 read from AD D8479 ○ ○ ○ 44 expansion module Data of AD module channel Save the data of channel 45 read from AD D8480 ○ ○ ○ 45 expansion module Data of AD module channel Save the data of channel 46 read from AD D8481 ○ ○ ○ 46 expansion module Data of AD module channel Save the data of channel 47 read from AD D8482 ○ ○ ○ 47 expansion module Data of AD module channel Save the data of channel 48 read from AD D8483 ○ ○ ○ 48 expansion module Data of AD module channel Save the data of channel 49 read from AD D8484 ○ ○ ○ 49 expansion module Data of AD module channel Save the data of channel 50 read from AD D8485 ○ ○ ○ 50 expansion module Data of AD module channel Save the data of channel 51 read from AD D8486 ○ ○ ○ 51 expansion module Data of AD module channel Save the data of channel 52 read from AD D8487 ○ ○ ○ 52 expansion module Data of AD module channel Save the data of channel 53 read from AD D8488 ○ ○ ○ 53 expansion module Data of AD module channel Save the data of channel 54 read from AD D8489 ○ ○ ○ 54 expansion module Data of AD module channel Save the data of channel 55 read from AD D8490 ○ ○ ○ 55 expansion module Data of AD module channel Save the data of channel 56 read from AD D8491 ○ ○ ○ 56 expansion module Data of AD module channel Save the data of channel 57 read from AD D8492 ○ ○ ○ 57 expansion module Data of AD module channel Save the data of channel 58 read from AD D8493 ○ ○ ○ 58 expansion module Data of AD module channel Save the data of channel 59 read from AD D8494 ○ ○ ○ 59 expansion module Data of AD module channel Save the data of channel 60 read from AD D8495 ○ ○ ○ 60 expansion module

9-50

Chapter 9 Supplementary Interpretation of Basic Functions Error Code List

Applicable to No. Name Action . Function AP100 AP200 AP300 D8496 Channel reserved for AD ○ ○ ○ D8497 Channel reserved for AD ○ ○ ○ D8498 Channel reserved for AD ○ ○ ○ D8499 Channel reserved for AD ○ ○ ○ ○:Supported;×:Unsupported. *1:AP100 1.1 and above versions are supported. *2:AP100 1.2 and above versions are supported.

9-51