05 Data processing

Last modified by Wecon on 2025/09/03 21:03

BCC/BIN16 and BIN8 bit data addition, subtraction and exclusive check

BCC (P)

Specify the calculation method of BCC in (S1), specify the destination start address in (S2), and specify the destination data length in (S3), and then store the operation result in the device specified in (D).

- [BCC (S1) (S2) (S3) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)16-bit constant or the calculation method of 16-bit regions (block check code)0 to 2BIN16 bitANY16_S
(S2)Calculate the initial 16-bit regions of BCC-BIN16 bitANY16_S
(S3)16-bit constant or 16-bit regions (specify the number of bytes calculated by BCC)0 to 32767BIN16 bitANY16_S
(D)Stores 16-bit regions of BCC results-BIN16 bitANY16_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
BCC(S1)
(S2)      
(S3)
(D)   

Features

According to the calculation method specified by S1, starting from the 16-bit data specified by S2, calculate the ASCII block check code (BCC) of the number of bytes specified by S3, and then store the result of BCC code in the low byte of 16-bit data specified by D.

S1: Specify the calculation method of BCC.

K0: Addition operation

K1: Subtraction operation

K2: Exclusive or operation

S2 and s3: Specify the destination data

For example, if the destination is the 12 bytes data starting from D0, the settings are as below.

S2: D0

S3: K12 (specify the data by decimal)

The modes used in the calculation of this instruction are 16-bit conversion mode and 8-bit conversion mode. For the actions of each mode, refer to the followings.

(1) 16-bit conversion mode (When SM161 is OFF)

Calculate the high 8-bit (byte) and low 8-bit (byte) of device that started from (S2) and specify the byte length by (S3), and store the low 8-bit of device specified by (D). The conversion result is as below.

07-2 Basic instructions_html_8cb7ada16163d6a7.png

(2) 8-bit conversion mode (When SM161 is ON)

Calculate the low 8-bit (byte) of device that started from (S2) and specify the byte length by (S3), and store the low 8-bit of device specified by (D). The conversion result is as below.

07-2 Basic instructions_html_310b05f64338abad.png

Error code

Error codeContent
4084HThe read application instructions (S1) and (S3) input the data that exceeds the specified range
4085HThe device specified in the read application instructions (S1), (S2) and (S3) exceeds the corresponding device range
4086HThe device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_26b1cac4afae1305.png

When the trigger M0 is ON, calculate the a block check code (BCC) of 12-bit bytes of ASCII data starting from data register D0 by “exclusive or operation”. The block check code (BCC) is stored in the low bit byte of data register D6.

Application example

In the example ,calculate the BCC code and send as information after adding to the string “%01→RC”.

The data transmission is carried out in the form of ASCII codes.

CC calculations use logical exclusive OR, addition, and subtraction.

The information is stored as follows:

Data registerD6D2D1D0
ASCII hexadecimal code 4 3 5 22 3 3 13 0 2 5
ASCII code C R# 10 %

D6: BCC check code

D2 to D0: 6 byte

BCC instruction is as below:

07-2 Basic instructions_html_495775c10e5895c7.png

S1(K2): logic exclusive OR

S2(D0): The start of destination data

S3(K6): destination data lengt

D(D6): calculation result

Execution or operation

abOR result
000
011
101
110

After the execution BCC code is stored in the last byte of D6.

How to calculate block check code (BCC)

Calculate block check code (BCD) with XOR for each ASCII code.

07-2 Basic instructions_html_632af1db3189c584.gif

BCC code

ASCII hexadecimal code1 6
ASCII binary code0 0 0 10 1 1 0

The calculation result is stored in the low bit byte of D6

MAX/BIN16 bit the maximum value of 16-bit data

MAX (P)

Specify the destination start address in (S1), and specify the destination end address in (S2), and then store the operation result in the device specified in (D).

- [MAX (S1) (S2) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Device that stores the start address when getting the max data-32768 to 32767Signed BIN16ANY16_S
(S2)Device that stores the end address when getting the max data-32768 to 32767Signed BIN16ANY16_S
(D)Stores the max value between the device data of (S1) and (S2)-32768 to 32767Signed BIN16ANY16_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

TCDRSD[D]XXP
MAX(S1)
(S2)
(D)

Note

1. The devices specified by (S1) and (S2) should be the same type. The type of device (D) that gets the results could be different.

2. The device size specified by (S1) can’t exceed the device size specified by (S2). For example, MAX D1 D5 D10 works, but MAX D5 D1 D10 doesn't.

Error code

Features

Use the BIN16 bit data specified in (S1) as the start address, and use the BIN16 bit data specified in (S2) as the end address to get the maximum value between the device of (S1) and (S2).

Error codeContent
4084HThe read application instructions (S1) and (S2) input the data that exceeds the specified range
4085HThe device specified in the read application instructions (S1) and (S2) exceeds the device range
4086HThe device specified in the write application instruction (D) exceeds the device range
4093HThe specified ranges (S1) and (S2) are not the same device
4094HThe sequence of specified ranges (S1) and (S2) is abnormal

Example

07-2 Basic instructions_html_a388b58f840bcae9.png

Use (D1) as the start address, and use (D5) as the end address to get the max value between them and store the result in (D6). As the figure above, the max value between (D1) and (D5) is the value in (D3) which is stored in (D6) for output.

DMAX/BIN32 bit the maximum value of 32-bit data

DMAX (P)

Specify the destination start address in (S1), and specify the destination end address in (S2), and then store the operation result in the device specified in (D).

- [DMAX (S1) (S2) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Device that stores the start address when getting the max data-2147483648 to 2147483647Signed BIN32ANY32_S
(S2)Device that stores the end address when getting the max data-2147483648 to 2147483647Signed BIN32ANY32_S
(D)Stores the max value between the device data of (S1) and (S2)-2147483648 to 2147483647Signed BIN32ANY32_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

TCDRSDLCHSC[D]XXP
DMAX(S1)
(S2)
(D)

Features

Use the BIN32 bit data specified in (S1) as the start address, and use the BIN32 bit data specified in (S2) as the end address to get the maximum value between the device of (S1) and (S2).

Note

1. The devices specified by (S1) and (S2) should be the same type. The type of device (D) that gets the results could be different.

2. The device size specified by (S1) can’t exceed the device size specified by (S2). For example, DMAX D1 D5 D10 works, but DMAX D5 D1 D10 doesn't.

Error code

Error codeContent
4084HThe read application instructions (S1) and (S2) input the data that exceeds the speicified range
4085HThe device specified in the read application instructions (s1) and (S2) exceeds the device range
4086HThe device specified in the write application instruction (D) exceeds the device range
4093HThe specified ranges (S1) and (S2) are not the same device
4094HThe sequence of specified ranges (S1) and (S2) is abnormal

Example

Use (D1) as the start address, and use (D7) as the end address to get the max value between them and store the result in (D9). As the figure above, the max value between (D1) and (D7) is the value in (D7) which is stores in (D9) for output.

07-2 Basic instructions_html_48178d8f933d20cb.png

MIN/BIN16 bit the minimum value of 16-bit data

MIN (P)

Specify the destination start address in (S1), and specify the destination end address in (S2), and then store the operation result in the device specified in (D).

- [MIN (S1) (S2) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Device that stores the start address when getting the minimum data-32768 to 32767Signed BIN16ANY16_S
(S2)Device that stores the end address when getting the minimum data-32768 to 32767Signed BIN16ANY16_S
(D)Stores the minimum value between the device data of (S1) and (S2)-32768 to 32767Signed BIN16ANY16_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

TCDRSD[D]XXP
MIN(S1)
(S2)
(D)

Features

Use the BIN16 bit data specified in (S1) as the start address, and use the BIN16 bit data specified in (S2) as the end address to get the maximum value between the device of (S1) and (S2).

Note

1. The devices specified by (S1) and (S2) should be the same type. The type of device (D) that gets the results could be different.

2. The device size specified by (S1) can’t exceed the device size specified by (S2). For example, MAX D1 D5 D10 works, but MAX D5 D1 D10 doesn't.

Error code

Error codeContent
4084HThe read application instructions (S1) and (S2) input the data that exceeds the specified range
4085HThe device specified in the read application instructions (S1) and (S2) exceeds the device range
4086HThe device specified in the write application instruction (D) exceeds the device range
4093HThe specified ranges (S1) and (S2) are not the same device
4094HThe sequence of specified ranges (S1) and (S2) is abnormal

Example

Use (D1) as the start address, and use (D5) as the end address to get the max value between them and store the result in (D6). As the figure above, the max value between (D1) and (D5) is the value in (D3) which is stored in (D6) for output.

07-2 Basic instructions_html_a388b58f840bcae9.png

DMIN/BIN32 bit the minimum value of 32-bit data

DMIN (P)

Specify the destination start address in (S1), and specify the destination end address in (S2), and then store the operation result in the device specified in (D).

- [DMIN (S1) (S2) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Device that stores the start address when getting the minimum data-2147483648 to 2147483647Signed BIN16ANY16_S
(S2)Device that stores the end address when getting the minimum data-2147483648 to 2147483647Signed BIN16ANY16_S
(D)Stores the minimum value between the device data of (S1) and (S2)-2147483648 to 2147483647Signed BIN16ANY16_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

TCDRSD[D]XXP
DMIN(S1)
(S2)
(D)

Features

Use the BIN32 bit data specified in (S1) as the start address, and use the BIN32 bit data specified in (S2) as the end address to get the maximum value between the device of (S1) and (S2).

Note

1. The devices specified by (S1) and (S2) should be the same type. The type of device (D) that gets the results could be different.

2. The device size specified by (S1) can’t exceed the device size specified by (S2). For example, MAX D1 D5 D10 works, but MAX D5 D1 D10 doesn't.

Error code

Error codeContent
4084HThe read application instructions (S1) and (S2) input the data that exceeds the specified range
4085HThe device specified in the read application instructions (S1) and (S2) exceeds the device range
4086HThe device specified in the write application instruction (D) exceeds the device range
4093HThe specified ranges (S1) and (S2) are not the same device
4094HThe sequence of specified ranges (S1) and (S2) is abnormal

Example

Use (D1) as the start address, and use (D5) as the end address to get the max value between them and store the result in (D6). As the figure above, the max value between (D1) and (D5) is the value in (D3) which is stored in (D6) for output.

07-2 Basic instructions_html_a388b58f840bcae9.png

ANS/alarm settings

ANS(P)

Used to set alarm instructions.

-[ANS (S) (N) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)Timer number for judging time-Signed BIN 16 bitANY16
(N)Data that judges time1 to 32767Signed BIN 16 bitANY16
(D)The set alarm device-BitANY16_BOOL

Device used

InstructionParameterDevices

Offset modification

Pulse extension

SKnXKnYKnMKnSTCDRSDKH[D]XXP
ANSParameter 1           
Parameter 2 
Parameter 3           

Features

When the instruction input continues to be ON for the judgment time [(N)×100ms, timer (S)], set (D). If the instruction time turns off below the judgment time [(N)×100ms], the current value of the judgment timer (S) is reset, and (D) is not set. In addition, if the instruction input turns off, the judgment timer will be reset.

07-2 Basic instructions_html_cc92e9a1f43558bd.png

07-2 Basic instructions_html_e332fbc503049d2f.png

1. Judge the time ((N)X 100ms or less)

2. Judgment time or more (inclusive) ((N) X 100ms or more (inclusive))

Related device

DevicesNameContent
SM249Signal alarm is validAfter SM249 is ON, the following SM248 and SD249 act.
SM248Signal alarm actionSM249 is ON, when any one of the states S900 to S999 is active, SM248 is ON
SD249Signal alarm ON state minimum numberSave the smallest number of actions in S900 to S999.

Error code

Error codeContent
4084HThe value specified in (N1) and (N2) exceeds the range of 0 to 32767
The timer number is not in the range of T0 to T199.
The signal alarm is not in the range of S900 to S999.
4085HWhen the device specified in the read application instructions (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

The fault number is displayed by the signal alarm.

Monitoring is effective after SM249 is turned ON

As shown below, when you write a program for diagnosing external faults, such as monitoring the content of SM249 (the smallest number in the ON state), the smallest number in the ON state among S900 to S999 will be displayed. When multiple faults occur at the same time, the next fault number can be obtained after eliminating the fault with the smallest number.

Detect X1 for 2 seconds, turn ON, set S900

X4 is detected for 1 second, turn ON, set S901

SM248 will act after any one of S900 to S999 is ON, and the output fault display YY6 will act

Display the fault number to the D0 device

Through the external fault diagnosis program, use the reset button M0 to turn off the activated state. Each time M0 turns ON, the action status of the new number is set in turn, and the new number that is already ON is reset.

07-2 Basic instructions_html_da49122879984485.png

ANR/Alarm reset

ANR(P)

The instruction to reset the small number that is ON in the alarm.

-[ANR]

Content, range and data type

ParameterContentRangeData typeData type (label)
NoNo parameter setting---

Device used

InstructionParameterDevicesOffset modification

Pulse extension

XYMSSMT(bit)C(bit)LC(bit)HSC(bit)D.bKnXKnYKnMKnSTCDRSDLCHSCKHE[D]XXP
ANRNoNo object device

Features

If the instruction input is ON, reset the active alarm in the alarm.

If multiple alarms are operating, reset the smaller number. If the input instruction is turned ON again, the next small number in the alarm that is operating will be reset.

07-2 Basic instructions_html_878efe4b5d9b7937.png

Related device

DevicesNameContent
SM249Signal alarm is validAfter SM249 is ON, the following SM248 and SD249 act.
SM248Signal alarm actionSM249 is ON, when any one of the states S900 to S999 is active, SM248 is ON.
SD249Signal alarm ON state minimum numberSave the smallest number of actions in S900 to S999.

Note: 

If you use the ANR instruction, reset in sequence every cycle.

If the ANRP instruction is used, it will be executed in only one operation cycle.

Error code

No operation error.

Example

The fault number is displayed by the signal alarm.

As shown below, when you write a program for diagnosing external faults, such as monitoring the content of SM249 (the smallest number in the ON state), the smallest number in the ON state among S900 to S999 will be displayed. When multiple faults occur at the same time, the next fault number can be obtained after eliminating the fault with the smallest number.

Monitoring is effective after SM249 is turned ON

Detect X1 for 2 seconds, turn ON, set S900

X4 is detected for 1 second, turn ON, set S901

SM248 will act after any one of S900 to S999 is ON, and the output fault display YY6 will act

Display the fault number to the D0 device

Through the external fault diagnosis program, use the reset button M0 to turn off the activated state. Each time M0 turns ON, the action status of the new number is set in turn, and the new number that is already ON is reset.

07-2 Basic instructions_html_da49122879984485.png

BON/16-bit data bit judgment

BON(P)

Check whether the state of the BIN 16-bit data (N) bit of the device specified in (S) is ON or OFF, and output the result to the device specified in (D).

-[BON (S) (N) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)Data storage destination word device number-Signed BIN 16 bitANY16
(D)Bit device number of drive-BitANY16_BOOL
(N)The position of the bit to be judged0 to 15Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDKH[D]XXP
BONParameter 1     
Parameter 2        
Parameter 3     

Features

Check whether the state of the BIN 16-bit data (N) bit of the device specified in (S) is ON or OFF, and output the result to the device specified in (D).

If the above result is ON, then (D)=ON, if it is OFF, then (D)=OFF.

If a constant (K) is specified in the device specified in (S), it will be automatically converted to BIN.

07-2 Basic instructions_html_3b129068b54a368f.png

Error code

Error codeContent
4084HThe data input in (N) exceeds the specified range of 0 to 15.
4085HWhen the device specified in the read application instructions (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_901a83d57e680bcb.png

When n in D0 = the third bit is 1 (ON), M0 is set to 1 (ON).

07-2 Basic instructions_html_b667504fab3e5a62.png

DBON/32-bit data bit judgment

DBON(P)

Check whether the state of the BIN 32-bit data (N) bit of the device specified in (S) is ON or OFF, and output the result to the device specified in (D).

-[DBON (S) (N) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)Data storage destination word device number-Signed BIN 32 bitANY32
(D)Bit device number of drive-BitANY32_BOOL
(N)The position of the bit to be judged0 to 31Signed BIN 32 bitANY32

Device used

InstructionParameterDevices

Offset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DBONParameter 1     
Parameter 2          
Parameter 3     

Features

Check whether the BIN 32-bit data (N) bit status of the device specified in (S) is ON or OFF, and output the result to the device specified in (D).

If the above result is ON, then (D)=ON, if it is OFF, then (D)=OFF.

If a constant (K) is specified in the device specified in (S), it will be automatically converted to BIN.

07-2 Basic instructions_html_a2388083bdb6b3d7.png

Error code

Error codeContent
4084HThe data input in (N) exceeds the specified range of 0 to 31.
4085HWhen the device specified in the read application instructions (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

When n in D0 = the third bit is 1 (ON), M0 is set to 1 (ON).

07-2 Basic instructions_html_5ea1a2a6191d7209.png

07-2 Basic instructions_html_4191aeacce9b050e.png

ENCO/Encode

ENCO(P)

Encode the data of the 2th (N)th power from (S) and store it in (D).

-[ENCO (S) (N) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)Start device for storing coded data-Bit/Signed BIN 16 bitANY_ELEMENTARY
(D)Device number storing the encoding result-Signed BIN 16 bitANY_ELEMENTARY
(N)Effective bit length0 to 8Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

XYMSSMKnXKnYKnMKnSTCDRSDKH[D]XXP
ENCOParameter 1      
Parameter 2        
Parameter 3     

Features

The BIN value corresponding to the bit from 2 (N) bits of (S) to 1 is stored in (D).

07-2 Basic instructions_html_32b79f884e7c01e0.png

When (N)=0, it will be no processing, and the content of the device specified in (D) will not change.

Bit devices are treated as 1 bit, and word devices are treated as 16 bits.

When multiple digits are 1, it will be processed at the upper position.

Error code

Error codeContent
4084HIn the bit device specification of (S), when (N) is other than 0 to 8.
In the word device specification of (S), when (N) is other than 0 to 4.
When the data of 2(N) bits starting from (S) are all 0.
4085HWhen the device specified in the read application instructions (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_e70340d3db54a0d6.png

When M20 is turned ON, the D0 device is 16 after encoding.

DECO/Decode

DECO(P)

Decode the lower (N) bits of the device specified in (S), and store the result in the 2 (N)th power of the device specified in (D).

-[DECO (S) (N) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)Decoded data or the device number storing the decoded data-Bit/Signed BIN 16 bitANY_ELEMENTARY
(D)The start device storing the decoding result-Signed BIN 16 bitANY_ELEMENTARY
(N)Effective bit length0 to 8Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

XYMSSMKnXKnYKnMKnSTCDRSDKH[D]XXP
DECOParameter 1 
Parameter 2       
Parameter 3     

Features

Turn ON the position of (D) corresponding to the BIN value specified in the lower (N) bit of (S).

When (N)=0, it will be no processing, and the content of the device specified in (D) will not change.

Bit devices are treated as 1 bit, and word devices are treated as 16 bits.

07-2 Basic instructions_html_676fed9d696c6525.png

Error code

Error codeContent
4084HIn the bit device specification of (D), when (N) is other than 0 to 8.
In the word device specification of (D), when (N) is other than 0 to 4.
4085HWhen the device specified in the read application instructions (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_e0ad47112aecfe84.png

When M20 is ON, M3 will be turned ON.

SUM/The ON bits of 16-bit data

SUM(P)

Store the total number of bits at 1 in the BIN 16-bit data of the device specified in (S) to the device specified in (D).

-[SUM (S) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The device start number that counts the total number of bits at 1-Signed BIN 16 bitANY16
(D)The device start number of the total number of storage bits-Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
SUMParameter 1
Parameter 2   

Features

Store the total number of bits at 1 in the BIN 16-bit data of the device specified in (S) to the device specified in (D).

When the BIN 16-bit data of the device specified in (S) is all 0, the zero flag (SM153) turns on.

The total number of 1 (ON) is stored in BIN.

There are 8 in the example on the left.

07-2 Basic instructions_html_d0ff863c8a916f52.png

Error code

Error codeContent
4085HWhen the device specified in the read application instructions (S) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_604fe690248c20c4.png

When M0 is ON, the number of ON bits in D0 is counted and stored in D1. The value after D1 is executed is 4.

DSUM/The ON bits of 32-bit data

DSUM(P)

Store the total number of bits at 1 in the BIN 32-bit data of the device specified in (S) to the device specified in (D).

-[SUM (S) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The device start number that counts the total number of bits at 1-Signed BIN 32 bitANY32
(D)The device start number of the total number of storage bits-Signed BIN 32 bitANY32

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DSUMParameter 1
Parameter 2   

Features

Store the total number of bits at 1 in the BIN 32-bit data of the device specified in (S) to the device specified in (D).

When the BIN 32-bit data of the device specified in (S) is all 0 (OFF), the zero flag (SM153) turns on.

The total number of 1 (ON) is stored in BIN.

There are 16 in the example on the left.

07-2 Basic instructions_html_c50dbc953689f502.png

Note:  When the instruction input is OFF, the instruction will not be executed, and the output of the ON digits of the action will remain the same as before.

Error code

Error codeContent
4085HWhen the device specified in the read application instructions (S) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_f362ddb84e2d24a2.png

When M0 is ON, the number of ON bits in D0 is counted and stored in D10, and the value after D10 is executed is 4.

MEAN/Mean value of 16-bit data

MEAN(P)

The average value of the (n) point (16-bit) at the beginning of the soft component specified in (s) is calculated and the result is stored in (d).

-[MEAN (S) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The device start number storing the data for average calculation-Signed BIN 16 bitANY16
(D)The device start number storing the average value-Signed BIN 16 bitANY16
(N)Number of data or the device number storing the number of data1 to 32767Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
MEANParameter 1  
Parameter 2   
Parameter 3

Features

Calculate the average value of the 16-bit data at (N) points starting from the device specified in (S) and store it in the device specified in (D).

The total is calculated from the algebraic sum and divided by (N).

The remainder is rounded off.

07-2 Basic instructions_html_6d7059ace00e2f07.png

Error code

Error codeContent
4084HThe data input by (N) in the application instruction exceeds the specifiable range. N≤0
4085HWhen the device specified in the read application instructions (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_13566d51340cd9ac.png

Add the data of D0, D1, and D2 and save the value obtained after dividing by 3 in D10. The calculated average value is 6.

DMEAN/Mean value of 16-bit data

DMEAN(P)

The average value of the (n) point (32-bit) at the beginning of the soft component specified in (s) is calculated and the result is stored in (d).

-[DMEAN (S) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The device start number storing the data for average calculation-Signed BIN 32 bitANY32
(D)The device start number storing the average value-Signed BIN 32 bitANY32
(N)Number of data or the device number storing the number of data1 to 2147483647Signed BIN 32 bitANY32

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DMEANParameter 1  
Parameter 2   
Parameter 3

Features

Calculate the mean value of BIN 32-bit data at (N) points starting from the device specified in (S) and store it in the device specified in (D).

The total is calculated from the algebraic sum and divided by (N).

The remainder is rounded off.

07-2 Basic instructions_html_ba33fd31e81f4c99.png

Note:  When the device number exceeds, (N) is handled as a smaller value within the allowable range.

Error code

Error codeContent
4084HThe data input in (N) exceeds the specifiable range. N≤0
4085HWhen the device specified in the read application instructions (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_2c823dad156101dc.png

Add the data of D0, D2, and D4, and save the value obtained after dividing by 3 in D10 and D11, and the calculated average value is 6.

SQR/16-bit square root

SQR(P)

Calculate the square root of the BIN 16-bit data specified in (S), and store the calculation result in (D).

-[SQR (S) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The data device storing for square root calculation0 to +32767Signed BIN 16 bitANY16
(D)The device storing the calculated square root-Signed BIN 16 bitANY16

Device used

InstructionParameterDevicesOffset modification

Pulse extension

DRSDKH[D]XXP
SQRParameter 1
Parameter 2  

Features

Calculate the square root of the BIN 16-bit data specified in (S), and store the calculation result in (D).

07-2 Basic instructions_html_3ee4c015d89635f5.png

Note:  The decimal point of operation result will be rounded off and become an integer. If rounding occurs, SM152 (borrow flag) turns ON.

When the operation result is really 0, SM153 (zero flag) turns ON.

Error code

Error codeContent
4084HWhen a negative value is specified in (S).
4085HWhen the device specified in the read application instructions (S) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_92245aa43f6ffa87.png

The square root of D0 is stored in D2, and the value of D0 is 100, so the value of D2 is 10.

DSQR/32-bit square root

DSQR(P)

Calculate the square root of the BIN 32-bit data specified in (S), and store the calculation result in (D).

-[DSQR (S) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The data device storing for square root calculation0 to 2147483647Signed BIN 32 bitANY32
(D)The device storing the calculated square root-Signed BIN 32 bitANY32

Device used

InstructionParameterDevicesOffset modification

Pulse extension

DRSDLCHSCKH[D]XXP
DSQRParameter 1
Parameter 2  

Features

Calculate the square root of the BIN 32-bit data specified in (S) and store the calculation result in (D).

07-2 Basic instructions_html_51d10bf1ab821717.png

Note: The decimal point of operation result will be rounded off and become an integer. If rounding occurs, SM152 (borrow flag) turns ON.

When the operation result is really 0, SM153 (zero flag) turns on.

Error code

Error codeContent
4084HWhen a negative value is specified in (S).
4085HWhen the device specified in the read application instructions (S) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_d7c5cf75a5e766d2.png

The square root of D0 is stored in D2, and the value of D0 is 110, so the value in the D2 soft component is 10 (the fractional part is discarded), and the borrow flag SM152 is turned ON.

WSUM/The sum value of 16-bit data

WSUM(P)

After adding all the BIN 16-bit data of point (n) starting from the device specified in (S), it is stored in the device specified in (D).

-[WSUM (S) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The device start number storing the data for sum value calculation-Signed BIN 16 bitANY16
(D)The device start number storing the sum value-Signed BIN 32 bitANY32
(N)Number of data-Signed BIN 16 bitANY16

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
WSUMParameter 1      
Parameter 2   
Parameter 3

Features

After adding all the BIN 16-bit data of point (N) starting from the device specified in (S), it is stored in the device specified in (D).

07-2 Basic instructions_html_7495632d1d596fe7.png

Error code

Error codeContent
4084HWhen a negative value is specified in (N).
4085HWhen the device specified in the read application instructions (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_8e8f6bedc6333b2f.png

When M0=ON, the total of 16-bit data of D0 to D2 is saved in [D100, D101], and the accounting result is 18.

DWSUM/The sum value of 32-bit data

DWSUM(P)

Add all the 32-bit BIN data of point (N) starting from the device specified in (S) and store it in the device specified in (D).

-[DWSUM (S) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The device start number storing the data for total value calculation-Signed BIN 32 bitANY32
(D)The device start number storing the total value-Signed BIN64 bitANY64
(N)Number of data-Signed BIN 32 bitANY32

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DWSUMParameter 1      
Parameter 2   
Parameter 3

Features

Add all the 32-bit BIN data of point (n) starting from the device specified in (s) and store it in the device specified in (d).

07-2 Basic instructions_html_f752f81c0b00f696.png

Note: When the number of bits is specified in (D), the value of n ranges from 1 to 8, such as K8 (32-bit instructions, such as K8M0) without K16 (64-bit instructions).

Error code

Error codeContent
4084HWhen a negative value is specified in (N).
4085HWhen the device specified in the read application instructions (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_baf1223bd45a93dd.png

When M0=ON, the total of 16-bit data of D0 to D2 is saved in [D100, D101], and the accounting result is 18.

SORT/16-bit data sorting

SORT

Sort the data rows in ascending order based on the group data of column (N3) in the BIN 16-bit data table (sorting source) of (N1×N2) points specified in (S) and store them in the specified in (D) (N1×N2) points in the BIN 16-bit data table (after sorting).

-[SORT (S) (N1) (N2) (D) (N3)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start device number storing the data table-Signed BIN 16 bitANY16
(N1)Number of data (rows)1 to 32Signed BIN 16 bitANY16
(N2)Number of group data (columns)1 to 6Signed BIN 16 bitANY16
(D)The start device number storing the operation result-Signed BIN 16 bitANY16
(N3)The column number of the group data (column) as the sorting basis-Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
SORTParameter 1       
Parameter 2 
Parameter 3 
Parameter 4       
Parameter 5 

Features

The BIN 16-bit data table (sorting source) of (N1×N2) points specified in (S), based on the group data of column (N3), sort the data rows in ascending order, and store them in (D). The (N1×N2) point of the BIN 16-bit data table (after sorting).

Take (N1)=K3, (N2)=K4 in the sort source as an example, the data table structure is as follows. In the case of a sorted data table, (S) should be replaced with (D).

 Number of groups (N2) ((N2)=K4)
Column NO. 1Column NO. 2Column NO. 3Column NO. 4
Management numberHeightWeightAge
When the number of data (N1)=3Line NO.1(S)(S) +3(S) +6(S) +9
Line NO.2(S)+1(S) +4(S) +7(S) +10
Line NO.3(S)+2(S) +5(S) +8(s) +11

Data alignment starts when instruction input is ON, data alignment ends after (N1) scan, instruction execution end flag SM229 is set to ON. According to the source data sorted as follows, an example of the operation is shown below. In addition, by putting serial numbers such as management numbers in the first column in advance, the original row number can be judged based on the content, which is very convenient.

 Number of groups (N2) ((N2)=K4)
Column NO. 1Column NO. 2Column NO. 3Column NO. 4
Management numberHeightWeightAge
When the number of data (N1) = 5Line NO.1(S)(S) +5(S) +10(S) +15
11504520
Line NO.2(S)+1(S) +6(S) +11(S) +16
21805040
Line NO.3(S)+2(S) +7(S) +12(S) +17
31607030
Line NO.4(S) +3(S) +8(S) +13(S) +18
4100208
Line NO.5(S) +4(S) +9(S) +14(S) +19
51505045

Press (N3)=K2 (column number 2) to execute the sorting result.

 Number of groups (N2) ((N2)=K4)
Column NO.1Column NO.2Column NO.3Column NO.4
Management numberHeightWeightAge
When the number of data (N1) = 5Line NO.1(D)(D) +5(D) +10(D) +15
4100208
Line NO.2(D) +1(D) +6(D) +11(D) +16
11504520
Line NO.3(D) +2(D) +7(D) +12(D) +17
51505045
Line NO.4(D) +3(D) +8(D) +13(D) +18
31607030
Line NO.5(D) +4(D) +9(D) +14(D) +19
21805040

Press (N3)=K3 (column number 3) to execute the sorting result.

 Number of groups (N2) ((N2)=K4)
Column NO.1Column NO.2Column NO.3Column NO.4
Management numberHeightWeightAge
When the number of data (N1) = 5Line NO.1(D)(D) +5(D) +10(D) +15
4100208
Line NO.2(D) +1(D) +6(D) +11(D) +16
11504520
Line NO.3(D) +2(D) +7(D) +12(D) +17
21805040
Line NO.4(D) +3(D) +8(D) +13(D +18
51505045
Line NO.5(D) +4(D) +9(D) +14(D) +19
31607030

Note: only ascending order is supported by SORT instruction .

Do not change the operand and data content during operation.

When executing again, the instruction input should be turned OFF once.

SORT instruction can drive at most one in the program.

When the same device is specified in (S) and (D), the source data is rewritten to the sorted data order. Please pay special attention not to change the content of (S) before the end of execution.

Error code

Error codeContent
4084HWhen the value specified in (N1) exceeds the range of 1 to 32
When the value specified in (N2) exceeds the range of 1 to 6
When the value specified in (N3) exceeds the range of 1 to n2
4085HWhen the device specified in read application instruction (S), (N1), (N2 )and (N3) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range
4087HWhen the (D) parameter in the application instruction uses an unsupported device
4089HThe number of application instructions exceeds the limit.

Example

Refer to the function description example.

07-2 Basic instructions_html_2b87a0892241f0a3.png

SORT2/16-bit data sorting

SORT2(P)

Sort the data rows in ascending or descending order based on the group data in column (N3), and store them in (D), based on the BIN 16-bit data table (sorting source) of (N1×N2) points specified in (S) In the BIN 16-bit data table (after sorting) of the specified (N1×N2) points.

-[SORT2 (S) (N1) (N2) (D) (N3)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start device number storing the data table-Signed BIN 16 bitANY16
(N1)Number of data (rows)1 to 32Signed BIN 16 bitANY16
(N2)Number of group data (columns)1 to 6Signed BIN 16 bitANY16
(D)The start device number storing the operation result-Signed BIN 16 bitANY16
(N3)The column number of the group data (column) as the sorting basis-Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
SORT2Parameter 1       
Parameter 2 
Parameter 3 
Parameter 4       
Parameter 5 

Features

Sort the data rows in ascending or descending order based on the group data in column (N3) and store them in (D) (N1×N2) point specified in the BIN 16-bit data table (after sorting).

Take (N1)=K3, (N2)=K4 in the sort source as an example, the data table structure is as follows. In the case of a sorted data table, (S) should be replaced with (D).

 When the number of groups (N2) (N2) = K4
Column NO.1Column NO.2Column NO.3Column NO.4
Management numberHeightWeightAge
When the number of data (N1)=3Line NO.1(S)(S)+1(S) +2(S) +3
Line NO.2(S) +4(S) +5(S) +6(S) +7
Line NO.3(S) +8(S) +9(S) +10(S) +100

Sequence is set by the ON/OFF status of SM165

 Sort order setting instruction
SM165=ONDescending
SM165=OFFAscending

Data alignment starts when instruction input is ON, data alignment ends after (N1) scan, instruction execution end flag SM229 is set to ON.

According to the source data sorted as follows, an example of the operation is shown below. In addition, by putting serial numbers such as management numbers in the first column in advance, the original row number can be judged based on the content, which is very convenient.

 When the number of groups (N2) (N2) = K4
Column NO.1Column NO.2Column NO.3Column NO.4
Management numberHeightWeightAge
When the number of data (N1) = 5Line NO.1(S)(S)+1(S) +2(S) +3
11504520
Line NO.2(S) +4(S) +5(S) +6(S) +7
21805040
Line NO.3(S) +8(S) +9(S) +10(S) +100
31607030
Line NO.4(S) +12(S) +13(S) +14(S) +15
4100208
Line NO.5(S) +16(S) +17(S) +18(S) +19
51505045

Press (N3)=K2 (column number 2) to execute the sorting result (SM165=OFF in the case of ascending order)

 When the number of groups (N2) (N2) = K4
Column NO.1Column NO.2Column NO.3Column NO.4
Management numberHeightWeightAge
When the number of data (N1) = 5Line NO.1(D)(D) +1(D) +2(D) +3
4100208
Line NO.2(D) +4(D) +5(D) +6(D) +7
11504520
Line NO.3(D) +8(D) +9(D) +10(D) +100
51505045
Line NO.4(D) +12(D) +13(D) +14(D) +15
31607030
Line NO.5(D) +16(D) +17(D) +18(D) +19
21805040

Press (N3)=K3 (column number 3) to execute the sorting result (SM165=ON in the case of ascending order)

 When the number of groups (N2) (N2) = K4
Column NO.1Column NO.2Column NO.3Column NO.4
Management numberHeightWeightAge
When the number of data (N1) = 5Line NO.1(D)(D) +1(D) +2(D) +3
31607030
Line NO.2(D) +4(D) +5(D) +6(D) +7
21805040
Line NO.3(D) +8(D) +9(D) +10(D) +100
51505045
Line NO.4(D) +12(D) +13(D) +14(D) +15
11504520
Line NO.5(D) +16(D) +17(D) +18(D) +19
4100208

Note:  Do not change the operand and data content during operation.

When executing again, the instruction input should be turned OFF once.

The SORT2 instruction can only be written in the program to drive 2 at most.

When the same device is specified in (S) and (D), the source data is rewritten to the sorted data order. Please pay special attention not to change the content of (S) before the end of execution.

Do not overlap the source data and the sorted data.

07-2 Basic instructions_html_d78408a5465eaf25.gif

Error code

Error codeContent
4084HWhen the value specified in (N1) exceeds the range of 1 to 32
When the value specified in (N2) exceeds the range of 1 to 6
When the value specified in (N3) exceeds the range of 1 to n2
4085HWhen the device specified in read application instruction (S), (D), (N1), (N2 )and (N3) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range
4089HThe number of application instructions exceeded the limit.

Example

Refer to the function description example.

07-2 Basic instructions_html_3a995438f23dce64.png

DSORT2/32-bit data sorting

DSORT2(P)

Sort the data rows in ascending or descending order based on the group data of column (N3) in the BIN 32-bit data table (sorting source) of (N1×N2) points specified in (S) and store them in (D) The specified (N1×N2) point BIN 32-bit data table (after sorting).

-[DSORT2 (S) (N1) (N2) (D) (N3)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start device number storing the data table-Signed BIN 32 bitANY32
(N1)Number of data (rows)1 to 32Signed BIN 32 bitANY32
(N2)Number of group data (columns)1 to 6Signed BIN 32 bitANY32
(D)The start device number storing the operation result-Signed BIN 32 bitANY32
(N3)The column number of the group data (column) as the sorting basis-Signed BIN 32 bitANY32

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DSORT2Parameter 1       
Parameter 2 
Parameter 3 
Parameter 4       
Parameter 5 

Features

Sort the data rows in ascending or descending order based on the group data in the (N3) column of the (N1×N2) point BIN 32-bit data table (sorting source) specified in (S), and store to (d) (N1×N2) specified in the BIN 32-bit data table (after sorting).

Take (N1)=K3, (N2)=K4 in the sort source as an example, the data table structure is as follows. In the case of a sorted data table, (S) should be replaced with (D).

 When the number of groups (N2) (N2) = K4
Column NO.1Column NO.2Column NO.3Column NO.4
Management numberHeightWeightAge
When the number of data (N1)=3Line NO.1(S)+1, (S)(S)+3, (S)+2(S)+5, (S)+4(S) +7, (S) +6
Line NO.2(S) +9, (S) +8(S)+11, (S)+10(S) +13, (S) +12(S) +15, (S) +14
Line NO.3(S) +17, (S) +16(S) +19, (S) +18(S) +21, (S) +20(S) +23, (S) +22

Sequence is set by the ON/OFF status of SM165

 Sort order setting instructions
SM165=ONDescending
SM165=OFFAscending

Data alignment starts when instruction input is ON, data alignment ends after (n1) scan, instruction execution end flag SM229 is set to ON.

According to the source data sorted as follows, an example of the operation is shown below. In addition, by putting serial numbers such as management numbers in the first column in advance, the original row number can be judged based on the content, which is very convenient.

 When the number of groups (N2) (N2) = K4
Column NO.1Column NO.2Column NO.3Column NO.4
Management numberheightbody weightage
When the number of data (N1) = 5Line NO.1(S)+1, (S)(S)+3, (S)+2(S)+5, (S)+4(S) +7, (S) +6
11504520
Line NO.2(S) +9, (S) +8(S)+11, (S)+10(S) +13, (S) +12(S) +15, (S) +14
21805040
Line NO.3(S) +17, (S) +16(S) +19, (S) +18(S) +21, (S) +20(S) +23, (S) +22
31607030
Line NO.4(S) +25, (S) +24(S) +27, (S) +26(S) +29, (S) +28(S) +31, (S) +30
4100208
Line NO.5(S) +33, (S) +32(S) +35, (S) +34(S) +37, (S) +36(S) +39, (S) +38
51505045

Press (N3)=K2 (column NO.2) to execute the sorting result (SM165=OFF in the case of ascending order)

 When the number of groups (N2) (N2) = K4
Column NO.1Column NO.2Column NO.3Column NO.4
Management numberheightbody weightage
When the number of data (N1) = 5Line NO.1(S)+1, (S)(S)+3, (S)+2(S)+5, (S)+4(S) +7, (S) +6
4100208
Line NO.2(S) +9, (S) +8(S)+11, (S)+10(S) +13, (S) +12(S) +15, (S) +14
11504520
Line NO.3(S) +17, (S) +16(S) +19, (S) +18(S) +21, (S) +20(S) +23, (S) +22
51505045
Line NO.4(S) +25, (S) +24(S) +27, (S) +26(S) +29, (S) +28(S) +31, (S) +30
31607030
Line NO.5(S) +33, (S) +32(S) +35, (S) +34(S) +37, (S) +36(S) +39, (S) +38
21805040

Press (N3)=K3 (column NO.3) to execute the sorting result (SM165=ON in the case of ascending order)

 When the number of groups (N2) (N2) = K4
Column NO.1Column NO.2Column NO.3Column NO.4
Management numberheightbody weightage
When the number of data (N1) = 5Line NO.1(S)+1, (S)(S)+3, (S)+2(S)+5, (S)+4(S) +7, (S) +6
31607030
Line NO.2(S) +9, (S) +8(S)+11, (S)+10(S) +13, (S) +12(S) +15, (S) +14
21805040
Line NO.3(S) +17, (S) +16(S) +19, (S) +18(S) +21, (S) +20(S) +23, (S) +22
51505045
Line NO.4(S) +25, (S) +24(S) +27, (S) +26(S) +29, (S) +28(S) +31, (S) +30
11504520
Line NO.5(S) +33, (S) +32(S) +35, (S) +34(S) +37, (S) +36(S) +39, (S) +38
4100208

Note:  Do not change the operand and data content during operation.

When executing again, the instruction input should be turned OFF once.

The SORT2 instruction can only be written twice in the program.

When the same device is specified in (S) and (D), the source data is rewritten to the sorted data order. Please pay special attention not to change the content of (S) before the end of execution.

Do not overlap the source data and the sorted data.

07-2 Basic instructions_html_d78408a5465eaf25.gif

Error code

Error codeContent
4084HWhen the value specified in (N1) exceeds the range of 1 to 32
When the value specified in (N2) exceeds the range of 1 to 6
When the value specified in (N3) exceeds the range of 1 to n2
4085HWhen the device specified in read application instruction (S), (D), (N1), (N2 )and (N3) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range
4089HThe number of application instructions exceeded the limit.

Example

Refer to the function description example.

07-2 Basic instructions_html_1f225b781e4ba2f.png

SWAP/16-bit data high and low byte swap

SWAP(P)

Swap the high and low 8-bit value of the device specified in (D).

-[SWAP (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)Word device with high and low byte swap-Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnYKnMKnSTCDRSD[D]XXP
SWAPParameter 1

Features

Convert the high and low 8-bit value of the device specified in (D).

07-2 Basic instructions_html_3716816d1bf23d09.png

Error code

Error codeContent
4085HWhen the device specified in the read application instruction (D) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_4955b8e80583b752.png

When the rising edge of M0 is triggered, swap the low 8 bits and high 8 bits of D0 to get H8F2A.

DSWAP/32-bit data high and low byte swap

DSWAP(P)

The devices specified in (D) and (D)+1 will be converted to the high and low 8-bit values respectively.

-[DSWAP (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)Word device with high and low byte swap-Signed BIN 32 bitANY32

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnYKnMKnSTCDRSDLCHSC[D]XXP
DSWAPParameter 1

Features

The devices specified in (D) and (D)+1 will be converted to the upper and lower 8-bit values respectively.

07-2 Basic instructions_html_4d64dcd321d22f11.png

Note:  If continuous execution instructions are used, conversion will be performed every scan cycle.

Error code

Error codeContent
4085HWhen the device specified in the read application instruction (D) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_81e3d6e4b87b8c93.png

When the rising edge of M0 is triggered, the low 8 bits and the high 8 bits of D0 and D1 are swapped, and D0=H8F2A, D1=H3412 are obtained.

07-2 Basic instructions_html_80e0730a6f8e691a.png

BTOW/Byte unit data merge

BTOW(P)

Combine the low 8 bits of (N) bytes of BIN 16-bit data stored after the device number specified in (S) into word units and store it after the device number specified in (D).

-[BTOW (S) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start device that stores the data merging in byte units-Signed BIN 16 bitANY16
(D)The start device that stores the result of merging in byte units-Signed BIN 16 bitANY16
(N)Number of byte data merged0-32767Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
BTOWParameter 1      
Parameter 2      
Parameter 3

Features

After the device number specified in (s), the lower 8 bits of the 16-bit BIN data stored in (n) bytes are combined into word units and stored in the device number specified in (d) or later.

The upper 8 bits of (n) word data stored after the device number specified in (s) will be ignored. In addition, when (n) is an odd number, 0 is stored in the upper 8 bits of the device storing the (n)th byte of data.

07-2 Basic instructions_html_f7abd03fc8a46b74.png

£: the £th byte data;

(1): Ignore the high byte

*1: Carry below the decimal point.

Example

When (N)=5, the data up to the lower 8 bits of (S)+(S)+4 is stored in (D)+(D)+2.

07-2 Basic instructions_html_50df057d754891b2.png

(1): When (N)=5

(2): Change to 00H

By setting the number of bytes in (N), the range of byte data specified in (S) and the range of the device storing the combined data specified in (D) will be automatically determined.

When the number of bytes specified in (N) is 0, no processing is performed.

The upper 8 bits of the byte data storage device specified in (S) will be ignored, and the lower 8 bits will be the target.

Example

When the low 8 bits of D11 to D16 is stored in D12 to D14.

07-2 Basic instructions_html_9e8f8fd8cc532de.png

Even if the device range storing the data before merging overlaps the device rangestoring merged data, it will be handled as normal.

Device range storing the data before mergingDevice range for storing merged data
(S)+0 to (S)+(N)-1(D) to (D) + (N/2-1)

Error code

Error codeContent
4084HThe value specified in (N) exceed range of 0 to 32767
4085HWhen the device specified in the write application instruction (S),(D) and (N) exceeds the corresponding device range

Example

07-2 Basic instructions_html_5451ed9cd96c7f44.png

When M0 is ON, the data of D20 to D25 is separated according to byte units, and then stored in D10 to D12.

07-2 Basic instructions_html_952713e3b4e74083.png

WTOB/Byte unit data separation

WTOB(P)

After separating the BIN 16-bit data stored after the device number specified in (S) into (N) bytes, store it after the device number specified in (D).

-[WTOB (S) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start device that stores the data separation in byte unit-Signed BIN 16 bitANY16
(D)The start device that stores the result of separation in byte unit-Signed BIN 16 bitANY16
(N)Number of byte data separated0-32767Signed BIN 16 bitANY16

Device used

InstructionParameterDevicesOffset modification

Pulse extension

TCDRSDKH[D]XXP
WTOBParameter 1  
Parameter 2  
Parameter 3  

Features

After separating the BIN 16-bit data stored after the device number specified in (S) into (N) bytes, store it after the device number specified in (D).

07-2 Basic instructions_html_7c0bf2832b8707c3.png

  1. High byte;
  2. Low byte;
  3. High byte data;
  4. Low byte data;
  5. *1: Carry below the decimal point.

Example

In the case of (N)=5, store the data up to the lower 8 bits of (S) to (S)+2 in (D) to (D)+4:

07-2 Basic instructions_html_fe50c08e8ade2455.png

  1. (N)=5 is ignored.
  2. (N)=5.

By setting the number of bytes in (N), the range of BIN 16-bit data specified in (S) and the range of the device storing the byte data specified in (D) will be automatically determined.

When the number of bytes specified in (N) is 0, no processing is performed.

00H is automatically stored in the upper 8 bits of the byte data storage device specified in (D).

Example

When D12 to D14 is stored in the low 8 bits of D11 to D16

07-2 Basic instructions_html_e3a3ed7cb6d9e035.png

Even if the device range storing the data before merging overlaps the device rangestoring merged data, it will be handled as normal.

Device range storing the data before mergingDevice range storing separated data
(S) to (S) + (N/2-1)(D)+0 to (D)+(N)-1

Error code

Error codeContent
4084HThe value specified by (N) exceed the range of 0 to 32767
4085HWhen the device specified in read application instruction (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_da482b8ab5a3e35a.png

When M0 is ON, the data of D10 to D12 are separated according to byte units, and then stored in D20 to D25.

07-2 Basic instructions_html_9da7a305c36b78d1.png

DIS/4-bit separation of 16-bit data

DIS(P)

Store the data of the low (N) bits (1 bit of 4 bits) of the BIN 16-bit data specified in (S) into the low 4-bit of the (N) point starting from the device specified in (D).

-[DIS (S) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start device storing the data before separation-Signed BIN 16 bitANY16
(D)The start device storing separated data-Signed BIN 16 bitANY16
(N)Separation number (0 means no processing)0-4Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
DISParameter 1
Parameter 2      
Parameter 3

Features

Store the low-(N) bit (1 bits of 4 bits) of the BIN 16-bit data specified in (S) in the low 4-bit of the (N) point starting from the device specified in (D).

07-2 Basic instructions_html_5938199acdc55dc1.png

The hig-12 bit of the point (N) starting from the device specified in (S) will become 0.

When (N)=0, it will become no processing, and the content of point (N) starting from the device of (D) will not change.

Error code

Error codeContent
4084HThe data in (N) exceed the range of 0 to 4
4085HWhen the device specified in read application instruction (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_c0329da3be0da41.png

When M0 is ON, D0 is separated every 4 bits and stored in D10 to D12. The result is D10 = HF, D11 = H8, D12 = HA.

UNI/4-bit combination of 16-bit data

UNI(P)

Combine the low 4 bits of the BIN 16-bit data of point (N) starting from the device specified in (S) into the BIN 16-bit device specified in (D).

-[UNI (S) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start device storing the data before merging-Signed BIN 16 bitANY16
(D)The start device storing the merged data-Signed BIN 16 bitANY16
(N)Number of merger0-4Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
UNIParameter 1      
Parameter 2   
Parameter 3

Features

Combine the low 4 bits of the BIN 16-bit data at point (N) starting from the device specified in (S) into the BIN 16-bit device specified in (D).

07-2 Basic instructions_html_ac539a0af5621485.png

The high (4-N) bits of the device specified in (D) will become 0.

When (N)=0, it will become no processing, and the content of the device in (D) will not change.

Error code

CodeContent
4084HThe data in (N) exceed the range of 0 to 4
4085HWhen the device specified in read application instruction (S) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-2 Basic instructions_html_c01aef986a0a77b0.png

When M0 is ON, the low 4 bits of D0 to D3 are combined and stored in D10, the value is H236F.

ZRST/Data batch reset

ZRST(P)

Perform a batch reset between the devices specified in (d1) and (d2) of the same type. It is used when interrupting operation, performing initial operation, or resetting control data.

-[ZRST (d1) (d2)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(d1)The start bit or word device number of batch reset-Bit/Signed BIN 16 bitANY_ELEMENTARY
(d2)The final bit or word device number of batch reset-Bit/Signed BIN 16 bitANY_ELEMENTARY

Device used

InstructionParameterDevices

Offset modification

Pulse extension

YMSSMKnXKnYKnMKnSTCDRSDLCHSC[D]XXP
ZRSTParameter 1
Parameter 2

Features

Perform batch reset between the devices specified in (d1) and (d2) of the same type.

When (d1) and (d2) are bit devices, write OFF (reset) in the entire device range of (d1) to (d2).

07-2 Basic instructions_html_6a643f895dce5dcf.png

When (d1) and (d2) are word devices, write K0 in the entire device range of (d1) to (d2).

07-2 Basic instructions_html_4e253e658fd251d8.png

As a separate reset instruction for the device, the RST instruction can be used for bit devices or word devices.

Reset M0

Reset D0

Reset the current value of T0

07-2 Basic instructions_html_db7123fa756a328e.png

The batch write instruction of constant (for example: K0) has FMOV (P) instruction, which can write 0 to word devices (including bit device specification).

Write K0 in D0 to D99.

07-2 Basic instructions_html_edf867a50a714481.png

Note: Please specify the same type number for (d1) and (d2), and make (d1) number <(d2) number. When (d1) number ≥ (d2) number, only 1 point will be reset for the device specified in (d1).

ZRST(P) instruction is a 16-bit instruction, which can specify (LC) and (HSC) devices for (d1) and (d2).

Error code

Error codeContent
4084HWhen the device type specified in (d1) is different from the device type specified in (d2).
4085HWhen the device specified in the read application instruction (d1) and (d2) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (d1) exceeds the corresponding device range

Example

07-2 Basic instructions_html_f78d26cb1f6908b7.png

The function of this Circuit program instruction is to set the value of the D0 to D100 device to 0.

ZSET/Data batch set

ZSET(P)

Perform a batch set between the devices specified in (d1) and (d2) of the same type.

07-2 Basic instructions_html_da64e5c21415b34f.png

Content, range and data type

ParameterContentRangeData typeData type(label)
(d1)The start bit device number of batch set-BitANY_BOOL
(d2)The final bit device number of batch set-BitANY_BOOL

Device used

InstructionParameterDevicesOffset modification
YMSSMD.b[D]
ZSETParameter 1
Parameter 2

Features

·Perform a batch set between the devices specified in (d1) and (d2) of the same type.

·Write ON (set) in the entire device range of (d1) to (d2)

07-2 Basic instructions_html_6c035079ef5cc84b.png

·As a separate set instruction for the device, the SET instruction can be used for bit devices.

Set M1

Set Y1

Set S1

07-2 Basic instructions_html_e8901e24a4d0b868.png

Note:  Please specify the same type number for (d1) and (d2), and make (d1) number <(d2) number. When (d1) number ≥ (d2) number, only 1 point will be set for the device specified in (d1).

Error code

Error codeContent
4084HWhen the device type specified in (d1) is different from the device type specified in (d2).
4085HWhen the device specified in the read application instruction (d1) and (d2) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (d1) exceeds the corresponding device range
4087HWhen the device type specified in (d1) and (d2) are not bit device.

Example

07-2 Basic instructions_html_b7756e9ffdc0d901.png

The function of this LAD instruction is to set the value of the M1 to M4 device to ON.

CRC/cyclic redundancy check instruction

CRC(P)

Calculate the CRC (Cyclic Redundancy Check) value, which is one of the error checking methods used in communications. In addition to CRC, error checking methods include parity and

Sum check (checksum), calculate horizontal parity check value and sum check value can use CCD(P) instruction . And this instruction is used in the generator polynomial that generates the CRC value (CRC-16)

"X 16 +X 15 +X 2 +1".

-[CRC(P) (S) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The device start number storing the data of CRC value generated objects-Signed BIN16ANY16
(D)The destination device number of the generated CRC value-Signed BIN16ANY16
(N)The number of 8-bit data (bytes) for calculating the CRC value or the number of the device storing the number of data1 to 256Unsigned BIN16ANY16_U

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
CRCParameter 1  
Parameter 2   
Parameter 3 

Features

Start with the device specified in (S), generate the CRC value of 8-bit data (byte unit) at (N) point, and store it in (D).

The mode used by this instruction in calculation includes 16-bit conversion mode and 8-bit conversion mode. For the operation of each mode, please refer to the following content.

1. 16-bit conversion mode (when SM161=OFF)

Calculate the upper 8 bits (byte) and lower 8 bits (byte) of the (S) device. The result is stored in 16 bits of 1 point of the device specified in (D). In the case of the following program, perform the conversion as shown below.

07-2 Basic instructions_html_860919febd080a5a.gif

 Example (s)=D100, (d)=D0, (n)=6
DevicesContent of object data
8-bit16-bit
CRC value generation target data storage destination(s)Low byteD100 low01H0301H
High byteD100 high03H 
(s)+1Low byteD101 low03H0203H
High byteD101 high02H 
(s)+2Low byteD102 low00H1400H
High byteD102 high14H 
...
(S)+(N)/2-1Low byte
High byte
CRC value storage target(d)Low byteD0 lowE4H41E4H
High byteD0 high41H 

2. 8-bit conversion mode (when SM8161=ON)

In 8-bit conversion mode, only the lower 8 bits (lower byte) of the (s) device are operated on. As a result, 2 points are used starting from the device specified in (d), the lower 8 bits (bytes) are stored in (d), and the upper 8 bits (bytes) are stored in (d)+1.

In the case of the following program, perform the conversion as shown below.

07-2 Basic instructions_html_e6f8991549727060.gif

 Example) (s)=D100, (d)=D0, (n)=6
DevicesContent of object data
CRC value generation target data storage destination(s)Low byteD100 low01H
(s)+1Low byteD101 low03H
(s)+2Low byteD102 low03H
(s)+3Low byteD103 low02H
(s)+4Low byteD104 low00H
(s)+5Low byteD105 low14H
...
(S)+(N)-1Low byte
CRC value storage target(d)Low byteD0E4H
(d)+1Low byteD141H

In the CRC(P) instruction, the generator polynomial of the CRC value (CRC-16) uses "X16+X15+X2+1", but there are also many standardized generator polynomials for the CRC value. If the generator polynomial is different, it will become a completely different CRC value, which should be noted. The main CRC value generator polynomials are shown below.

NameGenerator polynomial
CRC-12X12+X11+X3+X2+X+1
CRC-16X16+X15+X2+1
CRC-32X32+X26+X23+X22+X16+X12+X11+X10+X8+X7+X5+X4+X2+X+1
CRC-CCITTX16+X12+X5+1

Note: 

When (s1) use KnX, KnY, KnM, KnS, n must be specified as 4.

Error code

Error codeContent
4084HThe range of (N) exceeds 1 to 256
4085HThe data address of (S) to be converted exceeds the device range
4086HThe (D) write address exceeds the device range
4087HUnsupported device type is used by (S) and (D)

Example

1. 16-bit conversion mode

07-2 Basic instructions_html_8440fd092cae48b0.gif

2. 8-bit conversion mode

07-2 Basic instructions_html_b95cce31a754112b.gif

CRC-XMODEM/cyclic redundancy check instruction 

CRC-XMODEM(P)

The device specified in (s) is used as the start, and the CRC value of 8-bit data (byte units) at point (n) is generated and stored in (d)

PLC Editor2 version that supports this command: 2.3.1 and above 

-[CRC-XMODEM(P)  (s)  (d)  (n)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s)The device start number storing  the data of CRC-XMODEM value generated objects -Signed BIN16ANY16
(d)The destination device number of the generated CRC-XMODEM value-Signed BIN16ANY16
(n)The number of 8-bit data (bytes) for calculating the CRC-XMODEM value or the number of the device storing the number of data1 to 256Unsigned BIN16ANY16_U

Device used

InstructionParameterDevices

Offset

modification

Pulse

extension

XYMSSMT(bit)C(bit)LC(bit)HSC(bit)D.bKnXKnYKnMKnSTCDRSDLCHSCKHE[D]XXP
CRC-XMODEMParameter 1               
Parameter 2                
Parameter 3              

Features

CRC-XMODEM (Cyclic Redundancy Check-XMODEM, abbreviation: CRC-XMODEM) is one of the error checking methods used in communication. In addition to CRC-XMODEM, there are also parity and checksum (checksum) error checking methods, and the CCD (P) instruction can be used to calculate the horizontal parity and checksum values.

The polynomial for generating the CRC-XMODEM value (CRC-CCITT) in this command uses "X16+X12+X5+1"

The modes used in this instruction for calculation are 16-bit conversion mode and 8-bit conversion mode. For the action of each mode, please refer to the following.

(1) 16-bit conversion mode (when SM161=OFF)

The high 8 bits (bytes) and low 8 bits (bytes) of the device in (s) are operated. The result is stored to the 16 bits of the soft element 1 point specified in (d).

In the case of the following program, the conversion is executed as follows

图片9.png

CRC-XMODEM 16-bit modeCRC value generation object data storage targetCRC value storage target
(s)(s)+1(s)+2...(s)+(n)/2-1(d)

Low

Byte

High

Byte

Low

Byte

High

Byte

Low

Byte

High

Byte

 

Low

Byte

High

Byte

Low

Byte

High

Byte

(s)=D100,(d)=D0,(n)=6Device

D100

low

D100

high

D101

low

D101

high

D102

low

D102

high

 -

D0

low

D0

high

Contents of object data8-bit01H03H03H02H00H14H7BH0CH
16-bit0301H 0203H 1400H 0C7BH 

(1) 8-bit conversion mode (when SM161=ON)

In the 8-bit conversion mode, only the low 8 bits (low byte) of the device of (s) are operated. The result uses 2 points from the soft component specified in (d), storing the low 8 bits (bytes) in (d) and the high 8 bits (bytes) in (d) + 1.

In the case of the following program, the conversion is executed as follows

10.png


CRC-XMODEM 8-bit mode
CRC value generation object data storage targetCRC value storage target
(s)(s)+1(s)+2(s)+3(s)+4(s)+5...(s)+(n)-1(d)(d)+1

Low

Byte

Low

Byte

Low

Byte

Low

Byte

Low

Byte

Low

Byte

 

Low

Byte

Low

Byte

Low

Byte

(s)=D100,(d)=D0,(n)=6Device

D100

Low

D101

Low

D102

Low

D103

Low

D104

Low

D105

Low

 -D0D1
Contents of object data01H03H03H02H00H14H  7BH0CH

The CRC value (CRC-CCITT) in the CRC-XMODEM(P) instruction uses "X16+X12+X5+1" in the generating polynomial, but there are many standardized generating polynomials for CRC values. If this generating polynomial is different, it will become a completely different CRC value and should be noted. The main generating polynomials for CRC values are shown below.

NameGenerator polynomial
CRC-12X12+X11+X3+X2+X+1
CRC-16X16+X15+X2+1
CRC-32X32+X26+X23+X22+X16+X12+X11+X10+X8+X7+X5+X4+X2+X+1
CRC-CCITTX16+X12+X5+1

✎Note: When (s1) use KnX, KnY, KnM, KnS, n must be specified as 4.

Error code

Error codeContent
4084HThe range of (n) exceeds 1 to 256
4085HThe data address of (s) to be converted exceeds the device range
4086HThe (d) write address exceeds the device range
4087HUnsupported device type is used by (s) and (d)

Example

③16-bit conversion mode

图片11.png

④8-bit conversion mode

图片12.png

LRC/longitudinal redundancy check 

LRC(P)

The device specified in (s) is used as the start, and the data to be checked (2n characters) is summed two by two into a hexadecimal value and stored in (d).

PLC Editor2 version that supports this command: 2.3.1 and above 

-[LRC(P)  (s)  (d)  (n)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s)The device start number storing  the data of LRC value generated objects -Signed BIN16ANY16
(d)The destination device number of the generated LRC value-Signed BIN16ANY16
(n)The number of 8-bit data (bytes) for calculating the LRC value or the number of the device storing the number of data1 to 256Unsigned BIN16ANY16_U

Device used

InstructionParameterDevices

Offset

modification

Pulse

extension

XYMSSMT(bit)C(bit)LC(bit)HSC(bit)D.bKnXKnYKnMKnSTCDRSDLCHSCKHE[D]XXP
LRCParameter 1               
Parameter 2                
Parameter 3              

Features

Longitudinal Redundancy Check (LRC) is a common form of checksum used in communications, also known as LRC checksum or longitudinal checksum. It is an error detection method that generates check bits from a specific bit string on a vertical channel. LRC is often used in conjunction with VRC in the row and column format, so that for each character check digit.

The specific algorithm is as follows.

(1) Sum the data to be verified (2n characters) two by two to form a hexadecimal value.

(2) Modulo the summation result with 256.

(3) the resulting modulus is subtracted from 256 to get the result of the checksum (another method: the modulus is inverted by bit and then added to 1).

Example of hexadecimal data: 01 A0 7C FF 02

(Hexadecimal calculation)

Summation: 01 + A0 + 7C + FF + 02 = 21E Modulo: 21E % 100 = 1E Calculation: 100 - 1E = E2

(Calculated in decimal)

Summation: 01 + 160 + 124 + 255 + 02 = 542 Modulo: 542 % 256 = 30 Calculation: 256 - 30 = 226

The modes used in this instruction for calculation are 16-bit conversion mode and 8-bit conversion mode. For more information on the actions of each mode, see the following section.

(1) 16-bit conversion mode (when SM161=OFF)

The high 8 bits (bytes) and low 8 bits (bytes) of the device in (s) are operated. The result is stored to the 16 bits of the device 1 point specified in (d).

In the case of the following program, the conversion is executed as follows

图片1.png

LRC 16-bit modeLRC value generation object data storage targetLRC value storage target
(s)(s)+1(s)+2...(s)+(n)/2-1(d)
D100D101D102 D(s)+(n)/2-1D0
(s)=D100,(d)=D0,(n)=6Device

Low

Byte

High

Byte

Low

Byte

High

Byte

Low

Byte

High

Byte

 

Low

Byte

High

Byte

Low

Byte

High

Byte

Contents of object data8-bit01H03H03H02H00H14H  E3H00H
16-bit0301H 0203H 1400H   00E3H 

(1) 8-bit conversion mode (when SM161=ON)

In the 8-bit conversion mode, only the low 8 bits (low byte) of the device of (s) are operated. The result uses 2 points from the soft component specified in (d), storing the low 8 bits (bytes) in (d) and the high 8 bits (bytes) in (d) + 1.

In the case of the following program, the conversion is executed as follows

图片2.png

LRC 8-bit modeLRC value generation object data storage targetLRC value storage target
(s)(s)+1(s)+2(s)+3(s)+4(s)+5...(s)+(n)-1(d)(d)+1

Low

Byte

Low

Byte

Low

Byte

Low

Byte

Low

Byte

Low

Byte

 

Low

Byte

Low

Byte

Low

Byte

(s)=D100,(d)=D0,(n)=6Device

D100

Low

D101

Low

D102

Low

D103

Low

D104

Low

D105

Low

ÉÉD0D1
Contents of object data01H03H03H02H00H14H  E3H00H

✎Note: 

When (s1) use KnX, KnY, KnM, KnS, n must be specified as 4.

Error code

Error codeContent
4084HThe range of (n) exceeds 1 to 256
4085HThe data address of (s) to be converted exceeds the device range
4086HThe (d) write address exceeds the device range
4087HUnsupported device type is used by (s) and (d)

Example

⑤16-bit conversion mode

图片3.png

LRC operation is performed on the high 8 bits (bytes) and low 8 bits (bytes) of the 6 device starting at (D100). The result is stored to the 16 bits of the (D0) soft component.

⑥8-bit conversion mode

图片4.png

The low 8 bits (low byte) of the 6 device from (D100) are operated. The result uses 2 points from (D0) designated device, and stores the low 8 bits (bytes) in (D0) and the high 8 bits (bytes) in (D1).

STDEV/BIN 16-bit sample standard deviation

STDEV(P)

The standard deviation of the (n) points (16-bit data units) starting from the device specified in (s1) is calculated, and the result of the calculation is stored in (d) by rounding.

PLC Editor2 version that supports this command: 2.3.1 and above 

-[STDEV(P)  (s1)  (d)  (n)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s1)Device start number of the data for standard deviation calculation. -Signed BIN16ANY16
(d)Device start number for storing standard deviation.-Signed BIN16ANY16
(n)Number of data or device number where the number of data is stored.2 to 32767Signed BIN16ANY16

Device used

InstructionParameterDevices

Offset

modification

Pulse

extension

XYMSSMT(bit)C(bit)LC(bit)HSC(bit)D.bKnXKnYKnMKnSTCDRSDLCHSCKHE[D]XXP
STDEVParameter 1               
Parameter 2                
Parameter 3             

Error code

Error codeContent
4084HThe range of (n) exceeds 2 to 32767
4085HThe data address of (s) (n) to be converted exceeds the device range
4086HThe (d) write address exceeds the device range

image-20221123144231-1.png

The standard deviation of the 5 device (16-bit data units) starting from the device specified in (D1) is calculated, and the result of the calculation is stored in (D10).

DSTDEV/BIN 32-bit sample standard deviation

DSTDEV(P)

The standard deviation of the (n) points (32-bit data units) starting from the device specified in (s1) is calculated, and the result of the calculation is stored in (d) by rounding.

PLC Editor2 version that supports this command: 2.3.1 and above 

-[DSTDEV(P)  (s1)  (d)  (n)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s1)Device start number of the data for standard deviation calculation. -Signed BIN32ANY32
(d)Device start number for storing standard deviation.-Signed BIN32ANY32
(n)Number of data or device number where the number of data is stored.1 to 2147483647Signed BIN32ANY32

Device used

InstructionParameterDevices

Offset

modification

Pulse

extension

XYMSSMT(bit)C(bit)

LC

(bit)

HSC

(bit)

D.bKnXKnYKnMKnSTCDRSDLCHSCKHE[D]XXP
DSTDEVParameter 1               
Parameter 2                
Parameter 3             

Error code

Error codeContent
4084HThe range of (n) exceeds 1 to 2147483647
4085HThe data address of (s) (n) to be converted exceeds the device range
4086HThe (d) write address exceeds the device range

image-20221123144457-1.png

The standard deviation of the 5 device (16-bit data units) starting from the device specified in (D1,D2) is calculated, and the result of the calculation is stored in (D20,D21)