Api Delta
Api Delta
Explanations:
1. When the user does not wish a particular part of PLC program in order to shorten the scan time and execute dual outputs,
CJ instruction or CJP instruction can be adopted.
2. When the program indicated by Pointer P is prior to CJ instruction, WDT timeout will occur and PLC will stop running.
Please use it carefully.
3. CJ instruction can assign the same pointer P repeatedly. However, CJ and CALL cannot assign the same pointer P;
otherwise an error will occur.
Sample:
Explanations:
1. Terminate the processing of interruption program and return to the main program by IRET instruction. Execute the next
instruction of the interrupted program.
2. EI instruction allows interrupting subroutine in the program, e.g. external interruption, timed interruption, and high-speed
counter interruption.
3. In the program, using interruption subroutine between EI and DI instruction is allowed. However, it is not allowed to use
DI instruction if there is no interruption-disabling section in the program.
4. Write subroutine assigned by interruption pointer after FEND instruction.
Sample:
Explanations:
WDT instruction can be used to reset Watch Dog Timer. If the PLC scan time (from step 0 to END or when FEND instruction is executed) exceeds 200ms, PLC
ERROR LED will flash. The user will have to turn off PLC and back On again. PLC will determine RUN/STOP status by RUN/STOP switch. If there is no RUN/STOP
switch, PLC will return to STOP status automatically.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 2 of 88
Explanations:
1. FOR instruction indicates FOR~NEXT loops execute back and forth n times before escaping for the next execution.
2. When FOR~NEXT loops are not executed, use the CJ instruction to escape the loops.
3. FOR~NEXT loops can be nested for maximum five levels. Be careful that if there are too many loops, the increased PLC
scan time may cause timeout of watchdog timer and error. Users can use WDT instruction to modify this problem.
Sample:
Explanations:
1. The contents of S1 and S2 are compared and D denotes the comparision result.
2. Two comparison values are compared algebraically and the two values are binary values. When b15=1 in 16-bit instruction
or b31=1 in 32-bit instruction, the comparison will regard the value as a negative binary value.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 3 of 88
Explanations:
1. S is compared with its lower bound S1 and upper bound S2 and D denotes the comparison result.
2. When S1>S2, S1 is set as the comparison bound.
3. Two comparison values are compared algebraically and the two values are binary values. When b15=1 in 16-bit instruction
or b31=1 in 32-bit instruction, the comparison will regard the value as a negative binary value.
Sample:
S : Data source
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 4 of 88
D : Data destination
Explanations:
When this instruction is executed, the content of S will be moved directly to D. When this instruction is not executed, the content of D remains unchanged.
Sample:
S : Data source
m1 : Source position (nibble) of the first digit to be moved
m2 : Number of source digits (nibbles) to be moved
D : Destination
n : Destination position for the first digit (nibble)
Explanations:
This instruction can re-allocate or combine the data. When the instruction is executed, the content calculated from m1 digit down to m2 digit of S will be sent to the
lower m2 digit calculated from n digit of D.
Sample:
S : Data source
D : Destination
Explanations:
Reverse all the contents of S (0→1, 1→0) and send them to D. If the content is constant K, this constant K will be converted to BIN value automatically.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 5 of 88
S : Source
D : Destination
n : Number of data to move
Explanations:
The content of n registers starting from the start device assigned by S is sent to n registers starting from the start device assigned by D. If the number of points
assigned by n exceeds the range of the device, only the content within valid range will be sent.
Sample:
S : Source
D : Destination
n : Number of data to move
Explanations:
The content of S is sent to n registers staring from the start device assigned by D. If the number of points assigned by n exceeds the range of the device, only the
content within valid range will be sent.
Sample:
Explanations:
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 6 of 88
S : Source
D : Converted result
Explanations:
Convert the content of source S (BIN value) into BCD and save it in D.
Sample:
S : Source
D : Converted result
Explanations:
Convert the content of source S (BCD value) into BIN and save it in D.
Sample:
S1 : Dividend
S2 : Divisor
D : Quotient and Remainder
Explanations:
Sample:
S1 : Dividend
S2 : Divisor
D : Quotient and Remainder
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 7 of 88
S2
D KnY, KnM, KnS, T, C, D, @E, @F WORD
Explanations:
Sample:
S1 : Dividend
S2 : Divisor
D : Quotient and Remainder
Explanations:
Multiply S1 by S2 in BIN and save the result in D. Be careful with the positive/negative signs of S1, S2 and D when doing 16-bit and 32-bit operations.
Sample:
S1 : Dividend
S2 : Divisor
D : Quotient and Remainder
Explanations:
Divide S1 and S2 in BIN and save the result in D. Be careful with the positive/negative signs of S1, S2 and D when doing 16-bit and 32-bit operations.
Sample:
D : Destination
Explanations:
1. If the instruction is not a pulse execution one, “1” is added to the content of the assigned device D in every scan period
whenever the instruction is executed.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 8 of 88
2. In 16-bit operation, add 1 to 32,767 and obtain -32,768. In 32-bit operation, add 1 to 2,147,483,647 and obtain -
2,147,483,648.
Sample:
D : Destination
Explanations:
1. If the instruction is not a pulse execution one, “1” is subtracted from the content of the assigned device D in every scan
period whenever the instruction is executed.
2. In 16-bit operation, subtract 1 from -32,768 and obtain 32,767. In 32-bit operation, subtract 1 from -2,147,483,648 and
obtain 2,147,483,647.
Sample:
Explanations:
Sample:
API 27 OR Logical OR
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 9 of 88
Explanations:
Sample:
Explanations:
Sample:
Explanations:
This instruction can convert a negative BIN value into an absolute value.
D : Destination
n : Number of bit to rotate
Explanations:
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 10 of 88
D : Destination
n : Number of bit to rotate
Explanations:
Sample:
D : Destination
n : Number of bit to rotate
Explanations:
Rotate the device content assigned by D and carry flag M1022 to the right for n bits.
Sample:
D : Destination
n : Number of bit to rotate
Explanations:
Rotate the device content assigned by D and carry flag M1022 to the left for n bits.
Sample:
S : Source
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 11 of 88
D : Destination
n1 : Number of bits to shift
n2 : Number of bits to shift at one time
Explanations:
Move the bit device of n1 bits (desired length for moving register) starting from D to the right for n2 bits. Move S into D for n2 bits to supplement empty bits.
Sample:
S : Source
D : Destination
n1 : Number of bits to shift
n2 : Number of bits to shift at one time
Explanations:
Move the bit device of n1 bits (desired length for moving register) starting from D to the left for n2 bits. Move S into D for n2 bits to supplement empty bits.
Sample:
S : Source
D : Destination
n1 : Number of registers to shift
n2 : Number of registers to shift at one time
Explanations:
Move the serial data of n1 bytes starting from D to the right for n2 bytes. Move S into D for n2 bits to supplement empty bits.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 12 of 88
S : Source
D : Destination
n1 : Number of registers to shift
n2 : Number of registers to shift at one time
Explanations:
Move the serial data of n1 bytes starting from D to the left for n2 bytes. Move S into D for n2 bits to supplement empty bits.
Sample:
Explanations:
The serial data of n bytes starting from D are defined as “first-in, first-out” serial data and assign the first device as the pointer. When the instruction is executed, 1 is
added to the contenct of pointer, and the content of device assigned by S will be written into the assigned location in the “first-in, first-out” serial data assigned by the
pointer. When the content of pointer exceeds n - 1, this instruction will not process any new value written in and the zero flag M1022 = On.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 13 of 88
Explanations:
The serial data of n bytes starting from S are defined as “first-in, first-out” serial data and assign the first device as the pointer. When the instruction is executed, 1 is
subtracted from the contenct of pointer, and the content of device assigned by S will be written into the assigned location in the “first-in, first-out” serial data assigned
by the pointer. When the content of pointer equals 0, this instruction will not process any reading/writing or data and the zero flag M1020 = On.
Sample:
D1 : Starting destination
D2 : Ending destination
Explanations:
Sample:
S : Source to decode
D : Destination
n : Number of bits to decode
Explanations:
The lower “n” bits of S are decoded and the results of “2 n” bits are stored in D.
Sample:
S : Source to encode
D : Destination for storing encode data
n : Number of bits to encode
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 14 of 88
Explanations:
1. The lower “2 n” bits of S are encoded and the results are stored in D.
2. If several bits of S are 1, the first bit that is 1 will be processed orderly from high bit to low bit.
Sample:
S : Source
D : Destination stores number of ON bits
Explanations:
Among the 16 bits of S, the total of bits whose content is “1” will be stored in D.
Sample:
S : Source
D : Destination for storing result
n : Bit number to test
Explanations:
When the nth bit of S is “1”, D = On; when the nth bit of S is “0”, D = Off.
Sample:
S : Starting source
D : Destination for result
n : Number of device to use
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 15 of 88
Explanations:
1. After the content of n devices starting from S are added up, the mean value of the result will be stored in D.
2. Remainders in the operation will be left out.
Sample:
S : Alarm timer
m : Time setting prior to alarm
D : Alarm
Explanations:
ANS instruction is exclusively used for driving the output alarm device.
Sample:
Explanations:
Sample:
S : Source
D : Destination to store result
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 16 of 88
D D WORD
Explanations:
This instruction performs a square root operation on S and stores the result in D.
Sample:
S : Source
D : Destination
Explanations:
1. When M1081 is OFF, BIN integer is converted into binary floating point value. At this time, S of the 16-bit instruction, FLT,
occupies 1 register and D occupies 2 registers.
2. When M1081 is ON, binary floating point value is converted into BIN integer (digits after decimal point are left out). At this
time, S of the 16-bit instruction, FLT, occupies 2 registers and D occupies 1 register (action same as that of INT
instruction).
Sample:
Explanations:
The status of all PLC input/output terminals will be updated after the program scans to END. When the program starts to scan, the status of external input terminal is
read into the existing input memory. The output terminal will send the content in output memory to the output device after END instruction is executed. Therefore, this
instruction is applicable when the latest input/output data are needed for the operation.
Sample:
Explanations:
To avoid interferences, X0~X17 of EH/EH2/SV series MPU and X0~X7 of SA/SX/SC MPU are equipped with digital filters on output terminals. Digital filters adjust
responding time by REFF instruction. This instruction sets up n directly in D1020 (adjusting the responding time of X0~X7) and D1021 (adjusting the responding time
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 17 of 88
of X10~X17).
Sample:
Explanations:
1. This instruction occupies continuous 8 input devices starting from S. n external output terminals starting from D1 read 8
switches of n rows by matrix scan, obtaining 8 × n multiple matrix input devices. The status of scanned switches will be
stored in devices starting from D2.
2. When 8-terminal 8-row matrix inputs are in use, reading time of each row is approximately 25ms, totaling the reading of 8
rows 200ms, i.e. input signals with On/Off speed of over 200ms are not suitable for matrix input.
Sample:
S1 : Compare value
S2 : Number of high-speed counter
D : Compare result
Explanations:
1. High-speed counter inputs counting pulses from corresponding external input terminals X0~X17 by interruption. When the
high-speed counter assigned by S adds 1 or substract 1, DHSCS will perform comparison immediately. When the present
value in high-speed counter equals the comparison value indicated by S1, device assigned by D will turn On and even the
afterward comparison results are unequal, the device will still be On.
2. If the devices assigned by D are Y0~Y17, when the comparison value equals the present value of high-speed counter, the
comparison result will immediately output to the external output terminals Y0~Y17 and the rest of Y devices will be affected
by the scan cycle. Devices M and S act immediately without being affected by the scan cycle.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 18 of 88
S1 : Compare value
S2 : Number of counter
D : Compare result
Explanations:
1. High-speed counter inputs counting pulses from corresponding external input terminals X0~X17 by interruption. When the
number of high-speed counter assigned by S2 performs + 1 or -1, DHSCR will perform comparison immediately. When the
present value in high-speed counter equals the comparison value indicated by S1, device assigned by D will turn Off and
even the afterward comparison results are unequal, the device will still be Off.
2. If the devices assigned by D are Y0~Y17, when the comparison value equals the present value of high-speed counter, the
comparison result will immediately output to the external output terminals Y0~Y17 (and clear the assigned Y output) and
the rest of Y devices will be affected by the scan cycle. Devices M and S act immediately without being affected by the
scan cycle.
Sample:
Explanations:
1. Comparison value S is compared with lower bound S1 and upper bound S2. The comparison result is stored in D.
2. S1 should be equal to or smaller than S2 (S1 ≦ S2).
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 19 of 88
Explanations:
1. The received number of pulses of input devices assigned by S1 is calculated within the time assigned by S2 (unit: ms). The
calculated result is stored in the register assigned by D.
2. This instruction is mainly used for obtaining a proportional value of rotation speed. The result D and rotation speed will be
in proportion. The following equation is for obtaining the rotation speed of motor.
N: Rotation speed
n: The number of pulses produced per rotation
t: Detectingtime assigned by S2 (ms)
Sample:
Explanations:
1. PLSY instruction assigns the number of output pulses S2 from output device D at the frequency S1.
2. When PLSY instruction is executed, Y starts to output pulses. At this time, the output will not be affected if S2 is modified. If
a change on number of pulses is required, PLSY has to be stopped first.
3. S1 can be changed when PLSY is being executed. It a change on the effecting time is required, S1 has to be changed from
the program being executed to PLSY being executed.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 20 of 88
Explanations:
1. PWM instruction assigns the pulse output width S1 and pulse output cycle S2 from output device D.
2. S1 and S2 can be changed when PWM instruction is being executed.
Sample:
Explanations:
1. When PLSR instruction is executed, after maximum frequency S1, total number of pulses numbers (PLS) S2 and
acceleration/deceleration time S3 are set up, pulses output from device D. The output starts at the frequency of increasing
S1/10 at a time. The time of every frequency is S3/9.
2. During every acceleration section, the number of pulses ( frequency × time) may not all be integers. PLC will round up the
number to an integer before output. Therefore, the acceleration time of every section may not be exactly the same. The
offset is determined upon the frequency and the decimal after rounding up. In order to ensure correct number of output
pulses, PLC will supplement insufficient pulses in the last section.
Sample:
D1 : The smallest number for the designated-status step point in auto mode
D2 : The greatest number for the designated-status step point in auto mode
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 21 of 88
Explanations:
IST instruction is a convenient instruction specifically for the initial status of step ladder control procedure to accommodate special auxiliary relay.
Sample:
S1 : Starting source
S2 : Compare value
D : Starting destination for storing compared result (occupies 5 continuous devices)
n : Number of devices to compare
Explanations:
S1 assigns the area number of compared registers and n assigns the compared number of data. The compared register data are compared with the data assigned by
S2 and the result is stored in several registers assignedd by D.
Sample:
Explanations:
1. When ABSD instruction is executed, the present value of S2 is compared with n upper/lower bound value areas S1, The
comparison result is stored in D。
2. S2 of DABSD instruction can assign high-speed counters. However, when the current value of high-speed counter is
compared with its set value, the result cannot output immediately because it is affected by scan time. If immediate output is
required, please use DHSZ instruction exclusively for high-speed counters.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 22 of 88
Sample:
Explanations:
1. When the current value of S2 is compared with the set value of S1, whenever a set value is reached, the current value of
S2 will be reset to 0 and recounting starts. The section number currently being executed will be temporarily stored in S2 +1.
2. INCD instruction generates many output pulses by a pair of counters, usually used for relative cam control.
Sample:
D : Device number for storing the ON time of the input (occupies 2 continuous devices)
Explanations:
1. The “On” time (unit: 100ms) of external button switch is stored in the device number of D + 1. The “On” time (unit: second)
of switch is multiplied by n and is stored in D.
2. Multiple setting:
When n = 0, unit of D = second
When n = 1, unit of D = 100ms (D × 100)
When n = 2, unit of D = 10ms (D × 10)
Sample:
S : DVP-SA/SX/SC: T0 - T191
DVP-EH/EH2/SV: T0 - T199
DVP-EH3/SV2: T0 - T183
DVP-ES2/EX2/SS2/SA2/SX2/SE: T0 - T183
m : Set-point value of timer (m=1~32,767), unit in 100ms
D : Starting device of output (occupies 4 continuous devices)
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 23 of 88
Explanations:
Sample:
D : Destination device
Explanations:
Sample:
Explanations:
1. This instruction is for obtaining slope (the relation between linearity and scan time). Before using this instruction, users
have to preset the scan time.
2. The set value of start slope signal is pre-written in S1 and set value of end slope signal in S2. The set value in S1 increases
towards S2 through n scans (time) and is stored in D. Times of scan are stored in D+1.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 24 of 88
D D WORD
Explanations:
1. For parameter settings of operand m, please refer to the following description. K, H, D devices can be specified by
operand m. If the set value is not in the available range, no transformation or move operation will be executed and no error
will be detected.
2. K, H, D devices can be specified by operand n, which indicates the length of the source data stack. The available range for
n is 1~256. If the set value falls out of available range, PLC will take the max value (256) or the min value (1) as the set
value automatically.
3. Explanations on parameters of m operand:
l k0: Transform 8-bit data into 16-bit data (Hi-byte, Lo-byte)
l k1: Transform 8-bit data into 16-bit data (Lo-byte, Hi-byte)
l k2: Transform 16-bit data (Hi-byte, Lo-byte) into 8-bit data
l k3: Transform 16-bit data (Lo-byte, Hi-byte) into 8-bit data
l k4: Transform 8-bit HEX data into ASCII data (higher 4 bits, lower 4 bits)
l k5: Transform 8-bit HEX data into ASCII data (lower 4 bits, higher 4 bits)
l k6: Transform 8-bit ASCII data (higher 4 bits, lower 4 bits) into HEX data
l k7: Transform 8-bit ASCII data (lower 4 bits, higher 4 bits) into HEX data
l k8: Transform 8-bit GPS data into 32-bit floating point data
Explanations:
The sorted result is stored in m1 × m2 registers starting from the device assigned by D. Therefore, if S and D assign the same register, the sorted result will be the
same as the sorted data in S.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 25 of 88
Explanations:
This instruction assigns 10 external input terminals (representing decimal numbers 0~9) starting from S. The 10 terminals are respectively connected to 10 keys. By
pressing the keys, users can enter a 4-digit decimal figure 0~9,999 (16-bit instruction) or a 8-digit figure 0~99,999,999 (32-bit instruction) and store the figure in D1. D2
is used for storing key status.
Sample:
Explanations:
1. This instruction assigns 4 continuous external input terminals starting from S and 4 continuous external input terminals
starting from D1 to construct a 16-key keyboard by matrix scan. The keyed-in value will be stored in D2 and D3 is used for
storing key status. If several keys are pressed at the same time, the first key has the priority.
2. The keyed-in value is termporarily stored in D0. When the 16-bit instruction HKY is in use, 9,999 is the maximum value D0
is able to store. When the value exceeds 4 digits, the first digit overflows. When the 32-bit instruction DHKY is in use,
99,999,999 is the maximum value D0 is able to store. When the value exceeds 8 digits, the first digit overflows.
Sample:
Explanations:
This instruction assigns 4 or 8 continuous external input terminals starting from S and 4 continuous external input terminals starting from D1 to scan read 1 or 2 4-digit
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 26 of 88
DIP switches.The set values of DIP switches are stored in D2. n decides to read 1 or 2 4-digit DIP switches.
Sample:
Explanations:
When X10 = On, contents (0~F: hex) of the lower 4 bits (b0~b3) of D10 will be decoded into 7-segment display for output. The decoded results will be stored in
Y10~Y17. If the content exceeds 4 bits, the lower 4 bits are extracted for decoding.
Sample:
Explanations:
1. When this instruction starts to be executed, D constructs a 7-segment display scan circuit. The value in S will be converted
into BCD codes and sent to 7-segment display.
2. This instruction occupies 8 or 12 continuous external input terminals starting from D for displaying 1 or 2 4-digit 7-segment
display data and outputs of scanned signals. Every digit carries a 7-segment display drive (to convert the BCD codes into
7-segment display signal). The drive also carries latch control signals to retain the 7-segment display.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 27 of 88
D2 Y BIT
n Decimal, 16# WORD
Explanations:
When this instruction is executed, S is defined as down key, S + 1 is defined as up key, S + 2 is defined as right key and S + 3 is defined as left key. Thekeys are used
for setting up and displaying external set values. The set values (range: 0~9,999) are stored in D20.
Sample:
Explanations:
When this instruction is executed, the content in S is converted into ASCII code and stored in D.
Sample:
Explanations:
This instruction will output the ASCII codes in the 4 registers starting from S from the output devices in the order assigned by D.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 28 of 88
Explanations:
DVP series PLCs read CR data of special modules by this instruction. When the instruction is executed, PLC reads the content of m2 special module in m1 and stores
the data in D. PLC reads n data at a time.
Sample:
Explanations:
DVP series PLCs write data into CR of special modules by this instruction. When the instruction is executed, PLC writes the content of S into m2 special module in m1.
PLC writes n data at a time.
Sample:
Explanations:
1. This instruction is a handy instruction exclusively for MPU to use RS-485 serial communication interface. The user has to
pre-store word data in S data register, setup data length m and the data receiving register D and received data length n. If
E, F index registers are used to modify S and D, the user cannot change the set values of E and F when the instruction is
being executed; otherwise errors may cause in data writing or reading.
2. If sending data is needed, m can be indicated as K0. If sending data is not needed, n can be indicated as K0.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 29 of 88
Explanations:
Sample:
S : Source data
D : Destination of result
n : Number of digits to convert (n=1~256)
Explanations:
1. 16-bit conversion mode: When M1161 = Off, the instruction converts every bit of the hex data in S into ASCII codes and
send them to the 8 high bits and 8 low bits of D. n = the converted number of bits.
2. 8-bit conversion mode: When M1161 = On, the instruction converts every bit of the hex data in S into ASCII codes and
send them to the 8 low bits of D. n = the number of converted bits. (All 8 high bits of D = 0)
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 30 of 88
S : Source data
D : Destination of stored result
n : Number of digits to convert (n=1~256)
Explanations:
1. 16-bit conversion mode: When M1161 = Off, the instruction is in 16-bit conversion mode. ASCII codes of the 8 high bits
and 8 low bits of the hex data in S are converted into hex value and sent to D (every 4 bits as a group). n = the number of
bits converted into ASCII codes.
2. 8-bit conversion mode: When M1161 = On, the instruction is in 8-bit conversion mode. Every bit of the hex data in S are
converted into ASCII codes and sent to the 8 low bits of D. n = the number of converted bits. (All 8 high bits of D = 0)
Sample:
S : Source data
D : Destination of storing check sum
n : Number of values to use in the instruction (n=1~256)
Explanations:
1. 16-bit conversion mode: When M1161 = Off, the instruction is in 16-bit conversion mode. The instruction sums up n data (8
bits as a unit) from the start register assigned by S and stores the results in the registers assigned by D. Sign bits are
stored in D + 1.
2. 8-bit conversion mode: When M1161 = On, the instruction is in 8-bit conversion mode. The instruction sums up n data (8
bits as a unit; only 8 low bits are effective) from the start register assigned by S and stores the results in the registers
assigned by D. Sign bits are stored in D + 1.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 31 of 88
Explanations:
VRRD instruction is used for reading 2 points (No.0, No.1) of PLC MPU or the VR volume change in the 6 points of function card (No.2 ~ No.7) and converting the data
into values 0 ~ 255 (stored in D).
Sample:
Explanations:
VRRD instruction is used for reading 2 points (No.0, No.1) of PLC MPU or the VR volume scale (value: 0 ~ 10) in the 6 points of function card (No.2 ~ No.7) and
storing the data in D. If the position of the volume falls in the middle of two scales, VRRD will round up the value into an integer of 0 ~ 10.
Sample:
Explanations:
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 32 of 88
Explanations:
This instruction is specifically for PID control. PID operation will be executed by the scan only when the sampling time is reached. PID refers to “proportion, integration
and differential”. PID control is widely applied to many machines, pneumatic and electronic equipments.
Sample:
Explanations:
1. MODRD is a drive instruction exclusively for peripheral communication equipment in MODBUS ASCII mode/RTU mode.
The built-in RS-485 communication ports in Delta VFD drives (except for VFD-A series) are all compatible with MODBUS
communication format. MODRD can be used for controlling communication (read data) of Delta drives.
2. The feedback (returned) data from the peripheral equipment will be stored in D1070 ~ D1085. After receiving the feedback
data is completed, PLC will auto-check if all data are correct. If there is an error, M1140 will be On.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 33 of 88
Explanations:
1. MODWR is a drive instruction exclusively for peripheral communication equipment in MODBUS ASCII mode/RTU mode.
The built-in RS-485 communication ports in Delta VFD drives (except for VFD-A series) are all compatible with MODBUS
communication format. MODRD can be used for controlling communication (write data) of Delta drives.
2. The feedback (returned) data from the peripheral equipment will be stored in D1070 ~ D1076. After receiving the feedback
data is completed, PLC will auto-check if all data are correct. If there is an error, M1140 will be On.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 34 of 88
API 102 / 103 / 104 FWD / REV / STOP Series Drive Forward / Reverse / Stop Instruction
S1 : Communication address
S2 : Frequence of VFD operation
n : Destination
Explanations:
1. FWD/REV/STOP are handy instructions exclusively for Delta VFD-A/H series AC motor drive to perform forward
running/reverse running/stop. Be suer to set up communication timeout (D1129) when executing this instruction.
2. S2 = operation frequency of AC motor drive. Set frequency in A-series AC motor drive: K0 ~ K4,000 (0.0Hz ~ 400.0Hz).
Set frequency in H-series: K0 ~ K1,500 (0Hz ~ 1,500Hz).
3. n = instructed target. n=1: AC motor drive at assigned address. n=2: all connected AC motor drives.
4. The feedback (returned) data from the peripheral equipment will be stored in D1070 ~ D1080. After receiving the feedback
data is completed, PLC will auto-check if all data are correct. If there is an error, M1142 will be On. When n = 2, PLC will
not receive any data.
S : Communication address
n : Status object
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 35 of 88
Explanations:
S : Communication address
n : Command object
Explanations:
1. RSTEF is a handy communication instruction exclusively for Delta VFD-A series AC motor drives and is used for reset
when the AC motor drive operates abnormally.
2. n: instructed target. n=1: AC motor drive at assigned address. n=2: all connected AC motor drives.
Explanations:
1. 16-bit conversion mode: When M1161 = Off, S divides its hex data area into higher 8 bits and lower 8 bits and performs
LRC checksum operation on each bit. The data will be sent to the higher 8 bits and lower 8 bits in D. n = the number of
calculated bits.
2. 8-bit conversion mode: When M1161 = On, S divides its hex data area into higher 8 bits (invalid data) and lower 8 bits and
performs LRC checksum operation on each bit. The data will be sent to the lower 8 bits in D and occupy 2 registers. n =
the number of calculated bits. (All higher bits in D are “0”.)
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 36 of 88
Explanations:
1. 16-bit conversion mode: When M1161 = Off, S divides its hex data area into higher 8 bits and lower 8 bits and performs
CRC checksum operation on each bit. The data will be sent to the higher 8 bits and lower 8 bits in D. n = the number of
calculated bits.
2. 8-bit conversion mode: When M1161 = On, S divides its hex data area into higher 8 bits (invalid data) and lower 8 bits and
performs CRC checksum operation on each bit. The data will be sent to the lower 8 bits in D and occupy 2 registers. n =
the number of calculated bits. (All higher bits in D are “0”.)
Sample:
Explanations:
1. This instruction stores the value read from digital switch function card into D.
2. The read value is stored in the low byte in D. Every switch has a corresponding bit.
Sample:
Explanations:
1. The binary floating point values S1 and S2 are compared with each other. The comparison result (>, =, <) is stored in D.
2. If S1 or S2 is an indicated constant K or H, the instruction will convert the constant into a binary floating point value before
the comparison.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 37 of 88
Explanations:
Sample:
Explanations:
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 38 of 88
S1 D WORD
S2 K, H, D WORD
D D WORD
N K, H, D WORD
Explanations:
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 39 of 88
S1 : Multiplicand
S2 : Multiplicator
D : Product
Explanations:
When D serves as a bit device, it can designate K1 ~ K4 and construct a 16-bit result, occupying 16-bit data.
8. In 32-bit BIN multiplication,
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 40 of 88
When D serves as a bit device, it can designate K1 ~ K8 and construct a 32-bit result, occupying consecutive 32-bit data.
Sample:
S1 : Dividend
S2 : Divisor
Explanations:
When D serves as a bit device, it can designate K1 ~ K4 and construct a 16-bit result, occupying a 16-bit quotient and
remainder.
8. In 32-bit BIN division,
When D serves as a bit device, it can designate K1 ~ K8 and construct a 32-bit result, occupying a 32-bit quotient.
Sample:
S : Source (degree)
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 41 of 88
Explanations:
Sample:
Explanations:
Sample:
S : Data source
D : Destination result
Explanations:
DEBCD instruction converts binary floating point value in the register assigned by S into decimal floating point value and stores it in the register assigned by D.
Sample:
S : Data source
D : Destination result
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 42 of 88
S D WORD
D D WORD
Explanations:
DEBIN instruction converts decimal floating point value in the register assigned by S into binary floating point value and stores it in the register assigned by D.
Sample:
S1 : Augend
S2 : Addend
D : Addition result
Explanations:
S1 + S2 = D. The floating point value in the register assigned by S1 and S2 are added up and the result is stored in the register assigned by D. The addition is
conducted in binary floating point system.
Sample:
S1 : Minuend
S2 : Subtrahend
D : Subtraction result
Explanations:
S1 - S2 = D. The floating point value in the register assigned by S2 is subtracted from the floating point value in the register assigned by S1 and the result is stored in
the register assigned by D. The subtraction is conducted in binary floating point system.
Sample:
S1 : Multiplicand
S2 : Multiplier
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 43 of 88
D : Multiplication result
Explanations:
S1 ´ S2 = D. The floating point value in the register assigned by S1 is multiplied with the floating point value in the register assigned by S2 and the result is stored in the
register assigned by D. The multiplication is conducted in binary floating point system.
Sample:
S1 : Dividend
S2 : Divisor
D : Quotient
Explanations:
S1 ¸ S2 = D. The floating point value in the register assigned by S1 is divided by the floating point value in the register assigned by S2 and the result is stored in the
register assigned by D. The division is conducted in binary floating point system.
Sample:
Explanations:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 44 of 88
Sample:
Explanations:
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 45 of 88
Explanations:
This instruction performs “log” operation of the content in S1 and S2 and stores the result in D. Only positives are valid for the content in S1 and S2. When assigning D
registers, the data should be 32-bit and the operation should be performed in floating point system. Therefore, S1 and S2 should be converted into floating point
values.
Sample:
S : Source device
D : Destination device to store the result
Explanations:
This instruction performs a square root operation on the content in the register assigned by S and stores the result in the register assigned by D. The square root
operation is performed in floating point system.
Sample:
S1 : Base device
S2 : Exponent
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 46 of 88
D : Result
Explanations:
1. This instruction performs power multiplication of binary floating point S1 and S2 and stores the result in D.
POW〔S1 + 1, S1〕^〔S2 + 1, S2〕= D
2. Only positives are valid for the content in S1. Both positives and negatives are valid for the content in S2. When assigning
D registers, the data should be 32-bit and the operation should be performed in floating point system. Therefore, S1 and S2
should be converted into floating point values.
Sample:
S : Source device
D : Destination device to store the result
Explanations:
The binary floating point value of the register assigned by S is converted to BIN integer and stored in the register assigned by D. The decimal of BIN integer is left out.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 47 of 88
Explanations:
The SIN value obtained by S is calculated and stored in the register assigned by D.
Sample:
Explanations:
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 48 of 88
Explanations:
Sample:
Explanations:
Sample:
Explanations:
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 49 of 88
Explanations:
Sample:
Explanations:
Sample:
Explanations:
Sample:
Explanations:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 50 of 88
Sample:
Explanations:
After DELAY instruction is executed, the program after DELAY in every scan period will execute delay outputs according to the delay time indicated by the user.
Explanations:
1. GPWM instruction indicates the pulse output width S1 and pulse output cycle S2 and the pulses output from device D.
2. S1 and S2 can be modified when GPWM instruction is being executed.
Sample:
Explanations:
After the user sets up S3 (sampling time), S3 + 1(with/without filter and heating environment), and S1 (desired target value of temperature), when FTC instruction is
executed, PLC will operate the set value and S2 (actual present value of the temperature) through the procedure in the fuzzy control block diagream (as showed
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 51 of 88
Sample:
Explanations:
1. S1 occupies 3 consecutive registers when in use. S1 + 0 are for the user to store the designated value; S1 + 1 (the
current position of the valve) and S1 + 2 are for storing the parameters recorded in the instruction and please DO
NOT use and alter these two registers.
2. D occupies 2 consecutive output devices when in use. D + 0 is the “open” contact and D + 1 is the “close” contact.
3. This instruction only supports EH2/SV and does not support EH.
4. The unit of time: 0.1 second. When the scan time of the program exceeds 0.1 second, DO NOT use this instruction
to adjust the position of the valve.
5. Frequency of the output device: 10Hz.
6. When the time of S1 + 0 > the fully-opened time set in S2, D + 0 will keep being On and D + 1 being Off. When the
time of S1 + 0 < 0, D + 0 will keep being Off and D + 1 being On.
7. When the instruction is enabled, the instruction will start to control the valve from “0” time position. Therefore, if the
user cannot be sure whether the valve is at “0” before executing the instruction, please designate S1 + 0 as less
than 0 and execute the instruction for S2 (time) before sending in the correct target control time.
API 147 SWAP Swap High/Low Byte
Explanations:
1. As 16-bit instruction: the contents in the 8 high bytes and 8 low bytes are swapped.
2. As 32-bit instruction: the 8 high bytes and 8 low bytes in the two registers swap with each other respectively.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 52 of 88
D D WORD
n Decimal, 16#, D WORD
Explanations:
This instruction reads the data in file registers of PLC MPU and stores the data in data registers.
Sample:
Explanations:
This instruction reads the data in file registers of PLC MPU and writes the data into data registers.
Sample:
Explanations:
The user sets up register S and pre-saves the length of data to be written in into the register or sets up the register for storing the read data. Then MODRW is
executed, PLC reads or writes the desired data in S3 (address of data) of S1 (address of connected device) through COM2 (RS-485) communication port according to
the set read/write function code S2.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 53 of 88
S : Source device
D : Destination device which stores detection result
Explanations:
1. PWD instruction detects the “On” time of X10 ~ X17 input signals.
2. M1169 = Off refers to the time of continuous rising edges/falling edges of the detected input signals (unit of time: 100us).
M1169 = On refers to the time of 2 continuous rising edges of the detected input signals (unit of time: 1us).
Sample:
Explanations:
1. When RTMU is executed, if the D and n entered by the user are legal, interruption of the timer is enabled and the counting
starts and the special D assigned by D is cleared as 0. When RTMD is executed, interruption of the timer is disabled and
the calculated teim will be assigned to special D assigned by RTMD.
2. With API 153 RTMD, RTMU can measure the execution time of “I” interruption service program, which can be reference for
dealing with high-speed response when the user is at the initial stage of developing the program.
Sample:
Explanations:
D is the device to store the measuring time (unit: 1us). The No. of D should be the same as that of the corresponding API 152 RTMU; otherwise, unexpected
measurement results may occur.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 54 of 88
Explanations:
RAND instruction produces random numbers within the range between lower bound S1 and upper bound S2 and stores the result in D.
Sample:
Explanations:
This instruction reads the absolute position (ABS) of MITSUBISHI MR-J2 servo drive (with absolute position check function).
Sample:
Explanations:
When ZRN instruction is executed, PLC speeds up to S1 and starts to move. When near point signal (DOG) S3 turns from “Off” to “On”, the speed decelerates to creep
speed S2. When S3 turns from “On” to “Off”, at the time when pulse output stops, the present value of the pulses in the register will be written as “0”. When pulse
output is finished, end flag of pulse output will be enabled. This instruction cannot be used for searching for the location of near point signal and zero return can only
moves towards a single direction. Therefore, in zero return, the present value of pulses in the register will change towards a decreasing value.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 55 of 88
Explanations:
When PLSV is executed, PLC outputs pulses and direction control signals in the set frequency S from pulse output device D1 and rotation direction signal output
device D2.
Sample:
Explanations:
1. When DRVI instruction is executed, PLC outputs the number of pulses (by relative position; +: forward direction, -:
backward direction)assigned by S1 and direction control signals in the set frequency S2 from pulse output device D1 and
rotation direction signal output device D2.
2. D1 is the pulse output device. It can designate CH0 (Y0) and CH1 (Y2).
3. D2 is the direction signal output device. It can designate CH0 (Y1) and CH1 (Y3).
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 56 of 88
Explanations:
When DRVA instruction is executed, PLC outputs the number of pulses (by absolute position; +: forward direction, -: backward direction)assigned by S1 and direction
control signals in the set frequency S2 from pulse output device D1 and rotation direction signal output device D2.
Sample:
Explanations:
S1 (hour), S2 (minute), S3 (second) are compared with the present values of “hour”, “minute” and “second” in the RTC of S. The comparison result is stored in D.
Sample:
Explanations:
The present hour, minute and second in the RTC of S is compared with lower-bound time period assigned by S1 and upper-bound time period assigned by S2. The
comparsion result is stored in D.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 57 of 88
S1 : Time augend
S2 : Time addend
D : Addition result
Explanations:
S1 + S2 = D. The hour, minute, and second of the RTC assigned by S1 plus the hour, minute, and second assigned by S2. The result is stored in the hour, minute, and
second of the register assigned by D.
Sample:
S1 : Time Minuend
S2 : Time Subtrahend
D : Subtraction result
Explanations:
S1 - S2 = D. The hour, minute, and second of the RTC assigned by S1 minus the hour, minute, and second assigned by S2. The result is stored in the hour, minute,
and second of the register assigned by D.
Sample:
D : The device stores the current time of calendar (occupies 7 continuous devices)
Explanations:
The built-in RTC in PLC MPU offers 7 data (year, week, month, day, hour, minute, second) stored in D1319 ~ D1313. TRD instruction is for program designers to read
the current data of the RTC to the assigned 7 registers.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 58 of 88
Explanations:
1. To make adjustment on the RTC, use this instruction to write the correct time into the built-in RTC.
2. When this instruction is executed, the new set time will be written in the PLC built-in RTC immediately. Therefore, please
be noted that the new set time has to match the current time then when the instruction is executed.
Sample:
S1 : Source device 1
S2 : Bits to be masked (OFF)
D : Source device 2 / Operation results
[D = (S1 & S2) | (D & ~S2)]
Explanations:
1. The instruction conducts logical AND operation between S1 and S2 first, logical AND operation between D and ~S2
secondly, and combines the 1st and 2nd results in D by logical OR operation.
2. Rule of Logical AND operation: 0 AND 1 = 0, 1 AND 0 = 0, 0 AND 0 = 0, 1 AND 1 = 1
3. Rule of Logical OR operation: 0 OR 1= 1, 1 OR 0 = 1, 0 OR 0 = 0, 1 OR 1 = 1.
API 169 HOUR Hour Meter
S : Hour set-point value, count hours until they reach this value
D1 : Current time during counting and unit is hour (occupies 2 continuous devices)
D2 : Output device
Explanations:
1. This instruction times the continuity of input contact to be timer. When the set time (unit: hour) is reached, the continuity of
the output device will be “On”, which can be used on timing or maintenance of machine operation.
2. When the continuity of the output device is “On”, the timer will resume the timing.
Sample:
S : Source device
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 59 of 88
Explanations:
This instruction converts the BIN value in the device assigned by S into Gray Code value and stores the value in D.
Sample:
Explanations:
1. This instruction converts the Gray Code value in the device assigned by S into BIN value and stores the value in D.
2. This instruction converts the content in the absolute-position encoder (normally outputs values in Gray Code) on PLC input
terminals into BIN value and stores the value in the assigned register.
Sample:
Explanations:
1. In DADDR instruction, floating point values (e.g. F1.2) can be entered directly into S1 and S2 or stored in register D for
operation.
2. When DADDR instruction is executed, the operation result of the floating point addition of S1 and S2 is stored in D. (This
instruction does not support EH series MPU.)
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 60 of 88
Explanations:
1. In DSUBR instruction, floating point values (e.g. F1.2) can be entered directly into S1 and S2 or stored in register D for
operation.
2. When DSUBR instruction is executed, the operation result of the floating point subtraction of S1 and S2 is stored in D. (This
instruction does not support EH series MPU.)
Sample:
Explanations:
1. In DMULR instruction, floating point values (e.g. F1.2) can be entered directly into S1 and S2 or stored in register D for
operation.
2. When DMULR instruction is executed, the operation result of the floating point multiplication of S1 and S2 is stored in D.
(This instruction does not support EH series MPU.)
Sample:
Explanations:
1. In DDIVR instruction, floating point values (e.g. F1.2) can be entered directly into S1 and S2 or stored in register D for
operation.
2. When DDIVR instruction is executed, the operation result of the floating point division of S1 and S2 is stored in D. (This
instruction does not support EH series MPU.)
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 61 of 88
Explanations:
MMOV instruction sends the data in the 16-bit S device to the 32-bit D device. The designated sign bit will be copied and
stored in the destination device.
Explanations:
1. GPS data receiving instruction is only applicable on COM1 (RS-232), with communication format: 9600,8,N,1, protocol:
NMEA-0183, and communication frequency: 1Hz.
2. Operand S is sentence identifier for GPS data receiving. K0: $GPGGA, K1: $GPRMC.
3. Operand D stores the received data.
Explanations:
1. Operand S occupies 208 consecutive word registers for storing parameters including time, latitude, longitude…etc.
2. Operand D occupies 8 consecutive word registers for storing received data including zenith, azimuth, incidence…etc.
3. The execution time of SPA instruction costs up to 50ms, therefore we suggest users to execute this instruction with an
interval not less than 1 sec, preventing the instruction from taking too much PLC operation time.
S : Source device
D : Data length to be summed up
n : Device for storing the result
Explanations:
1. WSUM instruction sums up n devices starting from S and store the result in D.
2. If the specified source devices S are out of valid range, only the devices in valid range will be processed.
3. Valid range for n: 1~64. If the specified n value is out of the available range (1~64), PLC will take the upper (64) or
lower (1) bound value as the set value.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 62 of 88
Explanations:
1. The two matrix sources S1 and S2 perform matrix ‘AND’ operation according to the array length n. The result is stored in D.
2. Operation rule of matix ‘OR” : The result will be 1 if both two bits are 1; otherwise the result will be 0.
Sample:
Explanations:
1. The two matrix sources S1 and S2 perform matrix ‘OR’ operation according to the array length n. The result is stored in D.
2. Operation rule of matrix ‘OR’: The result will be 1 if either of the two bits is 1. The result is 0 only when both two bits are 0.
Sample:
Explanations:
1. The two matrix sources S1 and S2 perform matrix ‘XOR’ operation according to the array length n. The result is stored in D.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 63 of 88
2. Operation rule of matrix ‘XOR’: The result will be 1 if the two bits are different. The result will be 0 if the two bits are the
same.
Sample:
Explanations:
1. The two matrix sources S1 and S2 perform matrix ‘XNR’ operation according to the array length n. The result is stored in D.
2. Operation rule of matrix ‘XNR’: The result will be 1 if the two bits are the same. The result will be 0 if the two bits are
different.
Sample:
Explanations:
Matrix source S performs inverse matrix operation according to the array length n. The result is stored in D.
Sample:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 64 of 88
Explanations:
1. This instruction compares every bit in S1 with every bit in S2 starting from location D and finds out the location of different
bits. The location will be stored in D.
2. The matrix comparison flag decides to compare between equivalent values or different values. When the comparison is
completed, it stops immediately and the matrix bit search flag turns “On”. When the comparison progresses to the last bit,
the matrix search end flag turns “On” and the No. where the comparison is completed is stored in D. The comparison will
start from the 0th bit in the next scan period and the matrix search start flag will turn “On”. When D exceeds the range, the
pointer error flag will turn “On”.
Sample:
Explanations:
When this instruction is executed, it first determines if the matrix pointer clear flag is “On”. If it is “On”, pointer D is cleared as 0. The instruction then reads the On/Off
status from the 0th bit of S to the matrix rotation output carry flag. Whenever finishing reading 1 bit, the instruction determines whether the matrix pointer increasing flag
is “On”. If it is “On”, the value of pointer D plus 1. When the reading is processed to the last bit, the matrix search end flag turns “On” and pointer D records the No. of
read bits.
Sample:
Explanations:
When this instruction is executed, if first determines if the matrix pointer clear flag is “On”. If it is “On”, pointer D is cleared as 0. The instruction then writes the value in
the matrix shift input complement flag into the location starting from the 0th bit of S. Whenever finishing writing 1 bit, the instruction determines whether the matrix
pointer increasing flag is “On”. If it is “On”, the value of pointer D plus 1. When the writing is processed to the last bit, the matrix search end flag turns “On” and pointer
D records the No. of written bits.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 65 of 88
Explanations:
1. This instruction performs left-right displacement on the matrix bits in S according to array length n. M1097 determines the
left or right displacement of matrix bits.
2. The empty bits derived from every displacement of 1 bit (when left displacement: b0; when right displacement: b16n-1) is
filled by complement flags. The spare bits (when left displacement: b16n-1; when right displacement: b0) are sent to carry
flags. The result is stored in D.
Explanations:
1. This instruction performs left-right rotation on the matrix bits in S according to array length n. M1097 determines the left or
right rotation of matrix bits.
2. The empty bits derived from every rotation of 1 bit (when left rotation: b0; when right rotation: b16n-1) is filled by rotation bits
(when left rotation: b16n-1; when right rotation: b0). The result is stored in D. Rotation bits not only fill the empty bits but also
send the status of bits to carry flags.
Explanations:
This instruction counts the number of bits which are “1” or “0” on S by array length n. The result is stored in D.
Explanations:
When DPPMR instruction is executed, S1 and S2 perform 2-axis point-to-point “rectilinear” motion from output device D in frequency S. S1 = number of output pluses
on X axis; S2 = number of output pulses on Y axis (indicated by relative coordinate position; +/- refers to forward/backward direction). This instruction is only applicable
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 66 of 88
Explanations:
When DPPMA instruction is executed, S1 and S2 perform 2-axis point-to-point “rectilinear” motion from output device D in frequency S. S1 = number of output pluses
on X axis; S2 = number of output pulses on Y axis (indicated by absolute coordinate position; +/- refers to forward/backward direction). This instruction is only
applicable to EH2 and SV.
Explanations:
When DCIMR instruction is executed, S1 and S2 perform 2-axis point-to-point “arc interpolation” motion from output device D in resolution n. S1 = number of output
pluses on X axis; S2 = number of output pulses on Y axis (indicated by relative coordinate position; +/- refers to forward/backward direction). This instruction is only
applicable to EH2 and SV.
Explanations:
When DCIMA instruction is executed, S1 and S2 perform 2-axis point-to-point “arc interpolation” motion from output device D in resolution n. S1 = number of output
pluses on X axis; S2 = number of output pulses on Y axis (indicated by absolute coordinate position; +/- refers to forward/backward direction). This instruction is only
applicable to EH2 and SV.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 67 of 88
Explanations:
1. When DPTPO instruction is executed, device D outputs pulse signals. S1 = output frequency; S1+2 = number of output
pulses; S2 = number of sections.
2. D only performs pulse output control. For direction control, users have to write an extra program for it.
3. This instruction does not support speed acceleration/deceleration. When this instruction is disabled, pulse output stops
immediately.
4. When this instruction is executed, modifications on the number or frequency of sections are not allowed.
5. This instruction is only applicable to EH2 and SV.
Explanations:
1. When S = 1, high speed timer is enabled and M1015 = On. High speed timer starts to time and records the present value
in D1015 (min. unit: 100us).
2. Timing range of D1015: K0 ~ K32,767. When the timing reaches K32,767, the next timing restarts from 0.
3. When S = 0, high speed timer is disabled and M1015 = Off. D1015 stops timing immediately.
4. When S is neither 1 nor 0, HSTMR instruction will not be executed.
Explanations:
1. When S1 designates input points X and the pulse output reaches the target number of feedbacks in S2, the output will
continue to operate by the frequency of the last shift (end frequency) until interrupts occur on input points X.
2. When S1 designates high speed counters and the pulse output reaches the target number of feedbacks in S2, the output
will continue to operate by the frequency of the last shift (end frequency) until the feedback pulses reaches the target
number.
3. S1 can be a high speed counter C or an input point X with external interrupt. If S1 is C, DCNT instruction should be
executed in advance to enable the high-speed counting function, and EI instruction with I0x0 should be enabled for
external interrupts. If S1 is X, EI instruction with I0x0 should be enabled for external interrupts.
4. Range of S2: -2,147,483,648 ~ +2,147,483,647 (+ / - indicates the positive / negative rotation direction). the present value
of pulse output in CH0 (Y0, Y1) and CH1 (Y2, Y3) increases in positive direction and decreases in negative direction.
Registers storing present value of pulse output: CH0(D1031 High, 1030 Low), CH1(D1337 High, D1336 Low)
5. If S3 is lower than 6Hz, the output will operate at 6Hz; if S3 is higher than 100kHz, the output will operate at 100kHz.
6. D can only designate Y0 (Direction signal output: Y1) or Y2 (Direction signal output: Y3). The direction signal output will be
OFF only when the drive contact of the instruction is OFF, i.e. completion of pulse output will not reset Y1 or Y3.
7. DCLLM instruction supports Alignment Mark and Mask function. Please refer to Points to note for details.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 68 of 88
Explanations:
1. Max frequency for S1: 100kHz. Target frequency can be modified during the execution of instruction. When S1 is
modified, VSPO will ramp up/down to the target frequency according to the ramp-up gap time and gap frequency set in
S3.
2. S2 target number of pulses is valid only when the instruction is executed first time. S2 can NOT be modified during the
execution of instruction. S2 can be a negative value, however, if the output direction is not specified in D1220/D1221,
PLC will take this value as a positive value.
3. S3 occupies 2 consecutive 16-bit devices. S3+0 stores the gap frequency S3+1 stores the gap time. Parameter setting
can be modified during the execution of instruction. Set range for S3+0: 6Hz ~ 32767Hz; set range for S3+0: 5ms ~ 80ms.
If set value exceeds the available range, PLC will take the upper or lower bound value.
4. D pulse output device supports only Y0 and Y2. If Y1 and Y3 is required for output direction control, D1220 or D1221 has
tobe set as K1(Pulse/Dir).
5. Parameters set in S3 can only be modified while modifying the value in S1. When target frequency is set as 0, PLC will
ramp down to stop according to parameters set in S3. When the output is stopped, PLC will enable the flags indicating
pause status (Y0: M1538, Y2: M1540). If target frequency other than 0 is specified again, pulse output will ramp up to
target frequency and operates untill target number of pulses are completed.
Explanations:
1. Max frequency for S1: 100kHz. When ICF instruction executes, frequecy changing will start immediately with ramp-
up/down process.
2. ICF instruction has to be executed after the execution of DVSPO or DPLSY instructions. When the instruction is used
together with DVSPO, operands S1, S2, D of DICF has to be assigned the same device with S1, S3, D of DVSPO. When
the instruction is used with DPLSY, operands S1 and D has to be assigned the same device with S1 and D of DPLSY.
3. If ICF instruction is used with DPLSY instruction, operand S2 is invalid.
4. When ICF instruction is used with DVSPO instruction, parameter setting of S2 functions the same as S3 in DVSPO
instruction, specifying the gap time and gap frequency of ramp-up/down process.
5. D pulse output device supports only Y0 and Y2.
6. The instruction is suggested to be applied in interrupt subroutines for obtaining the better response time and eexecution
results.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 69 of 88
D D WORD
Explanations:
S1 : Source of value
S2 : Parameter
D : Destination device
Explanations:
1. The operational relation between source value and destination value is as stated below:
y=kx+b
y= Destination value (D)
k= Slope = (Max. destination value – Min. destination value) ÷ (Max. source value – Min. source value)
x= Source value (S1)
b= Offset = Min. destination value – Min. source value × slope
2. If S1 > Max. source value, S1 = Max. source value
If S1 < Min. source value, S1 = Min. source value
When all the input values and parameters are set, the output curve is shown as the figure:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 70 of 88
S1 : Source device 1
S2 : Source device 2
Explanations:
1. S1 and S2 can be T/C/D devices, for C devices only 16-bit devices are applicable (C0~C199).
2. Range for operand n: 1~16. PLC will take the upper/lower bound value if set value exceeds the available range.
3. Data written in operand D will all be stored in 16-bit format. When data length is less than 16, the null bits are fixed as 0,
e.g. if n = K8, bit 0~7 will be set according to compare results, and bit 8~15 will all be 0.
S2 : Function code
Explanations:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 71 of 88
S1 D WORD
D D WORD
Explanations:
1. When S specifies X0, PLC only uses X0 input point and its associated high speed pulse output: Y0, in this case Y1
is normal output point. When S specifies X1, PLC uses X0 (A phase) and X1 (B phase) input points and their
associated output: Y0 (Pulse) / Y1 (Dir). When S specifies X2, PLC only uses X2 input point and its associated high
speed pulse output: Y2, in this case Y3 is normal output point. When S specifies X3, PLC uses X2 (A phase) and X3
(B phase) input points and their associated output: Y2 (Pulse) / Y3 (Dir).
2. The execution of CSFO requires hardware high speed counter function as well as the high speed output function.
Therefore, when program scan proceeds to CSFO instruction with high speed counter input points (X0, X1) or (X2,
X3) enabled by DCNT instruction, or high speed pulse outputs (Y0, Y1) or (Y2, Y3) enabled by other high speed
output instructions, CSFO instruction will not be activated.
3. If S specifies X1 / X3 with 2-phase 2 inputs, the counting mode is fixed as quadruple frequency.
4. During pulse output process of Y0 or Y2, special registers (D1031, D1330 / D1337, D1336) storing the current
number of output pulses will be updated when program scan proceeds to this instruction.
5. S1 occupies consecutive 4 16-bit registers. S1 +0 specifies the sampling times, i.e. when S1 +0 specifies K1, PLC
catches the speed every time when 1 pulse is outputted. Valid range for S1 +0 in 1-phase 1-input mode: K1~K100,
and 2-phase 2-input mode: K2~K100. If the specified value exceeds the valid range, PLC will take the lower/upper
bound value as the set value. Sample time can be changed during PLC operation, however the modified value will
take effect until program scan proceeds to this instruction. S1+1 indicates the latest speed sampled by PLC (Read-
only). Unit: 1Hz. Valid range: ±10kHz. S1+2 and S1+3 indicate the accumulated number of pulses in 32-bit data
(Read-only).
6. S1 +0 specifies the sampling times. The set value of sampling times is recommended to be bigger when the input
speed increases, so as to achieve a higher accuracy for speed catching. For example, set S1 +0 as K1 for the speed
range 1Hz~1KHz, K10 for the speed range 10Hz~10KHz, K100 for the speed range 100Hz~10KHz. For single
phase input, the max frequency is 10kHz; for 2-phase 2 inputs, the max frequency is 2kHz.
7. D occupies 3 consecutive 16-bit registers. D +0 specifies the output proportion value. Valid range: K1 (1%) ~
K10000 (10000%). If the specified value exceeds the valid range, PLC will take the lower/upper bound value as the
set value. Output proportion can be changed during PLC operation, however the modified value will take effect until
program scan proceeds to this instruction. D+2 and D+1 indicates the output speed in 32-bit data. Unit: 1Hz. Valid
range: ±100kHz.
8. The speed sampled by PLC will be multiplied with the output proportion D+0, then PLC will generate the actual
output speed. PLC will take the integer of the calculated value, i.e. if the calculated result is smaller than 1Hz, PLC
will output with 0Hz. For example, input speed: 10Hz, output proportion: K5 (5%), then the calculation result will be
10 x 0.05 = 0.5Hz. Pulse output will be 0Hz; if output proportion is modified as K15 (15%), then the calculation result
will be 10 x 0.15 = 1.5Hz. Pulse output will be 1Hz.
API 215-217 LD# Logic Contact Operation
Explanations:
1. This instruction compares the content in S1 and S2. If the result is not “0”, the continuity of the instruction is enabled. If the
result is “0”, the continuity of the instruction is disabled.
2. LD# instruction is used for direct connection with BUS.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 72 of 88
Explanations:
1. This instruction compares the content in S1 and S2. If the result is not “0”, the continuity of the instruction is enabled. If the
result is “0”, the continuity of the instruction is disabled.
2. AND# is an operation instruction used on serial contacts.
Explanations:
1. This instruction compares the content in S1 and S2. If the result is not “0”, the continuity of the instruction is enabled. If the
result is “0”, the continuity of the instruction is disabled.
2. OR# is an operation instruction used on parallel contacts.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 73 of 88
Explanations:
1. This instruction compares the content in S1 and S2. Take API224 (LD=) for example, if the result is “=”, the continuity of the
instruction is enabled. If the result is “≠”, the continuity of the instruction is disabled.
2. LD※ instruction is used for direct connection with BUS.
3. The comparison is conducted algebraically. All data are compared in floating point binary values. Therefore, in 16-bit
mode, when b15 = 1, the value is negative. In 32-bit mode, when b31 = 1, the value is negative.
4. When 32-bit counters (C200 ~ C254) are used in this instruction for comparison, make sure to adopt 32-bit instruction
(DLD※)
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 74 of 88
Explanations:
1. This instruction compares the content in S1 and S2. Take API232 (AND=) for example, if the result is “=”, the continuity of
the instruction is enabled. If the result is “≠”, the continuity of the instruction is disabled.
2. AND※ is a comparison instruction is used on serial contacts.
Explanations:
1. This instruction compares the content in S1 and S2. Take API240 (OR=) for example, if the result is “=”, the continuity of
the instruction is enabled. If the result is “≠”, the continuity of the instruction is disabled.
2. OR※ is an comparison instruction used on parallel contacts.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 75 of 88
Explanations:
Explanations:
Explanations:
n : Reference bit
Explanations:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 76 of 88
n : Reference bit
Explanations:
n : Reference bit
Explanations:
n : Reference bit
Explanations:
n : Reference bit
Explanations:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 77 of 88
n : Reference bit
Explanations:
S1 : Source device 1
S2 : Source device 2
Explanations:
1. This instruction compares the content in S1 and S2. Take API275 (FLD=) for example, if the result is “=”, the
continuity of the instruction is enabled. If the result is “≠”, the continuity of the instruction is disabled.
2. The user can enter floating point values directly in S1 and S2, e.g. F1.2, or store the floating point value in registers
for further operation.
3. FLD※ (※: =, >, <, <>, ≤, ≥) instruction is used for direct connection with left hand bus bar.
S1 : Source device 1
S2 : Source device 2
Explanations:
1. This instruction compares the content in S1 and S2. Take API281 (FAND =) for example, if the result is “=”, the
continuity of the instruction is enabled. If the result is “≠”, the continuity of the instruction is disabled.
2. The user can enter floating point values directly in S1 and S2, e.g. F1.2, or store the floating point value in registers
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 78 of 88
S1 : Source device 1
S2 : Source device 2
Explanations:
1. This instruction compares the content in S1 and S2. Take API287 (FOR =) for example, if the result is “=”, the
continuity of the instruction is enabled. If the result is “≠”, the continuity of the instruction is disabled
2. The user can enter floating point values directly in S1 and S2, e.g. F1.2, or store the floating point value in registers
for further operation
3. FOR※ (※: =, >, <, <>, ≤, ≥) instruction is used for parallel connection with contacts.
S2 : Function of a DMV
Explanation:
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 79 of 88
Description of S1+0:
Communication port S1+0 Numbers must be used
K1~K5
COM on a PLC S1+0 ~ S1+1
K1~K5 represent PLC COM1~PLC COM5.
4 S2 is used to set a communication function code. The devices that these operand occupies and the functions of the devices are described below.
Number Description Remark
Communication combination Please refer to the description of the function codes below.
S2+0
function code
S2+1 Communication address It is only applicable to K0, and is not applicable to other codes.
0: Reading
S2+2 Reading/Writing Other values: Writing
It is only applicable to K0, and is not applicable to other codes.
It is used to set the length of the data read/written. A word is a unit of measurement for length.
S2+3 Communication data length
The maximum number of words which can be read/written is 16.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 80 of 88
S1 : Source device 1
S2 : Source device 2
S3 : Compared value
Explanation:
1. S2 is subtracted from S1. The aboslute value of the difference gotten is compared with the absolute value of S3.
Take API 296 (LDZ>) for example. If the comparison result is that the aboslute value of the difference gotten is
larger than the absolute value of S3, the condition of the instruction is met. If the comparison result is that the
aboslute value of the difference gotten is less than the absolute value of S3, the condition of the instruction is not
met.
2. LDZ※ can be connected to a mother line directly.
API No. 16-bit instruction 32-bit instruction Continuity condition No-continuity condition
296 LDZ> DLDZ> |S1- S2| > |S3| |S1- S2| ≦ |S3|
297 LDZ>= DLDZ>= |S1- S2| ≧|S3| |S1- S2| < |S3|
298 LDZ< DLDZ< |S1- S2| < |S3| |S1- S2| ≧ |S3|
299 LDZ<= DLDZ<= |S1- S2| ≦|S3| |S1- S2| > |S3|
300 LDZ= DLDZ= |S1- S2| = |S3| |S1- S2| ≠ |S3|
301 LDZ<> DLDZ<> |S1- S2| ≠ |S3| |S1- S2| = |S3|
3. When 32-bit counters (C200 ~ C255) are used in this instruction for comparison, make sure to adopt 32-bit
instructions (DLDZ※). If 16-bit instructions (LDZ※) are adopted, a “program error” will occur and the ERROR
indicator on the MPU panel will flash.
S1 : Source device 1
S2 : Source device 2
S3 : Compared value
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 81 of 88
Explanation:
1. S2 is subtracted from S1. The aboslute value of the difference gotten is compared with the absolute value of S3.
Take API 302 (ANDZ>) for example. If the comparison result is that the aboslute value of the difference gotten is
larger than the absolute value of S3, the condition of the instruction is met. If the comparison result is that the
aboslute value of the difference gotten is less than the absolute value of S3, the condition of the instruction is not
met.
2. ANDZ※ can be connected to a contact.
API No. 16-bit instruction 32-bit instruction Continuity condition No-continuity condition
302 ANDZ> DANDZ> |S1- S2| > |S3| |S1- S2| ≦ |S3|
303 ANDZ>= DANDZ>= |S1- S2| ≧|S3| |S1- S2| < |S3|
304 ANDZ< DANDZ< |S1- S2| < |S3| |S1- S2| ≧ |S3|
305 ANDZ<= DANDZ<= |S1- S2| ≦|S3| |S1- S2| > |S3|
306 ANDZ= DANDZ= |S1- S2| = |S3| |S1- S2| ≠ |S3|
307 ANDZ<> DANDZ<> |S1- S2| ≠ |S3| |S1- S2| = |S3|
3. When 32-bit counters (C200 ~ C255) are used in this instruction for comparison, make sure to adopt 32-bit
instructions (DANDZ※). If 16-bit instructions (ANDZ※) are adopted, a “program error” will occur and the ERROR
indicator on the MPU panel will flash.
S1 : Source device 1
S2 : Source device 2
S3 : Compared value
Explanation:
1. S2 is subtracted from S1. The aboslute value of the difference gotten is compared with the absolute value of S3.
Take API 308 (ORZ>) for example. If the comparison result is that the aboslute value of the difference gotten is
larger than the absolute value of S3, the condition of the instruction is met. If the comparison result is that the
aboslute value of the difference gotten is less than the absolute value of S3, the condition of the instruction is not
met.
2. ORZ※ can be connected to a contact.
API No. 16-bit instruction 32-bit instruction Continuity condition No-continuity condition
308 ORZ> DORZ> |S1- S2| > |S3| |S1- S2| ≦ |S3|
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 82 of 88
309 ORZ>= DORZ>= |S1- S2| ≧|S3| |S1- S2| < |S3|
310 ORZ< DORZ< |S1- S2| < |S3| |S1- S2| ≧ |S3|
311 ORZ<= DORZ<= |S1- S2| ≦|S3| |S1- S2| > |S3|
312 ORZ= DORZ= |S1- S2| = |S3| |S1- S2| ≠ |S3|
313 ORZ<> DORZ<> |S1- S2| ≠ |S3| |S1- S2| = |S3|
3. When 32-bit counters (C200 ~ C255) are used in this instruction for comparison, make sure to adopt 32-bit
instructions (DORZ※). If 16-bit instructions (ORZ※) are adopted, a “program error” will occur and the ERROR
indicator on the MPU panel will flash.
Operands:
S1: Local communication port, target IP address, communication port and UDP/TCP mode S2: Parameters S3: Data source S4: Data length D1: Receive data
address D2: Receiving completion flag
Explanations:
1. This instruction is currently available for DVP-SE series PLC with firmware V1.83 or later.
2. S1 is for setups of local communication port, target IP address, communication port and UDP/TCP mode. This operand occupies 5
consecutive devices.
IP address settings: this occupies 2 consecutive devices, S1+1 and S1+2 respectively
D100 (S1+0) D101 (S1+1) D102 (S1+2) D103 (S1+3) D104 (S1+4)
Local port High Low High Low Target port UDP/TCP
(IP0)
(IP1) (IP3) (IP2)
0~65535 0 2 192 168 0~65535 0, 1
H’0002 H’C0A8 0=UDP, 1=TCP
3. S2 is where you can set up parameters. Client mode 0 and 1 are exchangeable and the connections are active. Server mode 2 and 3 are
exchangeable and the connections are active. But it is required to disconnect the connection when switching between different modes.
Value Description
in S2
S2 receiving mode of
Remark
S2+1
0 After the sending is 1. Unused 2. Client Mode
complete, no receiving
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 83 of 88
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 84 of 88
Start
Mode
Specific IP Illegal
0,1 0 0
address
Master mode,
Specific IP
0,1 0 Not equal to 0 Specifies the IP
address; but not
address
specify the local
communication port.
Specific IP
0,1 Not equal to 0 0 Illegal
address
Master mode,
4. The operand S and S specify source data registers and data length. For example:S specifies D150 and the value in S is 10. The
3 4 3 4
instruction ETHRS will send 10 bytes of data, starting from the low byte in D150, D151, D152 and so on. Users can use the instruction
DTM to transform 16-bit data into 8-bit data when the transformation is required. The setting range for S4 is 1~200 words. If the
setting values exceed the setting range, the system will use the minimum (1) or the maximum (200) to operate.
5. The operand D1 specifies a destination data register. For example, D specifies D10 and D10 is the received data length; the unit is byte.
The data received will be stored starting from D11, low byte in D11, D12, D13 and so on. The maximum receiving data length is 200 words;
data length exceeds this limit will not be stored in D. Users can use the instruction DTM to transform 16-bit data into 8-bit data when the
transformation is required.
6. D2 specifies the reception completion flag and only M device can be used. When the instruction is executed, and the transmission of
packets is complete, this flag will be set to ON. Users can learn from this flag to see if the transmission is complete or not. Once it is set to
ON, users need to set it to OFF. When there is any error occurred during the instruction execution or any timeout occurred, the flag will not
be ON.
7. Once the instruction is executed, the communication begins. There is no need to use any special flag to trigger the sending. When the
instruction is executed, there will be a special M shown to indicate the execution.
8. There is no limitation on the times of using this instruction in the program. However, only one instruction can be executed at a time.
9. When the instruction is forcedly stopped, the communication will also be stopped. And the completion flag D2 will not be ON.
10. When this instruction is executed, do not use the Online Mode; otherwise errors may occur when receiving and storing data.
11. This instruction is available for the following models and firmware versions.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 85 of 88
SX2
Firmware
V1.08 V3.00 V1.88 V2.0 V3.0
version
12. Relative special flags and registers for the instruction ETHRS:
13. If M1198 is ON, it means communication errors occur and an error code will be stored in D1176. For other error codes, please refer to
the following table.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 86 of 88
Communication
UDP/TCP Description
Port
TCP 502 Modbus TCP communication
TCP 44818 EtherNet/IP explicit message
UDP 67
DHCP communication
UDP 68
UDP 2222 EtherNet/IP implicit message
UDP 44818 EtherNet/IP explicit message
UDP 20006
For internal parameter download
UDP 20008
TCP MODE:
l M1197 = ON, this indicates the communication is active. Make sure the TCP connection is ready or is waiting to be connected and checking its relative
communication settings are set, the data length is less than 200 characters and if the slave is responding.
l After data is sent or received, M1197 stays ON and a completion flag will be set to ON. (You can reset this flag to OFF.)
l If the ETHRS instruction is executed again, the completion flag will be reset to OFF.
l M1197 = ON, this indicates the communication is active. Make sure the TCP connection is ready or is waiting to be connected.
l When an error occurs, M1198 is ON and the error codes will be shown in D1176.
l Execute ETHRS instruction again, after the problem is fixed, and M1198 is reset to OFF.
l If receiving time out is enabled in Master mode, it starts counting after the sending is done.
l If receiving time out is enabled in Slave mode, it starts counting after the connection is established.
M1196=OFF: Use ETHRS instruction to control the connection; when it is executed, the connection is established.
l M1197 = ON, this indicates the communication is active. Make sure the TCP connection is ready or is waiting to be connected and checking its relative
communication settings are set, the data length is less than 200 characters and if the slave is responding.
l After data is sent or received, M1197 stays ON and a completion flag will be set to ON. (You can reset this flag to OFF.)
l When the connection time is exceeding the setting value in Keep Alive Timeout (default: 30ms), the connection will be switched off. M1197 is set to OFF.
l If the ETHRS instruction is executed again, the completion flag will be reset to OFF.
l M1197 = ON, this indicates the communication is active. Make sure the TCP connection is ready or is waiting to be connected.
l When an error occurs, M1198 is ON and the error codes will be shown in D1176.
l Execute ETHRS instruction again, after the problem is fixed, and M1198 is reset to OFF.
l If receiving time out is enabled in Master mode, it starts counting after the sending is done.
l If receiving time out is enabled in Slave mode, it starts counting after the connection is established.
UDP MODE:
(Note: if M1196 is switched from ON to OFF during communication, the connection will be switched off. M1197 is reset to OFF and the completion flag will be set
to ON.
l M1197 = ON, this indicates the communication is active. Make sure the TCP connection is ready or is waiting to be connected and checking its relative
communication settings are set, and the data length is less than 200 characters.
l After data is sent or received, M1197 stays ON and a completion flag will be set to ON. (You can reset this flag to OFF.)
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 87 of 88
l If the ETHRS instruction is executed again, the completion flag will be reset to OFF.
l M1197 = ON, this indicates the communication is active. Make sure the UDP connection is ready or is waiting to be connected.
l When an error occurs, M1198 is ON and the error codes will be shown in D1176.
l Execute ETHRS instruction again, after the problem is fixed, and M1198 is reset to OFF.
l If receiving time out is enabled in Master mode, it starts counting after the sending is done.
l If receiving time out is enabled in Slave mode, it starts counting after the connection is established.
Program Example: (The command is sent and received through the Ethernet port built in DVP-SE.)
This example uses DVP-SE series as the client, M0 to activate and UDP connection mode to send and receive data. The value in S2 is K1. When the data is received,
M100 is set to ON. The relative parameters are stated below.
1. When M0 is ON, the transmission starts and M1197 is ON. If M1198 is ON, it means communication errors occur and an error code will
be stored in D1176.
2. When the data is received correctly and a response is received from the remote device, M100 will be ON. The data length and the
contents will be stored in D200.
Program Example 2: (The command is sent and received through the Ethernet port built in DVP-SE.)
This example uses DVP-SE series as the client, M2 to activate and TCP connection mode to send and receive data. The value in S2 is K2. The relative parameters
are stated below.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024
Page 88 of 88
1. Set M1196 to ON. When using the TCP connection mode, it is suggested to set M1196 to ON to avoid disconnecting if a
communication timeout occurs.
2. When M2 is ON, DVP-SE is waiting for the TCP connection to be established. When M100 is ON, it means the receiving is complete
successfully and the data length and contents are stored in D200 and data in D100 has been sent, the data length is 100 bytes.
3. If M1198 is ON, it means communication errors occur and an error code will be stored in D1176.
file:///C:/Users/CP/AppData/Local/Temp/~hh248C.htm 13/05/2024