01 Transfer and comparison

Version 14.1 by Joey123 on 2022/07/09 14:31

Transfer comparison instruction

MOV/16-bit transmission

MOV(P)

Transfer the BIN 16-bit data of the device specified in (S) to the device specified in (D).

-[MOV (S) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)Transmit source data or the device number stored data-32768 to 32767Signed BIN16ANY16_S
(D)Transmit destination device number-Signed BIN16ANY16_S

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
MOVParameter 1
Parameter 2   

Features

• Transfer the BIN 16-bit data specified in (S) to the device specified in (D).

07-1 Basic instructions_html_608d557cd7a9b085.png

Error code

Error codeContent
4085HThe output result of (S) in read application instruction exceeds the device range
4086HThe output result of (D) in write application instruction exceeds the device range

Example

07-1 Basic instructions_html_49a2ba67b393cca0.png

When M0 is set, the value of D0 is transferred to the value of D2: (D0)→(D2).

DMOV/32-bit transmission

DMOV(P)

Transfer the BIN 32-bit data of the device specified in (S) to the device specified in (D).

-[DMOV (S) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)Transmit source data or the device number stored data-2147483648 to 2147483647Signed BIN32ANY32_S
(D)Transmit destination device number-Signed BIN32ANY32_S

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DMOVParameter 1  
Parameter 2   

Features

Transfer the BIN 16-bit data specified in (S) to the device specified in (D).

07-1 Basic instructions_html_a7a87e4ee0331a3.png

Error code

Error codeContent
4085HThe output result of (S) in read application instruction exceeds the device range
4086HThe output result of (D) in write application instruction exceeds the device range

Example

07-1 Basic instructions_html_cbab7254f3dd95a9.png

When M0 is set, the value of (D1, D0) is transferred to the value of (D3, D2): (D1, D0) → (D3, D2).

BMOV/Batch transmission

BMOV(P)

The (N) point BIN 16-bit data starting from the device specified in (S) is sequentially transmitted to the device specified in (D).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start device that stores the transmission data-Signed BIN16ANY16_S
(D)The start device that transmit target-Signed BIN16ANY16_S
(N)Number of transmission1 ≤ N ≤ 512Signed BIN16ANY16_S

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
BMOVParameter 1  
Parameter 2   
Parameter 3

Features

Batch transfer the BIN 16-bit data of point (N) starting from the device specified in (S) to the device specified in (D).

07-1 Basic instructions_html_be0796979ffd3c06.png

When the device number exceeds the range, it will be transferred within the allowable range.

By controlling the direction reversal flag (SM224) of the BMOV instruction, the BIN 16-bit data at point (N) starting from the device specified in (D) can be batch transferred to the device specified in (S).

Error code

Error codeContent
4084HIn application instruction (N) input the data exceeds the specified range
4085HThe output results of (S) and (N) in read application instruction exceed the device range
4086HThe output result of (D) in write application instruction exceeds the device range

Example

07-1 Basic instructions_html_508e98856ee24b54.png

When M0 is set, set M1, then (D5)→(D10); (D6)→(D11); (D7)→(D12);

When M0 is reset, set M1, then (D10)→(D5); (D11)→(D6); (D12)→(D7).

FMOV/16-bit multicast

FMOV(P)

Transfer the BIN 16-bit data of the device specified in (S1) to the device specified in (D) at (N) points (that is, transfer the same data to multiple addresses).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start device that stores the transmission data-32768 to 32767Signed BIN16ANY16_S
(D)The start device that transmit target-Signed BIN16ANY16_S
(N)Number of transmission[K1 ≤ N ≤ 512]Signed BIN16ANY16_S

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
FMOVParameter 1
Parameter 2   
Parameter 3

Features

The same data as the BIN 16-bit data of the device specified in (S) is transferred to the device specified in (D) at (N) points.

07-1 Basic instructions_html_9ef78d87c9eeaa63.png

When the number specified in (N) exceeds the device number range, transfer is performed within the allowable range.

When a constant (K) is specified for the transmission source (S), it will be automatically converted to BIN.

Error code

Error codeContent
4084H(S) and(N) input the data In application instruction exceed the specified range
4085HThe output results of (S) and (N) in read application instruction exceed the device range
4086HThe output result of (D) in write application instruction exceeds the device range

Example

07-1 Basic instructions_html_ff5ab9afced99509.png

 When M0 is set, the value of D0 to D4 is set to 0.

07-1 Basic instructions_html_95f9fe70e9adcf29.png

DFMOV/ 32-bit multicast

DFMOV(P)

Transfer the BIN 32-bit data of the device specified in (S1) to the device specified in (D) at (N) points (that is, transfer the same data to multiple addresses).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)Transfer data or start device storing transfer data-2147483648 to 2147483647Signed BIN32ANY32_S
(D)Start device of transfer destination-Signed BIN32ANY32_S
(N)Number of transfers[1≤ N ≤512]Signed BIN32ANY32_S

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DFMOVParameter 1
Parameter 2     
Parameter 3  

Features

The same data as the BIN 32-bit data of the device specified in (S) is transferred to the device specified in (D) at (N) points.

07-1 Basic instructions_html_f3f9cd2e9dfe1cfe.png

When the number specified in (N) exceeds the device number range, transfer is performed within the allowable range.

When a constant (K) is specified for the transmission source (S), it will be automatically converted to BIN.

Error code

Error codeContent
4084H(S) and (N) input the data In application instruction exceed the specified range
4085HThe output results of (S) and (N) in read application instruction exceed the device range
4086HThe output result of (D) in write application instruction exceeds the device range

Example

07-1 Basic instructions_html_a390e21753dc736e.png

When M0 is set, the value of (D1, D0), (D3, D2), (D5, D4), (D7, D6), (D9, D8) is set to 0.

SMOV/Bit shift

SMOV(P)

A instruction for distributing and synthesizing data in units of digits (4 bits).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The word device number that stores the data whose bit is to be moved Signed BIN16ANY16_S
(N1)Transfer destination device number1 to 4Signed BIN16ANY16_S
(N2)The number of digits to move1 to 4Signed BIN16ANY16_S
(D)The word device number that stores data for bit shifting Signed BIN16ANY16_S
(N3)The starting position of the moving target1 to 4Signed BIN16ANY16_S

Device used

InstructionParameterDevicesOffset modification

Pulse extension

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

Features

The data is distributed/combined in units of digits (4 bits). The contents of the transmission source (S) and the transmission destination (D) are converted into 4-digit BCD (0000 to 9999), and the (N1) bits are transferred to the lower (N2) bits and the (N3) bits of the transmission destination (D) (combined ) After reaching the starting position, it is converted to BIN and stored in the transfer destination (D).

When the instruction input is OFF, the transfer destination (D) does not change.

When the instruction input is ON, the data of the transmission source (S) and the number of digits other than the transmission specification of the transmission destination (D) do not change.

Perform BIN→BCD conversion on (S).

Transfer (synthesize) the (N1)th bit to the lower (N2), (D), (N3)th bit to the (N2)th bit counted from the previous. (D), the first and fourth digits start from (S), and the transmission will not be affected.

Convert the synthesized data (BCD) into BIN and store it in (D).

07-1 Basic instructions_html_34ee545d4d67eedb.gif

Extended function

If the SMOV instruction is executed after SM168 is turned ON, the BIN→BCD conversion will not be performed. The bit shift is performed in 4-bit units.

Error code

Error codeContent
4084H(N1), (N2) and (N3) input data that exceed the specified range in the application instruction or does not satisfy the relationship of N2≤N1 and N2≤N3.
4085HThe output result of (S), (N1) (N2), (D) and (N3) in the read application instruction exceeds the device range
4086HThe output result of (D) in write application instructions exceeds the device range

Example

After synthesizing the data of the 3-digit digital switch, it is stored in D2 in binary.

07-1 Basic instructions_html_813e30f89d5a26b3.png

Combine data of 3 digital switches connected to non-continuous input terminals.

07-1 Basic instructions_html_313402f5a5ed68ac.png

When M0 is set,

(X020 to X027) BCD 2 digits → D 2 (binary);

(X000 to X003) BCD 1 digit → D 1 (binary);

Store the 1 digit of D1 into the 3 digit of D2, and synthesize a 3-digit value.

CML/16-bit invert transmission

CML(P)  

After the BIN 16-bit data specified in (S) is inverted bit by bit, the result is transferred to the device specified in (D).

-[CML (S) (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)Inverted data or the device number that stores data-32768 to 32767Signed BIN16ANY16_S
(D)The device number that stores the inversion result-Signed BIN16ANY16_S

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
CMLParameter 1
Parameter 2   

Features

After inverting the BIN 16-bit data specified in (S) bit by bit, the result is transferred to the device specified in (D).

07-1 Basic instructions_html_ac6a8a5d1cd98a7.png

When the number of digits of the device with the specified digit is 4 points, other digits are not affected.

Error code

Error codeContent
4085HThe output result of (S) in read application instruction exceeds the device range
4086HThe output result of (D) in write application instruction exceeds the device range

Example

Example 1:

07-1 Basic instructions_html_1747c114427d7d5a.png

When M0 is set, the value of D0 is inverted and transferred to the value of D2.

Example 2:

invert input acquisition:

07-1 Basic instructions_html_11af96bca5fab94f.png

DCML/32-bit invert transmission

DCML(P)

After the BIN 32-bit data specified in (s) is inverted bit by bit, the result is transferred to the device specified in (d).

-[CML (s) (d)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s)Inverted data or the device number that stores data-2147483648 to 2147483647Signed BIN32ANY32_S
(d)The device number that stores the inversion result-Signed BIN32ANY32_S

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKHE[D]XXP
DCMLParameter 1 
Parameter 2    

Features

After inverting the BIN 32-bit data specified in (s) bit by bit, the result is transferred to the device specified in (d).

07-1 Basic instructions_html_7f6b1b324c7b408b.png

When the number of digits of the device with the specified digit is 4 points, other digits are not affected.

Error code

Error codeContent
4085HThe output result of (s) in read application instruction exceeds the device range
4086HThe output result of (d) in write application instruction exceeds the device range

Example

07-1 Basic instructions_html_10734f3934cb4211.png

When M0 is set, the value of (D1, D0) is reversed and transferred to the value of (D3, D2).

CMP/16-bit data comparison output

CMP(P)

Compare the BIN 16-bit data of the device specified in (s1) and (s2).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Comparison value data or the device storing the comparison value data-32768 to +32767Signed BIN16ANY16_S
(S2)Comparison source data or the device storing the comparison source data-32768 to 32767Signed BIN16ANY16_S
(D)Start bit device for output comparison result BitANYBIT_ARRAY

Device used

InstructionParameterDevicesOffset modification

Pulse extension

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

Features

Compare the BIN 16-bit data of the device specified in (S1) with the BIN 16-bit data of the device specified in (S2). According to the result (less than, consistent, greater than), (D), (D)+1, (D) One of )+2 will turn ON.

(S1) and (S2) are handled as BIN values within the above setting data range.

Use algebraic methods for size comparison.

07-1 Basic instructions_html_d5b466b2989a168c.png

(1): Even if the instruction input is OFF and the CMP instruction is not executed, (D) to (D)+2 will keep the state before the instruction input changed from ON to OFF.

Note:  Occupy the device specified in 3 points (D) at the beginning, please be careful not to overlap with the device used for other control.

Error code

Error codeContent
4085HThe output results of (S1) and (S2) in read application instruction exceed the device range
4086HThe output result of (D) in write application instruction exceeds the device range

Example

07-1 Basic instructions_html_3f1803378f8b10a8.png

When M0 is set, compare the values of D0 and D2:

If (D0)> (D2) then Y0 is ON.

If (D0) = (D2) then Y1 is ON. If (D0) <(D2) then Y2 is ON.

DCMP/32-bit data comparison output

DCMP(P)

Compare the BIN 32-bit data of the device specified in (S1) and (S2).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Comparison value data or the device storing the comparison value data-2147483648 to 2147483647Signed BIN32ANY32_S
(S2)Comparison source data or the device storing the comparison source data-2147483648 to 2147483647Signed BIN32ANY32_S
(D)Start bit device for output comparison result BitANYBIT_ARRAY

Device used

InstructionParameterDevicesOffset modification

Pulse extension

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

Features

• Compare the BIN 16-bit data of the device specified in (S1) with the BIN 16-bit data of the device specified in (S2). According to the result (less than, consistent, greater than), (D), (D)+1, (D) One of )+2 will turn ON.

• (S1) and (S2) are handled as BIN values within the above setting data range.

• Use algebraic methods for size comparison.

07-1 Basic instructions_html_d5b466b2989a168c.png

(1): Even if the instruction input is OFF, the DCMP instruction is not executed, (D) to (D)+2 will keep the state before the instruction input changed from ON to OFF.

Note:  Occupy the device specified in 3 points (D) at the beginning. Please be careful not to overlap with other control devices.

Error code

Error codeContent
4085HThe output results of (S1) and (S2) in read application instruction exceed the device range
4086HThe output result of (D) in write application instruction exceeds the device range

Example

07-1 Basic instructions_html_db9a9675057311a.png

When M0 is set, compare the values of (D1, D0) and (D3, D2):

If (D1, D0)> (D3, D2) then Y0 is ON.

If (D1, D0) = (D3, D2) then Y1 is ON.

If (D1, D0) <(D3, D2) then Y2 is ON.

XCH/16-bit data exchange

XCH(P)

Exchange the BIN 16-bit data of (D1) and (D2).

-[XCH (D1) (D2)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D1)The start device that stores the exchange data-32768 to 32767Signed BIN16ANY16_S
(D2)The start device that stores the exchange data-32768 to 32767Signed BIN16ANY16_S

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnYKnMKnSTCDRSD[D]XXP
XCHParameter 1
Parameter 2

Features

• Exchange the BIN 16-bit data of (D1) and (D2).

07-1 Basic instructions_html_da762df21d9f9e95.png

• When executing instructions with SM160 ON, if the device numbers of (D1) and (D2) are the same. Exchange the upper 8 bits (byte) and lower 8 bits (byte) of the word device.

07-1 Basic instructions_html_c0cea7cfb5b2e83c.png

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

Error code

Error codeContent
4084HIn exchange mode, the devices in (D1) and (D2) are different
4085HThe output results of (D1) and (D2) in the read application instruction exceed the device range
4086HThe output results of (D1) and (D2) in the writing application instruction exceed the device range

Example

When M0 is reset, set M1: the value of D0 and the value of D2 are exchanged.

07-1 Basic instructions_html_379b08fc9ff53251.png

When M0 is set, M1 is set: the upper 8 bits (bytes) and lower 8 bits (bytes) of D0 are exchanged with each other.

07-1 Basic instructions_html_3642e474e8c61a0f.png

DXCH/32-bit data exchange

DXCH(P)

Exchange (D1) and (D2) BIN 32-bit data.

-[DXCH (D1) (D2)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D1)The start device that stores the exchange data-2147483647 to 2147483647Signed BIN32ANY32_S
(D2)The start device that stores the exchange data-2147483647 to 2147483647Signed BIN32ANY32_S

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnYKnMKnSTCDRSDLCHSC[D]XXP
DXCHParameter 1
Parameter 2

Features

• Exchange the BIN 32-bit data of (D1), (D1)+1 and (D2), (D2)+1.

07-1 Basic instructions_html_3e35d534c210d03a.png

• When executing instructions with SM160 ON, if the device numbers of (D1) and (D2) are the same. Exchange the upper 8 bits (byte) and lower 8 bits (byte) of the word device (D1) and (D1+1).

07-1 Basic instructions_html_f115854aba0c26e.png

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

Error code

Error codeContent
4084HIn exchange mode, the devices in (D1) and (D2) are different
4085HThe output results of (D1) and (D2) in the read application instruction exceed the device range
4086HThe output results of (D1) and (D2) in the writing application instruction exceed the device range

Example :

When M0 is set, M1 is set: the high 8 bits (byte) and low 8 bits (byte) of the D0 Devices are exchanged, and the high 8 bits (byte) and low 8 bits (byte) of the D1 Devices ) Exchange each other.

07-1 Basic instructions_html_4e345d7e7c986d10.png

When M0 is reset, set M1: the value of (D1, D0) and the value of (D3, D2) are exchanged.

07-1 Basic instructions_html_9fff2f30b51cfc7f.png

ZCP/16-bit data interval comparison

ZCP(P)

Compare the BIN 16-bit data of the device specified in (S1) and the value (bandwidth) of the BIN 16-bit data of the device specified in (S2) with the BIN 16-bit data of the device specified in the comparison source (S3), Output the result (bottom, area, top) to the device specified in (D) and later.

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)The comparison value data of low limit or the device that stores the comparison value data-32768 to 32767Signed BIN16ANY16_S
(S2)The comparison value data of high limit or the device that stores the comparison value data-32768 to 32767Signed BIN16ANY16_S
(S3)Comparison source data or the device that stores the comparison source data-32768 to 32767Signed BIN16ANY16_S
(D)The start bit device of output comparison result BitANYBIT_ARRAY

Device used

InstructionParameterDevicesOffset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDKHE[D]XXP
ZCPParameter 1     
Parameter 2     
Parameter 3     
Parameter 4             

Features

• Compare the BIN 16-bit data of the device specified in (S1) and the value (bandwidth) of the BIN 16-bit data of the device specified in (S2) with the BIN 16-bit data of the device specified in the comparison source (S3) , According to the result (bottom, area, top), one of (D), (D)+1, (D)+2 will be turned ON. (S1), (S2), (S3) are treated as BIN values within the above-mentioned setting data range. Use algebraic methods for size comparison.

• Use algebraic methods for size comparison.

07-1 Basic instructions_html_878004f8efa838b.gif

(1): Even if the instruction input is OFF and the ZCP instruction is not executed, (D) to (D)+2 will keep the state before the instruction input turns from ON to OFF.

Note: 

• Please set the lower comparison value (S1) to a value smaller than the upper comparison value (S2).

• When (s1) is greater than (S2), it will be processed as (S2)=(S1).

• The device specified in 3 points (d) is occupied at the beginning. Please be careful not to overlap with other control devices.

Error code

Error codeContent
4085HThe output results of (S1), (S2) and (S3) in the read application instruction exceed the device range
4086HThe output result of (D) in write application instructions exceeds the device range

Example

07-1 Basic instructions_html_db2bc281a152807e.png

When M0 is set, compare whether D0 is between 0 and 1000:

If (D0)> (1000), then Y0 is ON.

If (0) ≤ (D0) ≤ (1000), then Y1 is ON.

If (D0) <(0), then Y2 is ON.

DZCP/32-bit data interval comparison

DZCP(P)

Compare the BIN 32-bit data of the device specified in (S1) and the value (bandwidth) of the BIN 32-bit data of the device specified in (S2) with the BIN 32-bit data of the device specified in the comparison source (S3), Output the result (bottom, area, top) to the device specified in (D) and later.

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)The comparison value data of low limit or the device that stores the comparison value data-2147483648 to 2147483647Signed BIN32ANY32_S
(S2)The comparison value data of high limit or the device that stores the comparison value data-2147483648 to 2147483647Signed BIN32ANY32_S
(S3)Comparison source data or the device that stores the comparison source data-2147483648 to 2147483647Signed BIN32ANY32_S
(D)The start bit device of output comparison result BitANYBIT_ARRAY

Device used

InstructionParameterDevicesOffset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDLCHSCKHE[D]XXP
DZCPParameter 1     
Parameter 2     
Parameter 3     
Parameter 4               

Features

• Compare the BIN 32-bit data of the device specified in (S1) and the value (bandwidth) of the BIN 32-bit data of the device specified in (S2) with the BIN 32-bit data of the device specified in the comparison source (S3) , According to the result (bottom, area, top), one of (D), (D)+1, (D)+2 will be turned ON. (S1), (S2), (S3) are treated as BIN values within the above-mentioned setting data range. Use algebraic methods for size comparison.

• Use algebraic methods for size comparison.

07-1 Basic instructions_html_878004f8efa838b.gif

(1): Even if the instruction input is OFF and the ZCP instruction is not executed, (D) to (D)+2 will keep the state before the instruction input turns from ON to OFF.

Note: 

• Please set the lower comparison value (S1) to a value smaller than the upper comparison value (S2).

• When (S1) is greater than (S2), it will be processed as (S2)=(S1).

• The device specified in 3 points (D) is occupied at the beginning. Please be careful not to overlap with other control devices.

Error code

Error codeContent
4085HThe output results of (S1), (S2) and (S3) in the read application instruction exceed the device range
4086HThe output results of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_a215dc073ae34e2c.png

When M0 is set, compare D0 with whether it is between 0 and 100000:

If (D0)> (100000), then Y0 is ON.

If (0) ≤ (D0) ≤ (100000), then Y1 is ON.

If (D0) <(0), then Y2 is ON.

Cycle shift instruction

ROR/16-bit cycle shift right

ROR(P)

Shift the 16-bit data of the device specified in (D) to the right by (N) bits without including the carry flag.

-[ROR (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The device start number for cycle shift right-Signed BIN 16 bitANY16
(N)The number of times to cycle shift right0 to 15Signed BIN 16 bitANY16

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
RORParameter 1   
Parameter 2

Features

・The 16-bit data of the device specified in (D) is shifted right by (N) bits without including the carry flag. The carry flag is in the ON or OFF state according to the state before the ROR(P) is executed.

07-1 Basic instructions_html_211c81ae87a63ccc.gif

(N) Specifies 0 to 15. When a value of 16 or more is specified in (N), the remainder value of (N)÷16 is shifted to the right. For example, when (N)=18, 18÷16=1 and the remainder is 2, so a 2-bit right shift is performed.

Related device

DeviceNameContent
SM151CarryIt turns ON when the last bit shifted from the lowest is 1.

Note: 

Do not set the number of digits (N) shifted right to a negative value.

In the case of continuous execution type instructions (ROR, RCR), the right shift will be executed every scan time (operation cycle), so be careful.

When specifying the number of digits to specify the device in (D), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).

Error code

Error codeContent
4084HA negative value is specified in (N).
4085HThe output results of (D) and (N) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_3f35914868d0e9df.png

Shift the 1 in the D0 device by 3 bits to the right to get 8192.

DROR/32-bit cycle shift right

DROR(P)

Shift the 32-bit data of the device specified in (D) to the right by (N) bits without including the carry flag.

-[DROR (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The device start number for cycle shift right-Signed BIN 32 bitANY32
(N)The number of times to cycle shift right0 to 31Signed BIN 32 bitANY32

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DRORParameter 1   
Parameter 2

Features

・The 32-bit data of the device specified in (D) is shifted right by (N) bits without including the carry flag. The carry flag is on or off according to the state before DROR(P) is executed.

07-1 Basic instructions_html_782300af1d1cbbc6.gif

(N) Specifies 0 to 31. When a value of 32 or more is specified in (N), the remainder of (N)÷32 is shifted to the right. For example, when (N)=34, 34÷32=1 and the remainder is 2, so a 2-bit right shift is performed.

Related device

DeviceNameContent
SM151CarryIt turns ON when the last bit shifted from the lowest is 1.

Note: 

Do not set the number of digits (N) shifted right to a negative value.

In the case of continuous execution type instructions (ROR, RCR), the right shift will be executed every scan time (operation cycle), so be careful. When specifying the number of digits to specify the device in (D), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).

Error code

Error codeContent
4084HA negative value is specified in (N).
4085HThe output results of (D) and (N) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

After the rising edge of M1 is triggered, the value 32 of the D0 device is shifted right by 3 bits to get 4.

Example

07-1 Basic instructions_html_50ea116e0a4110c.png

RCR/16-bit cycle shift right with carry

RCR(P)

Shift the 16-bit data of the device specified in (D) to the right by (N) bits with the carry flag included.

-[RCR (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The device start number for cycle shift right-Signed BIN 16 bitANY16
(N)The number of times to cycle shift right0 to 15Signed BIN 16 bitANY16

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
RCRParameter 1   
Parameter 2

Features

Shift the BIN 16-bit data of the device specified in (D) to the right by (N) bits with the carry flag included. The carry flag is on or off according to the state before the RCR(P) is executed.

07-1 Basic instructions_html_892489cd33fef35e.gif

(N) Specifies 0 to 15. When a value of 16 or more is specified in (N), the remainder value of (N)÷16 is shifted to the right. For example, when (N)=18, 18÷16=1 and the remainder is 2, so a 2-bit right shift is performed.

Related device

DeviceNameContent
SM151CarryIt turns ON when the last bit shifted from the lowest is 1.

Note: 

Do not set the number of digits (N) shifted right to a negative value.

In the case of continuous execution type instructions (ROR, RCR), the right shift will be executed every scan time (operation cycle), so be careful.

When specifying the number of digits to specify the device in (D), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).

Error code

Error codeContent
4084HA negative value is specified in (N)
4085HThe output results of (D) and (N) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_d84a8536f60ce54a.png

After the rising edge of M0 is triggered, the carry flag SM151 turns ON, and D0 is assigned the value 1. When M1=ON, the value in the D0 device is shifted right by 4 bits to get 12288.

DRCR/32-bit cycle shift right with carry

DRCR(P)

Shift the 32-bit data of the device specified in (D) to the right by (N) bits with the carry flag included.

-[DRCR (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The device start number for cycle shift right-Signed BIN 32 bitANY32
(N)The number of times to cycle shift right0 to 31Signed BIN 32 bitANY32

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DRCRParameter 1   
Parameter 2

Features

・The BIN 32-bit data of the device specified in (D) is shifted right by (N) bits with the carry flag included. The carry flag is in the ON or OFF state according to the state before DRCR(P) is executed.

07-1 Basic instructions_html_f31c6b7fdef32870.gif

(N) Specifies 0 to 31. When a value of 32 or more is specified in (N), the remainder value of (N)÷32 is shifted to the right. For example, when (N)=34, 34÷32=1 and the remainder is 2, so a 2-bit right shift is performed.

Related device

DevicesNameContent
SM151CarryIt turns ON when the last bit shifted from the lowest is 1.

Note: 

Do not set the number of bits (N) to turn right to a negative value.

In the case of continuous execution type instructions (DROR, DRCR), the right shift will be executed every scan time (operation cycle), so be careful. When specifying the number of digits to specify the device in (D), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).

Error code

Error codeContent
4084HA negative value is specified in (N).
4085HThe output results of (D) and (N) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

After the rising edge of M0 is triggered, the carry flag SM151 turns ON, and D0 is assigned the value 1. When M1=ON, the value in the D0 device is shifted right by 20 bits to get 12288.

07-1 Basic instructions_html_1fa431776b980f3.png

ROL/16-bit cycle shift left

ROL(P)

Shift the 16-bit data of the device specified in (D) to the left by (N) bits without including the carry flag.

-[ROL (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The device start number for cycle shift left-Signed BIN 16 bitANY16
(N)The number of times to cycle shift left0 to 15Signed BIN 16 bitANY16

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
ROLParameter 1   
Parameter 2

Features

・The 16-bit data of the device specified in (D) is shifted to the left by (N) bits without including the carry flag. The carry flag is in the ON or OFF state according to the state before ROL(P) is executed.

07-1 Basic instructions_html_5368402e0b2f8d39.gif

(N) Specify 0 to 15. When a value of 16 or more is specified in (N), the remainder value of (N)÷16 is shifted to the left. For example, when (N)=18, 18÷16=1 and the remainder is 2, so a 2-bit left shift is performed.

Related device

DeviceNameContent
SM151CarryIt turns ON when the last bit shifted from the highest is 1.

Note: 

Do not set the number of digits (N) shifted to the left to a negative value. In the case of continuous execution type instructions (ROL, RCL), the shift to the left will be executed every scan time (operation cycle), so be careful. When specifying the number of digits to specify the device in (D), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).

Error code

Error codeContent
4084HA negative value is specified in (N).
4085HThe output results of (D) and (N) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

07-1 Basic instructions_html_89015ce664980431.png

Example

Shift 1 in the D0 device to the left by 3 bits to get 8.

DROL/32-bit cycle shift left

DROL(P)

Shift the 32-bit data of the device specified in (D) to the left by (N) bits without including the carry flag.

-[DROL (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The device start number for cycle shift left-Signed BIN 32 bitANY32
(N)The number of times to cycle shift left0 to 31Signed BIN 32 bitANY32

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DROLParameter 1   
Parameter 2

Features

・The 32-bit data of the device specified in (D) is shifted left by (N) bits without including the carry flag. The carry flag is on or off according to the state before DROL(P) is executed.

07-1 Basic instructions_html_74bd4947729181d8.gif

(N) Specifies 0 to 31. When a value of 32 or more is specified in (N), the remainder of (N)÷32 is shifted to the left. For example, when (N)=34, 34÷32=1 and the remainder is 2, so a 2-bit left shift is performed.

Related device

DeviceNameContent
SM151CarryIt turns ON when the last bit shifted from the highest is 1.

Note: 

Do not set the number of digits (N) shifted to the left to a negative value.

In the case of continuous execution type instructions (ROL, RCL), the shift to the left will be executed every scan time (operation cycle), so be careful. When specifying the number of digits to specify the device in (D), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).

Error code

Error codeContent
4084HA negative value is specified in (N).
4085HThe output results of (D) and (N) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_de83e097b4c3b47e.png

Shift 1 in the D0 device to the left by 3 bits to get 8.

RCL/16-bit cycle shift left with carry

RCL(P)

Shift the 16-bit data of the device specified in (D) to the left by (N) bits with the carry flag included.

-[RCL (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The device start number for cycle shift left-Signed BIN 16 bitANY16
(N)The number of times to cycle shift left0 to 15Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
RCLParameter 1   
Parameter 2

Features

・The 16-bit data of the device specified in (D) is shifted (N) to the left with the carry flag included. The carry flag is on or off according to the state before RCL(P) is executed.

07-1 Basic instructions_html_1892ed00695d575b.gif

(N) Specifies 0 to 15. When a value of 16 or more is specified in (N), the remainder value of (N)÷16 is shifted to the left. For example, when (N)=18, 18÷16=1 and the remainder is 2, so a 2-bit left shift is performed.

Related device

DeviceNameContent
SM151CarryIt turns ON when the last bit shifted from the highest is 1.

Note: 

Do not set the number of digits (N) shifted to the left to a negative value. In the case of continuous execution type instructions (ROL, RCL), the shift to the left will be executed every scan time (operation cycle), so be careful. When specifying the number of digits to specify the device in (D), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).

Error code

Error codeContent
4084HA negative value is specified in (N).
4085HThe output results of (D) and (N) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_d67374659afd2d4c.png

After the rising edge of M0 is triggered, the carry flag SM151 turns ON, and D0 is assigned the value 1.

When M1=ON, move the value in the D0 device with carry to the left by 4 bits to get 24.

DRCL/32-bit cycle shift left with carry

DRCL(P)

Move the 32-bit data of the device specified in (D) to the left by (N) bits with the carry flag included.

-[DRCL (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The device start number for cycle shift left-Signed BIN 32 bitANY32
(N)The number of times to cycle shift left0 to 31Signed BIN 32 bitANY32

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DRCLParameter 1   
Parameter 2

Features

The 32-bit data of the device specified in (D) is shifted (N) to the left with the carry flag included. The carry flag is on or off according to the state before RCL(P) is executed.

07-1 Basic instructions_html_7d7d803db3bbba9e.gif

(N) Specifies 0 to 31. When a value of 32 or more is specified in (N), the remainder of (N)÷32 is shifted to the left. For example, when (N)=34, 34÷32=1 and the remainder is 2, so a 2-bit left shift is performed.

Related device

DevicesNameContent
SM151CarryTurns ON when the last bit shifted from the highest is 1.

Note: 

Do not set the number of digits (N) shifted to the left to a negative value. In the case of continuous execution type instructions (ROL, RCL), the shift to the left will be executed every scan time (operation cycle), so be careful. When specifying the number of digits to specify the device in (D), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).

Error code

Error codeContent
4084HA negative value is specified in (N).
4085HThe output results of (D) and (N) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_8c7837da92e4e984.png

After the rising edge of M0 is triggered, the carry flag SM151 turns ON, and D0 is assigned the value 1. When M1=ON, carry the value in the D0 device to the left by 4 bits to get 24.

SFTR/n-bit shift right of n-bit data

SFTR(P)

Shift (N2) the data of the start (N1) bits of the device specified in (D) to the right.

-[SFTR (S) (D) (N1) (N2)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start number of the device storing the shifted data after shifting-BitANY_BOOL
(D)The shifted device start number-BitANY_BOOL
(N1)The length of shifted data0 to 32767Signed BIN 16 bitANY16
(N2)Number of shifts0 to 32767Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

XYMSSMD.bKnXKnYKnMKnSTCDRSDKH[D]XXP
SFTRParameter 1           
Parameter 2            
Parameter 3      
 Parameter 4      

Features

Shift (N2) the data of the start (N1) bits of the device specified in (D) to the right. After shifting, the point (N2) starting from (S) is transferred to the point (N2) starting from (D) + (N1 to N2).

When K0 is specified in (S), the bit of the (D) + (N1 to N2) starting point (N2) after the shift is set to 0.

When K1 is specified in (S), the bit of the (D) + (N1 to N2) starting point (N2) after the shift is set to 1.

07-1 Basic instructions_html_778995c9037fe76c.png

 (1): When (S)=K0, it becomes 0.

Error code

Error codeContent
4084HWhen the value specified in (N1) and (N2) exceeds the range of 0 to 32767
When the value specified in (N1) and (N2) is (N1)<(N2)
4085HWhen the device specified in read application instructions (S), (D), (N1) and (N2) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

For N1=9 bits (the length of the shift register) data starting with M0, right shift N2=3 bits. After shifting, transfer N2=3 bits from Y0 to N2=3 bits from M6.

07-1 Basic instructions_html_85a1e316f5176368.png

07-1 Basic instructions_html_9e770240b084beb6.png

SFTL/n-bit shift left of n-bit data

SFTL(P)

Shift the start (N1) bit data of the device specified in (D) to the left by (N2) bits.

-[SFTL (S) (D) (N1) (N2)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start number of the device storing shifted data after shifting-BitANY_BOOL
(D)The shifted device start number-BitANY_BOOL
(N1)The length of shifted data0 to 32767Signed BIN 16 bitANY16
(N2)Number of shifts0 to 32767Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

XYMSSMD.bKnXKnYKnMKnSTCDRSDKH[D]XXP
SFTLParameter 1           
Parameter 2            
Parameter 3      
 Parameter 4      

Features

Shift (N2) bits of the data at the beginning (N1) bits of the device specified in (D). After shifting, the point (N2) starting from (S) is transferred to the point (N2) starting from (D) + (N1 to N2).

When K0 is specified in (S), the bit of the (D) + (N1 to N2) starting point (N2) after the shift is set to 0.

When K1 is specified in (S), the bit of the (D) + (N1 to N2) starting point (N2) after the shift is set to 1.

07-1 Basic instructions_html_2452b20d324148ed.png

(1): When (S)=K0, it becomes 0.

Error code

Error codeContent
4084HWhen the value specified in (N1) and (N2) exceeds the range of 0 to 32767
When the value specified in (N1) and (N2) is (N1)<(N2)
4085HWhen the device specified in read application instructions (S), (D), (N1) and (N2) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

Example 1:

07-1 Basic instructions_html_61b990c421d1a4a7.gif

Example 2:

07-1 Basic instructions_html_bd3ff3ff98e5f38b.gif

WSFR/n-word shift right of n-word data

WSFR(P)

Shift (N2) the data of the start (N1) bits of the device specified in (D) to the right.

-[WSFR (S) (D) (N1) (N2)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start number of the device storing shifted data after shifting-wordANY_BOOL
(D)The shifted device start number-wordANY_BOOL
(N1)The length of shifted data0 to 32767Signed BIN 16 bitANY16
(N2)Number of shifts0 to 32767Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
SFTRParameter 1
Parameter 2   
Parameter 3
 Parameter 4

Features

Shift (N2) the data of the beginning (N1) word of the device specified in (D) to the right. After shifting, the point (N2) starting from (S) is transferred to the point (N2) starting from (D) + (N1 to N2).

When K is specified in (S), the device at (D) + (N1 to N2) starting (N2) point after shifting is set to the specified value.

If the value specified in (N1) or (N2) is 0, it will be no processing.

07-1 Basic instructions_html_186497250d881d1e.png

Error code

Error codeContent
4084HWhen the value specified in (N1) and (N2) exceeds the range of 0 to 32767
When the value specified in (N1) and (N2) is (N1)<(N2)
When (S) and (D) both specify KnM, KnX, and KnS, the value of n varies.
4085HWhen the device specified in read application instructions (S), (D), (N1) and (N2) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

(S) and (D) specify the same multiple in the digit specified device. This program realizes to shift Y0 to Y7 bits right, shift Y10 to Y17 right to Y0 to Y7, and then store X0 to X7 to Y10 to Y17.

07-1 Basic instructions_html_f99e795f9d56f9e7.png

07-1 Basic instructions_html_f7dcb25bd25f0722.png

WSFL/n-word shift left of n-word data

WSFL(P)

Shift the start (N1) bit data of the device specified in (D) to the left by (N2) bits.

-[WSFL (S) (D) (N1) (N2)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The start number of the device storing shifted data after shifting-WordANY_BOOL
(D)The shifted device start number-WordANY_BOOL
(N1)The length of shifted data0 to 32767Signed BIN 16 bitANY16
(N2)Number of shifts0 to 32767Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
SFTRParameter 1
Parameter 2   
Parameter 3
 Parameter 4

Features

Shift (N2) the data of the beginning (N1) word of the device specified in (D) to the left. After shifting, transfer the point (N2) starting from (S) to the point (N2) starting from (D).

When K is specified in (S), the device at (D) + (N1 to N2) starting (N2) point after shifting is set to the specified value.

If the value specified in (N1) or (N2) is 0, it will be no processing.

07-1 Basic instructions_html_a509153078ca2436.png

Error Code

Error codeContent
4084HWhen the value specified in (N1) and (N2) exceeds the range of 0 to 32767
When the value specified in (N1) and (N2) is (N1)<(N2)
When (S) and (D) both specify KnM, KnX, and KnS, the value of n varies.
4085HWhen the device specified in read application instructions (S), (D), (N1) and (N2) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

(S), (D) Do the same multiple specification in the digit specification device. This program realizes to remove the high bits of Y10 to Y17 left, move Y0 to Y7 left to Y10 to Y17, and then store X0 to X7 to Y0 to Y7.

07-1 Basic instructions_html_a4e71d25b50b076.png

07-1 Basic instructions_html_4e6d2d500872e021.png

SFR/n-bit shift right of 16-bit data

SFR(P)

Shift the 16-bit data of the device specified in (D) right by (N) bits.

-[SFR (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The start number of the device storing the shifted data-Signed BIN 16 bitANY16
(N)Number of shifts0-15Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
SFRParameter 1   
Parameter 2

Features

When (N)=6

Shift the 16-bit data of the device specified in (D) to the right (N) bits from the highest bit. The (N) bit from the most significant bit will become 0.

07-1 Basic instructions_html_5bdb37dbc5728fee.png

When (N)=6

When a bit device is specified in (d), the device range specified in the digit specification is shifted to the right.

07-1 Basic instructions_html_96855867e2605ca6.png

(N) Specifies 0 to 15. When a value of 16 or more is specified in (N), the remainder of (N)÷16 is shifted to the left. For example, when (N)=18, 18÷16=1 and the remainder 2, so it is shifted by 2 bits to the right.

Related device&nbsp;

DeviceNameContent
SM151CarrySet to ON/OFF according to the state of N-1 bit (1/0)

Error code

Error codeContent
4084HA negative value is specified in (N).
4085HThe output results of (D) and (N) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

When M1 is ON, the contents of Y10 to Y23 are shifted to the right by the number of digits specified in D0.

07-1 Basic instructions_html_b494c5db2a53883.png

07-1 Basic instructions_html_a308a0cf2c4950c1.png

DSFR/n word data shift right by 1 word

DSFR(P)

Shift the data at the start (N) point of the device specified in (D) to the right by 1 word.

-[DSFR (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The start number of the device storing the shifted data-Signed BIN 16 bitANY16
(N)Number of shifts0 to 32767Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
DSFRParameter 1   
Parameter 2

Features

• Shift the data at the start (N) point of the device specified in (D) by 1 word to the right.

07-1 Basic instructions_html_9b4706f3a93a923d.png

• The device specified in (D)+(N-1) will become 0.

Note:  In (D), when specifying the device number by specifying the number of bits of the bit device, the device number should be a multiple of 16 (0, 16, 32, 64...), and only K4 should be specified for the number of bits. When the number of bits is not K4, K4 is used for processing.

Error code

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

Example

When M1 is ON, shift the contents of D0 to D4 to the right by 1 word (D1→D0, D2→D1, D3→D2, D4→D3, D4 is set to 0).

07-1 Basic instructions_html_5004760ff8588365.png

Before execution:

07-1 Basic instructions_html_1eb1609e763f4148.png

After execution:

07-1 Basic instructions_html_5216051d84602b3b.png

SFL/n-bit shift left of 16-bit data

SFL(P)

Shift the 16-bit data of the device specified in (D) to the left by (N) bits.

-[SFL (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The start number of the device storing the shifted data-Signed BIN 16 bitANY16
(N)Number of shifts0 to 15Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
SFLParameter 1   
Parameter 2

Features

Shift the 16-bit data of the device specified in (D) to the left (N) bits from the lowest bit. The (N) bit from the lowest bit will become 0.

07-1 Basic instructions_html_951616bfba57e18e.png

When (N)=8, it is as follows.

When a bit device is specified in (D), the left shift is performed in the device range specified in the digit specification.

07-1 Basic instructions_html_eae27c0dbdbe62d5.png

When (N)=3, it is as follows.

(N) Specify 0 to 15. When a value of 16 or more is specified in (N), the remainder of (N)÷16 is shifted to the left. For example, when (N)=18, 18÷16=1 remainder 2, so it is shifted by 2 bits to the left.

Related device&nbsp;

DeviceNameContent
SM151CarryTurn ON/OFF according to the state of N+1 bit (1/0)

Error code

Error codeContent
4084HA negative value is specified in (N).
4085HThe output results of (D) and (N) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

When M1 is ON, the contents of Y10 to Y17 are shifted to the left by the number of digits specified in D0.

07-1 Basic instructions_html_7691a6d01a769c9.png

07-1 Basic instructions_html_33c23e6059974f03.png

DSFL/one word shift left of n word data

DSFL(P)

Move the data at the beginning (N) point of the device specified in (D) by 1 word to the left.

-[DSFL (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The start number of the device storing the shifted data-Signed BIN 16 bitANY16
(N)Number of shifts0 to 32,767Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
DSFLParameter 1   
Parameter 2

Features

Shift the data at the start (N) point of the device specified in (D) to the left by 1 word.

07-1 Basic instructions_html_241c4b63f7501375.png

The device specified in (D) will become 0.

Note:  In (D), when specifying the device number by specifying the number of bits of the bit device, the device number should be a multiple of 16 (0, 16, 32, 64...), and only K4 should be specified for the number of bits. When the number of bits is not K4, K4 is used for processing.

Error code

Error codeContent
4084HWhen the value specified in (N) exceeds the range of 0 to 32,767
4085HThe output results of (D) and (N) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

When M1 is ON, shift the contents of D0 to D4 to the left by 1 word (D3→D4, D2→D3, D1→D2, D0→D1, D0 is set to 0).

07-1 Basic instructions_html_cadd6fc71e7fe42a.png

Before execution:

07-1 Basic instructions_html_5ac57ffad96aebb3.png

After execution:

07-1 Basic instructions_html_228be72e17120f3b.png

Arithmetic operation instructions

ADD/16-bit addition operation

ADD(P)

Add the BIN 16-bit data specified in (S1) and the BIN 16-bit data specified in (S2), and store the result in the device specified in (D).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Addition operation data or the device storing the addition data-32768 to 32767Signed BIN16ANY16_S
(S2)Addition operation data or the device storing the addition data-32768 to 32767Signed BIN16ANY16_S
(D)Device for storing operation results Signed BIN16ANY16_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
ADDParameter 1
Parameter 2
Parameter 3   

Features

Add the BIN 16-bit data specified in (S1) and the BIN 16-bit data specified in (S2), and store the result of the addition in the device specified in (D).

07-1 Basic instructions_html_8e14b2921161f2d9.png

Related device&nbsp;

DevicesNameContent
SM151CarryWhen the operation result exceeds 32,767, the carry flag will be (ON).
SM152BorrowWhen the operation result is less than -32,768, the borrow flag will be (ON).
SM153Zero pointWhen the operation result is 0, the zero flag will be (ON).

07-1 Basic instructions_html_f7e7b9fa9918e937.png

Note:  

1.When the source operand and destination operand are specified as the same device:

The source operand and destination operand can also be specified as the same device number.

In this case, if you use continuous execution instructions (ADD, DADD), the result of the addition operation will change every operation cycle.

2.The difference between the ADD instruction and the INC instruction using the +1 addition operation program:

ADD[P] means that every time X001 changes from OFF to ON, the content of D0 is added by one operation.

Although this instruction is very similar to the INCP instruction described later, there are some differences in the following content.

 ADD/ADDP/DADD/DADDP instructionsINC/INCP/DINC/DINCP instructions
Flag bit (zero, borrow, carry)ActionNo action
Calculation result

16-bit

operation result

(S) + (+1) = (D)32767 → 0 → +1 → +2 →32767→-32768→-32767
(S) + (-1) = (D)← -2 ← -1 ← 0 ← -32768——

32-bit

operation result

(S) + (+1) = (D)2147483647 → 0 → +1 → +2 →2147483647 → -2147483648→ -2147483647
(S) + (-1) = (D)← -2 ← -1 ← 0 ← -2147483648——

Error code

Error codeContent
4085HThe output results of (S1) and (S2) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_c88107d9dc85e273.png

Add 10 to the data in (D0), and store the operation result in (D2), that is, (D0) + 10 → (D2).

DADD/32-bit addition operation

DADD(P)

Add the BIN32-bit data specified in (S1) and the BIN32-bit data specified in (S2), and store the result in the device specified in (D).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Addition data or the device storing the addition data-2147483648 to 2147483647Signed BIN32ANY32_S
(S2)Addition data or the device storing the addition data-2147483648 to 2147483647Signed BIN32ANY32_S
(D)Device for storing operation results Signed BIN32ANY32_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DADDParameter 1
Parameter 2
Parameter 3     

Features

Add the BIN32-bit data specified in (s1) and the BIN32-bit data specified in (s2), and store the result of the addition in the device specified in (d).

07-1 Basic instructions_html_97cb91594c5ae7e4.png

Related device&nbsp;

DevicesNameContent
SM151CarryWhen the operation result exceeds 32,767, the carry flag will be (ON).
SM152BorrowWhen the operation result is less than -32,768, the borrow flag will be (ON).
SM153Zero pointWhen the operation result is 0, the zero flag will be (ON).

07-1 Basic instructions_html_1e2ca6723b868fb4.png

Note: 

1. When the source operand and destination operand are specified as the same device:

The source operand and destination operand can also be specified as the same device number.

In this case, if you use continuous execution instructions (ADD, DADD), the result of the addition operation will change every operation cycle. Please note.

2. The difference between the ADD instruction and the INC instruction using the +1 addition operation program:

ADD[P] means that every time X001 changes from OFF to ON, the content of D0 is added by one operation.

Although this instruction is very similar to the INCP instruction described later, there are some differences in the following content.

 ADD/ADDP/DADD/DADDP instructionsINC/INCP/DINC/DINCP instructions
Flag bit (zero, borrow, carry)ActionNo action
Calculation result

16-bit

Operation result

(S) + (+1) = (d)32767→0→+1→+2→32767→-32768→-32767
(S) + (-1) = (d)←-2←-1←0←-32768——

33-Bit

operation result

(S) + (+1) = (d)2147483647→0→+1→+2→2147483647→-2147483648→-2147483647
(S) + (-1) = (d)←-2←-1←0←-2147483648——

Error code

Error codeContent
4085HThe output results of (S1) and (S2) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_de63c4a952dfb6d.png

Add 100000 to the data in (D1, D0), and store the result of the operation in (D3, D2), that is, (D1, D0) + 100000 → (D3, D2).

SUB/16-bit subtraction operation

SUB(P)

Subtract the BIN 16-bit data specified in (S1) and the BIN 16-bit data specified in (S2), and store the result in the device specified in (D).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)The subtraction data or the device storing the subtraction data-32768 to 32767Signed BIN16ANY16_S
(S2)The subtraction data or the device storing the subtraction data-32768 to 32767Signed BIN16ANY16_S
(D)Device for storing calculation results Signed BIN16ANY16_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
SUBParameter 1
Parameter 2
Parameter 3   

Features

Subtract the BIN 16-bit data specified in (S1) and the BIN 16-bit data specified in (S2), and store the result of the operation in the device specified in (D).

07-1 Basic instructions_html_cbd3a6fd4cb00b65.png

Related device&nbsp;

DevicesNameContent
SM151CarryWhen the operation result exceeds 32,767, the carry flag will be (ON).
SM152BorrowWhen the operation result is less than -32,768, the borrow flag will be (ON).
SM153Zero pointWhen the operation result is 0, the zero flag will be (ON).

07-1 Basic instructions_html_ac1f8acda3746b1d.png

Note: 

1. When the source operand and destination operand are specified as the same device:

The source operand and destination operand can also be specified as the same device number.

In this case, if continuous execution type instructions (SUB, DSUB) are used, the result of the subtraction operation will change every operation cycle. Please be careful.

2. The difference between the SUB(P) instruction and the -(P) instruction and DEC(P) instruction executed by the -1 subtraction program

SUB(P) instruction every time X1 changes from OFF to ON, the program of D0 content -1 is similar to -(P) instruction and DEC(P) instruction described later, but the following contents are different.

 SUB/SUBP/DSUB/DSUBP instructionsDEC/DECP/DDEC/DDECP instructions
Flag bit (zero, borrow, carry)ActionNo action
Calculation result16-bit operation result(S)-(+1)=(D)←-2←-1←0←-32768-32768→+32767→32766
(S)-(-1)=(D)+32767→0→+1→+2→——
32-bit operation result(S)-(+1)=(D)←-2←-1←0←-2147483648-2147483648→2147483647→2147483646
(S)-(-1)=(D)2147483647→0→+1→+2→——

Error code

Error codeContent
4085HThe output results of (S1) and (S2) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_bda57d807670bde2.png

Subtract 10 from the data in D0, and store the calculation result in D2, that is, (D0)-10 → (D2).

DSUB/32-bit subtraction operation

DSUB(P)

Subtract the BIN32-bit data specified in (S1) and the BIN32-bit data specified in (S2), and store the result in the device specified in (D).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)The subtraction data or the device storing the subtraction data-2147483648 to 2147483647Signed BIN32ANY32_S
(S2)The subtraction data or the device storing the subtraction data-2147483648 to 2147483647Signed BIN32ANY32_S
(D)Device for storing calculation results Signed BIN32ANY32_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DSUBParameter 1
Parameter 2
Parameter 3   

Features

Subtract the BIN32-bit data specified in (S1) and the BIN32-bit data specified in (S2), and store the result of the operation in the device specified in (D).

07-1 Basic instructions_html_f37d57bb2a3d8fad.png

Related device

DevicesNameContent
SM151CarryWhen the operation result exceeds 2,147,483,647, the carry flag will be ON.
SM152BorrowWhen the operation result is less than -2,147,483,648, the borrow flag will be ON.
SM153Zero pointWhen the operation result is 0, the zero flag will be ON.

07-1 Basic instructions_html_f61b250c2dec5a2c.png

Note: 

1. When the source operand and destination operand are specified as the same device:

The source operand and destination operand can also be specified as the same device number.

In this case, if continuous execution type instructions (SUB, DSUB) are used, the result of the subtraction operation will change every operation cycle. Please be careful.

2. The difference between the SUB(P) instruction and the -(P) instruction and DEC(P) instruction executed by the -1 subtraction program

SUB(P) instruction every time X1 changes from OFF to ON, the program of D0 content -1 is similar to -(P) instruction and DEC(P) instruction described later, but the following contents are different.

 SUB/SUBP/DSUB/DSUBP instructionsDEC/DECP/DDEC/DDECP instructions
Flag bit (zero, borrow, carry)ActionNo action
Calculation result16-bit operation result(S)-(+1)=(D)←-2←-1←0←-32768-32768→32767→32766
(S)-(-1)=(D)+32767→0→+1→+2→——
32-bit operation result(S)-(+1)=(D)←-2←-1←0←-2147483648-2147483648→2147483647→2147483646
(S)-(-1)=(D)+2147483647→0→+1→+2→——

Error code

Error codeContent
4085HThe output results of (S1) and (S2) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_e0a9b7ee38c72d67.png

Subtract 100000 from the data in (D1,D0), and store the result of the operation in (D3,D2), that is, (D1,D0)-10000 → (D3,D2).

MUL/16-bit multiplication

MUL(P)

Multiply the BIN16 bits specified in (S1) with the BIN16 bits specified in (S2), and store the result in the device specified in (D).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Multiplication operation data or the device storing multiplication operation data-32768 to 32767Signed BIN 16 bitANY16_S
(S2)Multiplication operation data or the device storing multiplication operation data-32768 to 32767Signed BIN 16 bitANY16_S
(D)Device for storing calculation results Signed BIN 32 bitANY32_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
MULParameter 1  
Parameter 2  
Parameter 3   

Features

Multiply the BIN 16-bit data specified in (S1) with the BIN 16-bit data specified in (S2), and store the result of the operation in the device specified in (D).

07-1 Basic instructions_html_7bc795b98291521f.png

(D) is the multiplication result in the case of bit device

• K1: lower 4 bits (B0 to B3)

• K4: Lower 16 bits (B0 to B15)

• K8: Lower 32 bits (B0 to B31)

Error code

Error codeContent
4085HThe output results of (S1) and (S2) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_a72970708460f454.png

Multiply the data in (D0) by (D2), and store the operation result in (D5, D4), that is, (D0) × (D2) → (D5, D4).

DMUL/32-bit multiplication

DMUL(P)

Multiply the 32-bit BIN specified in (S1) and the 32-bit BIN specified in (S2), and store the result in the device specified in (D).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Multiplication operation data or device storing multiplication operation data-2147483648 to 2147483647Signed BIN 32 bitANY32_S
(S2)Multiplication operation data or device storing multiplication operation data-2147483648 to 2147483647Signed BIN 32 bitANY32_S
(D)Device for storing calculation results Signed BIN64 bitANY64_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DMULParameter 1
Parameter 2
Parameter 3   

Features

Multiply the BIN32-bit data specified in (S1) and the BIN32-bit data specified in (S2), and store the result of the operation in the device specified in (D).

07-1 Basic instructions_html_1d28943293a84978.png

(D) is the multiplication result in the case of bit device

• K1: lower 4 bits (B0 to B3)

• K4: Lower 16 bits (B0 to B15)

• K8: Lower 32 bits (B0 to B31)

Error code

Error codeContent
4085HThe output results of (S1) and (S2) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_d0ed498dee1bbd2b.png

Multiply the data in (D1, D0) by (D3, D2), and store the result of the operation in ((D7, D6), (D5, D4)), ie (D1, D0) × (D3, D2) → ((D7, D6), (D5, D4)).

DIV/16-bit division operation

DIV(P)

Divide the BIN 16-bit data specified in (S1) with the BIN 16-bit data specified in (S2), and store the result in the device specified in (D).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Division operation data or device storing division operation data-32768 to 32767Signed BIN 16 bitANY16_S
(S2)Division operation data or device storing division operation data-32768 to 32767Signed BIN 16 bitANY16_S
(D)Device for storing calculation results Signed BIN 32 bitANY32_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DIVParameter 1  
Parameter 2  
Parameter 3   

Features

Divide the BIN 16-bit data specified in (S1) with the BIN 16-bit data specified in (S2), and store the result of the operation in the device specified in (D).

07-1 Basic instructions_html_5b6a7b9968539f80.png

In the case of a word device, the division result uses a 32-bit storage quotient and remainder, and in the case of a bit device, only a 16-bit storage quotient is used.

• Quotient is stored in the lower 16 bits.

• The remainder is stored in the upper 16 bits. (Can only be stored in the case of word devices.)

Note

1. About the opearation result

• The highest bit of the quotient and remainder represents the sign of positive (0) and negative (1).

• When one of (S1) or (S2) is negative, the quotient becomes negative. When (S1) is negative, the remainder becomes negative.

2. The device specified by (D)

• With the digit specification function, when specifying a bit device, the remainder cannot be obtained.

Error code

Error codeContent
4080HThe input of divisor (S2) is 0
4085HThe output results of (S1) and (S2) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_7966aef8d2143e29.png

Divide the data in (D0) by (D2), and store the result of the calculation: the quotient is stored in (D4), and the remainder is stored in (D5), ie (D0)/ (D2) → (D5(quotient)) (D4( remainder)).

DDIV/32-bit division operation

DDIV(P)

Divide the BIN32-bit data specified in (S1) with the BIN32-bit data specified in (S2), and store the result in the device specified in (D).

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Division operation data or device storing division operation data-2147483648 to 2147483647Signed BIN 32 bitANY32_S
(S2)Division operation data or device storing division operation data-2147483648 to 2147483647Signed BIN 32 bitANY32_S
(D)Device for storing calculation results Signed BIN64 bitANY64_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DDIVParameter 1
Parameter 2
Parameter 3   

Features

Divide the BIN32-bit data specified in (S1) with the BIN32-bit data specified in (S2), and store the result of the operation in the device specified in (D).

07-1 Basic instructions_html_1b1dca7a3fa22e30.png

In the case of word devices, the division result uses BIN64 bits to store the quotient and remainder. In the case of bit devices, only the BIN 32-bit storage quotient is used.

Note: 

1. About the operation result

• The highest bit of the quotient and remainder represents the sign of positive (0) and negative (1).

• When one of (S1) or (S2) is negative, the quotient becomes negative. When (S1) is negative, the remainder becomes negative.

2. The specified device of (D)

• With the digit specification function, when a bit device is specified, the remainder cannot be obtained.

Error code

Error codeContent
4080HThe input of divisor (S2) is 0
4085HThe output results of (S1) and (S2) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_21e85706527efeba.png

Divide the data in (D1, D0) by (D3, D2), and store the result of the calculation: the quotient is stored in (D5, D4), and the remainder is stored in (D7, D6), that is (D1, D0)/ (D3, D2) → (D5, D4) (quotient) (D7, D6) (remainder).

INC/16-bit data increment

INC(P)

Add one to the device (BIN 16-bit data) specified in (D).

-[INC (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The word device number that stores the data added by one-32768 to 32767Signed BIN 16 bitANY16_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnYKnMKnSTCDRSD[D]XXP
INCParameter 1

Features

Add one to the device (BIN 16-bit data) specified in (D).

07-1 Basic instructions_html_f35c36e39c08072.png

• If the INC(P) instruction is executed when the content of the device specified in (D) is 32767, -32768 will be stored in the device specified in (D).

• Flags (zero, borrow, carry) do not perform actions.

Note:  If the continuous execution (INC) instruction is used, the addition operation will be performed every operation cycle, so care should be taken.

Error code

Error codeContent
4085HThe output results of (D) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_4fe585ed449771bf.png

Add one to the device value specified in D0, that is, (D0) + 1 → (D0).

DINC/32-bit data increment

DINC(P)

Add one to the device (BIN 32-bit data) specified in (D).

-[DINC (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The word device number that stores the data added by one-2147483648 to 2147493647Signed BIN 32 bitANY32_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnYKnMKnSTCDRSDLCHSC[D]XXP
DINCParameter 1

Features

Add one to the device (BIN 32-bit data) specified in (D).

07-1 Basic instructions_html_7d13add7bbac367d.png

• When the DINC(P) instruction is executed when the content of the device specified in (D) is 2147483647, -2147483648 will be stored in the device specified in (D).

• Flags (zero, borrow, carry) do not perform actions.

Note:  If the continuous execution (INC) instruction is used, the addition operation will be performed every operation cycle, so care should be taken.

Error code

Error codeContent
4085HThe output results of (D) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_9288e451278259f.png

Add one to the device value specified in (D1, D0), that is, (D1, D0) + 1 → (D1, D0).

DEC/16 bit data decrement

DEC(P)

Minus one for the device (BIN 16-bit data) specified in (D).

-[DEC (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The word device number that stores the data minus by one-32768 to 32767Signed BIN 16 bitANY16_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnYKnMKnSTCDRSD[D]XXP
DECParameter 1

Features

Minus one for the device (BIN 16-bit data) specified in (D).

07-1 Basic instructions_html_df1a004773f12e76.png

• If the DEC(P) instruction is executed when the content of the device specified in (D) is -32768, 32767 will be stored in the device specified in (D).

• Flags (zero, borrow, carry) do not perform actions.

Note:  If using continuous execution (DEC) instructions, subtraction will be performed every operation cycle, so care should be taken.

Error code

Error codeContent
4085HThe output results of (D) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_ebee4e241b873490.png

Each time M0 is set, the value of the device specified in D0 will be -1, (D0)-1 → (D0).

DDEC/32-bit data decrement

DDEC(P)

Minus one for the device (BIN 32-bit data) specified in (D).

-[DDEC (D)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)The word device number that stores the data minus by one-2147483648 to 2147483647Signed BIN 32 bitANY32_S

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnYKnMKnSTCDRSDLCHSC[D]XXP
DDECParameter 1

Features

Minus one for the device (BIN 32-bit data) specified in (D).

07-1 Basic instructions_html_7d13add7bbac367d.png

If the DDEC(P) instruction is executed when the content of the device specified in (D) is 0, minus one will be stored in the device specified in (D).

• Flags (zero, borrow, carry) do not perform actions.

Note:  If using continuous execution (DEC) instructions, subtraction will be performed every operation cycle.

Error code

Error codeContent
4085HThe output results of (D) in the read application instruction exceed the device range
4086HThe output result of (D) in the write application instruction exceeds the device range

Example

07-1 Basic instructions_html_2f77792f36a8d549.png

Minus one on the device value specified in (D1, D0), that is, (D1, D0)-1 → (D0).