07 Convenient instructions

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

ABSD/BIN 16-bit data absolute method

ABSD

Create multiple output modes corresponding to the current counter (BIN 16-bit value).

-[ABSD (S1) (S2) (D) (N)]

Content, range and data type

Parameter RangeData typeData type (label)
(S1)

The start device number storing the data tableContent

(rising edge point and falling edge point)

-Signed BIN 16 bitANY16
(S2)The counter number used for monitoring of the current value compared to the data table-Signed BIN 16 bitANY16
(D)The number of points of the output start device-BitANY16_BOOL
(N)Number of table rows and output bit device points1 to 64Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDKH[D]XXP
ABSDParameter 1        
Parameter 2                
Parameter 3            
Parameter 4      

Features

Take the turntable to rotate 1 revolution (0 to 360 degrees) to control the output ON/OFF as an example. (1 degree, 1 pulse angle signal)

Compare the data table of row (N) starting from (S1) (row (N) multiply by 2 points) with the current value of the counter (S2), from (D) to continuous (N) in the course of one revolution The output is ON/OFF control up to the point.

07-3 Basic instructions_html_f3445e45f259d300.gif

Use the transfer instruction to write the following data into (S1) to (S1)+2(N)-1 in advance. For example, the rising edge point data stores 16-bit data to even-numbered devices in advance, and the falling edge point data stores 16-bit data to odd-numbered devices in advance.

Rising edge pointFalling edge pointObject output
-Data value (example)-Data value (example)
(S1)40(S1)+1140(D)
(S1)+2100(S1) +3200(D) +1
(S1) +4160(S1) +560(D) +2
(S1) +6240(S1) +7280(D) +3
...-...-...
(S1)+2(N)-2(S1)+2(N)-1(D) +N-1

If the instruction input is set to ON, (D) is the start, (N) point is the output mode as shown below. Each rising edge point and falling edge point can be individually changed by rewriting the data from (S1) to (S1)+2(N)-1.

07-3 Basic instructions_html_40a97945575e913d.png

Note: 

When specifying the number of bit devices in (S1), the device number should be a multiple of 16 (0, 16, 32, 64...), and only K4 should be specified for the number of bits.

The number of target output points is determined by the value of (N). (1≤(N)≤64)

Even if the instruction input is turned off, the output does not change.

Error code

Error codeContent
4084HWhen the value specified in (N) exceeds the range of 1 to 64
4085HWhen the device specified in the read application instruction (S1), (S2 )and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

Refer to the example in the function description.

DABSD/BIN 32-bit data absolute method

DABSD

Create multiple output modes corresponding to the current counter (BIN 32-bit value).

-[DABSD (S1) (S2) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)

The start device number storing the data table

(rising edge point and falling edge point)

-Signed BIN 32 bitANY32
(S2)The counter number used for monitoring of the current value compared to the data table-Signed BIN 32 bitANY32
(D)The number of points of the output start device-BitANY16_BOOL
(N)Number of table rows and output bit device points1 to 64Signed BIN 32 bitANY32

Device used

InstructionParameterDevicesOffset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DABSDParameter 1        
Parameter 2                
Parameter 3              
Parameter 4      

Features

Take the turntable to rotate 1 revolution (0 to 360 degrees) to control the output ON/OFF as an example. (1 degree, 1 pulse angle signal)

Compare the data table of row (N) starting from (S1) (row (N) × 4 points) with the current value of the counter (S2), from (D) to continuous (N) in the course of one revolution The output is ON/OFF control up to the point.

07-3 Basic instructions_html_a1942137c71d3fd0.gif

Use the transfer instruction to write the following data into (S1), (S1)+1 to (S1)+4(N)-2, (S1)+4(N)-1 in advance. For example, the rising edge point data stores 32-bit data to even-numbered devices in advance, and the falling edge point data stores 32-bit data to odd-numbered devices in advance.

Rising edge pointFalling edge pointObject output
-Data value (example)-Data value (example)
(S1)+1, (S1)40(S1)+3, (S1)+2140(D)
(S1)+5, (S1)+4100(S1) +7, (S1) +6200(D) +1
(S1) +9, (S1) +8160(S1)+11, (S1)+1060(D) +2
(S1) +13, (S1) +12240(S1) +15, (S1) +14280(D) +3
...-...-...

(S1)+4(N)-3,

(S1)+4(N)-4

(S1)+4(N)-1,

(S1)+4(N)-2

(D) +N-1

If the instruction input is set to ON, (D) is the start, (NN) point is the output mode as shown below. Each rising edge point and falling edge point can be individually changed by rewriting the data from (S1) to (S1)+2(N)-1.

07-3 Basic instructions_html_14c5b0b965b99aa8.png

Note:  The high-speed counter can be specified in the DABSD instruction. When a high-speed counter is specified, the current value of the counter will have a response delay due to the scan cycle in the output mode.

When specifying the number of bit devices in (S1), the device number should be a multiple of 16 (0, 16, 32, 64...), and only K8 should be specified for the number of bits.

The number of target output points is determined by the value of (N). (1≤(N)≤64)

Even if the instruction input is turned off, the output does not change.

Error code

Error codeContent
4084HWhen the value specified in (N) exceeds the range of 1 to 64
4085HWhen the device specified in the read application instruction (S1), (S2 )and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

Refer to the example in the function description.

SER/16-bit data search

SER(P)

Search the same data and the maximum and minimum values from the data table.

-[SER (S1) (S2) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Search for the start device number of the same data, maximum value, and minimum value-Signed BIN 16 bitANY16
(S2)Search for the value of the same data or its storage destination device number-Signed BIN 16 bitANY16
(D)Search for the same data, maximum value, minimum value and store the start device number-Signed BIN 16 bitANY16
(N)Search the number of same data, maximum and minimum1 to 256Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
SERParameter 1  
Parameter 2● ● 
Parameter 3   
 Parameter 4

Features

For (S1) as the first (N) data, search for the same data as the BIN 16-bit data of (S2), and store the result in (D) to (D)+4.

In the case of the same data, the number of the same data, the first/final position, and the maximum and minimum positions of the same data are stored in the device with the first 5 points (D).

If there is no identical data, the number of identical data, the first/final position, and the maximum and minimum positions of the same data are stored in the device with the first 5 points (D). However, in (D) is the first 3 points of the device (the number of the same data, the first \\ final position), 0 is stored.

• The structure and data examples of the search result table are as follows. (N=10)

The searched device (s1)

The value of the searched data (s1)

Comparison data (S2) value

Data locationsearch results
Maximum value (d) +4Consistent (d)Minimum value (d+3)
(s1)K100K1000 ○(First time) 
(s1)+1K1111   
(s1)+2K1002  
(s1) +3K983   
(s1) +4K1234   
(s1) +5K665  
(s1) +6K1006 ○ (final) 
(s1) +7K957   
(s1) +82108  
(s1) +9K889   

• The search result table based on the above example is shown below.

Device numberContentSearch result items
(d)3Number of identical data
(d) +10The position of the same data (first time)
(d) +26The position of the same data (last time)
(d) +35The final position of the minimum
(d) +48The final position of maximum

Note:  Perform algebraic size comparison. (-10<2)

When there are multiple minimum and maximum values in the data, the positions behind each are stored.

If driven by this instruction , the search result (d) occupies 5 points of (d), (d)+1, (d)+2, (d)+3, (d)+4. Be careful not to overlap with the device used for machine control.

Error code

Error codeContent
4084HWhen the value specified in (N) exceeds the range of 0 to 256
4085HWhen the device specified in read application instruction (S1), (S2), (D) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

Refer to the example in the function description.

DSER/32-bit data search

DSER(P)

Search the same data and the maximum and minimum values from the data table.

-[DSER (S1) (S2) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Search for the start device number of the same data, maximum value, and minimum value-Signed BIN 32 bitANY32
(S2)Search for the value of the same data or its storage destination device number-Signed BIN 32 bitANY32
(D)Search for the same data, maximum value, minimum value and store the start device number-Signed BIN 32 bitANY32
(N)Search the number of same data, maximum and minimum1 to 128Signed BIN 32 bitANY32

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DSERParameter 1  
Parameter 2
Parameter 3   
 Parameter 4

Features

For (S1)+1, (S1) as the initial (N) data, search for the same data as the BIN 32-bit data of (S2)+1, (S2), and store the result in (D)+1, (D) to (D) +9, (D) +8.

In the case of the same data, the number of the same data, the first/final position and the maximum and minimum values are stored in a 5-point BIN 32-bit data device starting with (D)+1 and (D) position.

In the case of no identical data, the number of identical data, the first/final position and the maximum and minimum values are stored in the device with (D)+1 and (D) as the starting BIN 32-bit data with 5 points position. However, 0 is stored in the 32-bit 3-point device (the number of the same data, the first\\last position) with (D)+1 and (D) as the starting BIN.

• The structure and data examples of the search result table are as follows. (N=10)

The searched device (S1)The value of the searched data (S1)Comparison data (S2) valueData locationsearch results
Maximum value (d) +4Consistent (d)Minimum value (d+3)
(S1)+1, (S1)K100K1000 ○ (First time) 
(S1)+3, (S1)+2K1111   
(S1)+5, (S1)+4K1002  
(S1) +7, (S1) +6K983   
(S1) +9, (S1) +8K1234   
(S1)+11, (S1)+10K665  
(S1) +13, (S1) +12K1006 ○ (final) 
(S1) +15, (S1) +14K957   
(S1) +17, (S1) +162108  
(S1) +19, (S1) +18K889   

• The search result table based on the above example is shown below.

Device numberContentSearch result items
(d)+1, (d)3Number of identical data
(d)+3, (d)+20The position of the same data (first time)
(d) +5, (d) +46The position of the same data (last time)
(d) +7, (d) +65The final position of the minimum
(d) +9, (d) +88The final position of maximum

Note:  Perform algebraic size comparison. (-10<2)

When there are multiple minimum and maximum values in the data, the positions behind each are stored.

If driven by this instruction , the search result (d) occupies [(d)+1, (d)], [(d)+3, (d)+2,], [(d)+5, (d)+ 4], [(d)+7, (d)+6], [(d)+9, (d)+8] 5 points. Be careful not to overlap with the device used for machine control.

Error code

Error codeContent
4084HWhen the value specified in (N) exceeds the range of 0 to 128
4085HWhen the device specified in read application instruction (S1), (S2), (D) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

Refer to the example in the function description.

ALT/Bit device output inversion

ALT(P)

If the input turns ON, the bit device is inverted (ON→OFF).

-[ALT (d)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(d)Alternate output device number-BitANY16_BOOL

Device used

InstructionParameterDevices

Offset modification

Pulse extension

YMSSMD.b[D]XXP
ALTParameter 1

Features

Alternating output (level 1)

Each time the instruction input changes from OFF→ON, the bit device specified in (d) is turned OFF→ON inverted.

07-3 Basic instructions_html_64d6b43aae907fc6.png

07-3 Basic instructions_html_47cb55e016f3f842.png

Divided frequency output (through alternate output (2 levels))

Combine multiple ALTP instructions to perform frequency division output.

07-3 Basic instructions_html_2bd7efa01abfeb7f.png

07-3 Basic instructions_html_6ad85407517ccc5d.png

Note: If you program with the ALT instruction, the action will be reversed every operation cycle. To reverse the action by the instruction ON→OFF, use the ALT instruction (pulse execution type) or set the instruction contact to LDP (pulse execution type).

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

(1) Start/stop via an input.

      1) After pressing the button X4, start the action of output Y1 and stop the action of Y0.

      2) After pressing the button X4 again, stop the action of output Y1 and start the action of Y0.

07-3 Basic instructions_html_5d556de47da4d7b8.png

(1) Flashing action

      1) When input X6 is ON, the contact of timer T2 will act instantaneously every 5 seconds.

      2) The contact of T2 makes the output Y7 alternately ON/OFF every time it is ON.

07-3 Basic instructions_html_8f95b199c8d317c0.png

07-3 Basic instructions_html_1508064e50616736.png

INCD/BIN 16-bit data relative method

INCD

Use a pair of counters to create multiple output modes.

-[INCD (S1) (S2) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)The start device number storing the set value-Signed BIN 16 bitANY16
(S2)The start number of counter for current value monitoring-Signed BIN 16 bitANY16
(D)The start bit device number of output-BitANY16_BOOL
(N)Number of output bit device points1 to 64Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDKH[D]XXP
INCDParameter 1        
Parameter 2                
Parameter 3            
Parameter 4      

Features

Compare the data table of row (N) starting from (S1) (row (N) × 2 points occupied) with the current value of the counter (S2), reset if they match, and control the output on/off in turn.

Example

The operation is explained by the following circuit example. (S2) Take up 2 points. C0 and C1 are equivalent to this in the following timing chart.

07-3 Basic instructions_html_b25fa01ec61c4289.png

• It is assumed that the following data is written using the transfer instruction in advance.

Storage deviceOutput
-Data value (example)-Example
(S1)D300=20(D)M0
(S1)+1D301=30(D) +1M1
(S1)+2D302=10(D) +2M2
(S1) +3D303=40(D) +3M3
.............
(S1)+(N)-1-(D) +N-1-

Timing diagram

image-20220609110509-3.png

If the instruction contact turns on, the M0 output turns on.

The output (M0) is reset when the current value of C0 reaches the comparison value D300, the count value of the process counter C1 is +1, and the current value of the counter C0 is also reset.

The next output M1 turns ON.

Compare the current value of C0 with the comparison value D301. When the comparison value is reached, the output M1 is reset, the count value of the process counter C1 is +1, and the current value of the counter C0 is also reset.

Compare the same to the point (K4) specified in (N). (1≤(N)≤64)

After the final process specified in (N) is completed, the execution end flag SM229 turns ON for 1 operation cycle. SM229 is the instruction execution end flag used in multiple instructions, so it should be used as a contact after the instruction to execute the end flag dedicated to the instruction.

Return to the beginning and repeat output.

Note: In (S1), when specifying the device number by specifying the digits of the bit device, the device number should be a multiple of 16 (0, 16, 32, 64...).

Up to 4 INCD instructions can be driven simultaneously in the program.

Error code

Error codeContent
4084HWhen the value specified in (N) exceeds the range of 1 to 64
4085HWhen the device specified in read application instruction (S1), (S2), (D) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (S2) and (D) exceeds the corresponding device range
4089HThe number of instruction drives exceeds the limit.

Example

Refer to the example in the function description.

RAMP/Control ramp signal

RAM(P)

Obtain data that changes between the start (initial value) and end (target value) two values specified (N) times.

-[RAMP (S1) (S2) (D) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)The device number that stores the initial value of the set ramp-Signed BIN 16 bitANY16
(S2)The device number that stores the set ramp target value-Signed BIN 16 bitANY16
(D)The device number that stores the current value data of ramp-Signed BIN 16 bitANY16
(N)Ramp transition time (scan period)1-32767Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

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

Features

Specify the start value (S1) and the value to end (S2) in advance. If the instruction input is turned ON, the value divided by the number of times specified in (N) will be added to (S1) in sequence in each operation cycle The value of is stored in (D). This instruction and analog output can be combined to output soft start/stop instructions.

07-3 Basic instructions_html_1b8169d8b0bd8e2a.gif

(D)+1 stores the number of scans (0→N times).

The time from the start to the end value requires operation cycle×(N) scan.

If the input instruction is turned OFF during operation, it will be in the execution interrupt state ((D): current value data retention. (D)+1 scan times clear), if it is turned ON again, (D) will be cleared (S1) Restart the action.

After the transition is completed, the instruction execution completed flag SM229 will act, and the value of (D) will return to the value of (S1).

07-3 Basic instructions_html_fbf2fef521f03150.gif

In the case of obtaining the calculation result at a certain time interval (constant scan mode), write the specified scan time to SD120 (a value slightly longer than the actual scan time), and turn on SM120. For example, when the value is specified as 20 ms and N=100 times, the value of (D) changes from (S1) to (S2) in 2 seconds.

The value of the constant scan mode can also be set by the parameter setting of the engineering tool (the constant scan execution interval setting of the CPU parameter).

According to the ON/OFF action of the mode flag SM226, the content of (D) is changed as shown below.

image-20220609111455-4.png

Note:  When the power failure retention device (retention area) is specified in (D), the instruction input remains ON. When the CPU module is set to RUN (start), clear (D) in advance.

Error code

Error codeContent
4084HWhen the value specified in (N) exceeds the specified range of 1 to 32767
4085HWhen the device specified in read application instruction (S1), (S2), (D) and (N) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (D) exceeds the corresponding device range

Example

07-3 Basic instructions_html_e073826c2adb9e18.png

As in the above procedure, turn SM120 ON, and the program will run with a constant scan cycle (the value in SD120 is 10ms). When M0=ON, it changes from 10 to 100 within 100×10ms.

ROTC/Rotary table proximity control

ROTC

In order to take out the items on the rotating table, take out the window according to the requirements, and make the rotating table rotate nearby.

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S)The specified register of the calling condition (pre-set according to the transfer instruction)(s)+0: Register for counting-Signed BIN 16 bitANY16
(s)+1: Call the window number setting
(s)+2: Call the item number setting
(N1)Number of divisions2 to 32767Signed BIN 16 bitANY16
(N2)Singular in low speed zone0 to 32767Signed BIN 16 bitANY16
(D)The specified bit of the calling condition (constitutes an internal contact circuit driven in advance from the input signal (X))(d): phase A signal-Signed BIN 16 bitANY16
(d)+1: phase B signal
(d)+2: zero point detection signal
(d)+3: high-speed forward rotation
(d)+4: low speed forward rotation
(d)+5: stop
(d)+6: low speed reverse rotation
(d)+7: high-speed reverse rotation

Device used

InstructionParameterDevices

Offset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDKH[D]XXP
ROTCParameter 1              
Parameter 2      
Parameter 3      
Parameter 4            

Features

In order to take out the items on the rotating table divided into N1 (=10) as shown in the figure below, take out the inserted window as required, and rotate the rotating table nearby under the condition of N2 or (S), (D) . If the following operating conditions are specified, (D)+3 to (D)+7 can be used for forward/reverse, high-speed/low-speed/stop output.

07-3 Basic instructions_html_925a71dc503c1b56.gif

Set up the switch X2 that is used to detect the two-phase shape (X0, X1) of the forward/reverse rotation of the rotary table and window 0. Replace X0 to X2 with (d) to (d) +2 internal contacts. The start device number specified in X or (d) can be arbitrary.

07-3 Basic instructions_html_ead11fbdee314230.png

(S) is a counter, which counts how many items come to window 0.

(S)+1 set the number of the window to be called.

(S)+2 sets the number of the recalled item.

Specify the number of divisions (N1) and low-speed operation section (N2) of the rotary table.

Note:  If the instruction input is turned ON to drive the instruction, the result of (D)+3 to (D)+7 will be automatically obtained. If the instruction input is turned off, (D)+3 to (D)+7 will turn off.

As an example, when the rotation detection signal ((D) to (D)+2) is set to 10 actions within 1 division interval, the division number setting, calling window number setting, and article number setting should all be 10 Times the value. In this way, the setting value of the low-speed section can be set to the middle value of the number of divisions, etc.

When the instruction input is ON and the 0 point detection signal (M2) is turned ON, the content of the counting register (S) is cleared to 0. It is necessary to perform this clear operation in advance before starting operation.

ROTC instructions can drive up to 4.

Error code

Error codeContent
4084HWhen the value specified in (N1) exceeds the range of 2 to 32767
When the value specified in (N2) exceeds the range of 0 to 32767
When the values specified in (N1) and (N2) meet the condition of (N1)<(N2)
When one of (S), (S)+1 and (S)+2 is negative.
When one of (S), (S)+1 and (S)+2 is (N1) or more.
4085HWhen the device specified in read application instruction (S1), (N1), (N2) and (D) exceeds the corresponding device range
4086HWhen the device specified in the write application instruction (S2) and (D) exceeds the corresponding device range
4089HThe number of instruction drives exceeds the limit.

Example

&nbsp; &nbsp;&nbsp;

VariableFeaturesInstructions
D200Used as a counting registerThe 3 units are pre-set by the user program
D201Call window number setting
D202Call work piece number setting
M0Phase A signal07-3 Basic instructions_html_b05232b20c72516e.png The user program executes before each scan of this statement:
M1Phase B signal
M2Zero point detection signal
M3High speed forward rotate

When X0 is ON, the result of M3 to M7 could be automatically obtained.

When X0 is OFF, M3 to M7 are all OFF.

M4Low speed forward rotate
M5Stop
M6Low speed reverse rotate
M7High spped reverse rotate

STMR/Special function timer

STMR

Use the 4 points starting from the device specified in (D) to perform 4 types of timer output.

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

Content, range and data type

ParameterContentRangeData typeData type (label)
(S1)Timer number used: T0 to T511 (100ms timer)-Device NameANY16
(S2)Timer setting value1-32767Signed BIN 16 bitANY16
(D)The start bit number of the output (occupies 4 points)-BitANYBIT_ARRAY

Device used

InstructionParameterDevices

Offset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDKHE[D]XXP
STMRParameter 1                 
Parameter 2       
Parameter 3             

Features

Use the 4 points starting from the device specified in (d) to perform 4 types of timer output.

07-3 Basic instructions_html_1b67e302600b7119.png

  1. STMR instruction instruction
  2. The setting value specified in (S2)

07-3 Basic instructions_html_d12632244cab61fa.png

The blink will be in (d)+3 normally closed contact through the following program which turns on/off the STMR instruction (T10 is allocated in (s1), K100 is allocated in (s2), and M0 is allocated in (d)) Output to (d)+1, (d)+2.

07-3 Basic instructions_html_8d0e8c4155b28ac6.png

07-3 Basic instructions_html_4073e5b7f594eb20.gif

The setting value of (S2) can be specified in the range of 1 to 32767 (1 to 3276.7 seconds).

Note:  The timer number specified by this instruction cannot be reused with other general circuits (OUT instructions, etc.). In the case of repetition, the timer action cannot be executed correctly.

The timer specified in (S1) is regarded as a 100ms timer, starting from the rising edge of the instruction contact.

Occupy the device specified in 4 points (D) at the beginning. Be careful not to overlap with the device used for machine control.

When the instruction contact is turned off, (D), (D)+1, (D)+3 will turn off after the set time. (D) +2 and timer (S1) are reset immediately.

Error code

Error codeContent
4084HWhen the value specified in (S2) is less or equal to 0
4085HWhen the device specified in the read application instruction (S2) and (d) exceeds the corresponding device range

Example

07-3 Basic instructions_html_ed1c3a4c8c2a95a4.png

Y0: When X10 changes from Off→On, Y0=On, when X10 changes from On→Off, Y0=Off after a delay of 10 seconds.

Y1: When X10 changes from On→Off, make Y1=On output once for 10 seconds.

Y3: When X10 changes from Off to On, Y3=On after 10 seconds of delay. When X10 changes from On to Off, Y3=Off after 10 seconds of delay.

Y2: When X10 changes from Off to On, output Y2=On once for 10 seconds.

07-3 Basic instructions_html_92921cb32ad3702e.png

If the component (d)+3 is introduced into the instruction stream, the oscillator output can be easily realized (this function can also be realized by the ALT instruction), as shown in the following figure:

07-3 Basic instructions_html_5fc432cd39b880d1.png

07-3 Basic instructions_html_9eb78bb9348313e9.png

TTMR/Demonstration timer

TTMR

Test the time when the TTMR instruction is ON. It is used when adjusting the timer setting time with buttons.

-[TTMR (D) (S)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(D)Device for storing teaching data-Signed BIN 16 bitANY16
(S)Multiplying ratio of teaching data0-2Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSDKHE[D]XXP
TTMRParameter 1        
Parameter 2  

Features

Measure the pressing time of the execution instruction (button) in seconds, multiply it by the magnification (10S) specified in (s) and store it in the device specified in (d).

07-3 Basic instructions_html_daaee135f53637e2.png

For the time stored in (d), when the hold time is07-3 Basic instructions_html_8e930bf19df17d95.gif07-3 Basic instructions_html_8e930bf19df17d95.gif (unit: second), the actual value of (d) is as follows according to the magnification specified in (s).

(s)Magnification(D)
K007-3 Basic instructions_html_8e930bf19df17d95.gif(D) ×1
K107-3 Basic instructions_html_5333cfa3fe2c0673.gif(D)×10
K207-3 Basic instructions_html_4d4f3e62d3034598.gif(D) ×100
(s)(d)(d)+1 (unit: 100 milliseconds)
K0 (unit: second)07-3 Basic instructions_html_7138658e8b0315fd.gif(d)+1 =(d)×10
K1 (unit: 100 milliseconds)07-3 Basic instructions_html_a180fcbcde4a1136.gif(d)+1 =(d)
K2 (unit: 10 milliseconds)07-3 Basic instructions_html_bbc3d64c804018a8.gif(d)+1 =(d)/10

Note: If the instruction contact turns from ON→OFF, the current value of the hold time (d)+1 is cleared, and the teaching time (d) does not change.

Occupy the device specified in the 2 teaching time (d) at the beginning. Be careful not to overlap with the device used for machine control.

Error code

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

Example

Example 1

07-3 Basic instructions_html_866f6d40473a09f9.png

When X0 is closed, D10=D11; when X0 is opened, the value of D10 remains unchanged, while D11 becomes 0.

07-3 Basic instructions_html_25bff2a7e21b8696.png

Example 2

Use the TTMR instruction to write 10 sets of setting time, write the setting value into D10 to D19 in advance, reorganize the timer bit 100ms type timer, so 1/10 of the teaching data is the actual operating time (seconds)

Connect the 1-digit DIP switch to X10 to X13, use the BIN command to convert the setting value of the DIP switch into BIN value and store it in Z0

X0 is On, store the time (seconds) in D100

M100 demonstrates a scan cycle pulse generated by the release of the timer button X0

Use the setting number of the DIP switch as an indirect specified pointer, and then transfer the content of D100 to D10Z0 (D10 to D19)

企业微信截图_16691916524162.png

TRH/Conversion of wet and dry bulb temperature and humidity

TRH

This instruction completes the conversion of dry bulb temperature, wet bulb temperature and corresponding humidity.

-[TRH (d1) (s) (d2) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(d1)humidity0 to 100Single precision floating pointANYREAL_32
(s)Dry bulb temperature-Single precision floating pointANYREAL_32
(d2)Wet bulb temperature-Single precision floating pointANYREAL_32
(N)mode0 to 1Signed BIN 32 bitANY32

Device used

InstructionParameterDevices

Offset

modification

Pulse

extension

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

Features

(N)There are two modes to choose from:

Mode 0: Calculate the corresponding humidity by wet bulb temperature and dry bulb temperature.

Mode 1: Calculate the corresponding wet bulb temperature by dry bulb temperature and humidity.

The conversion process formula is as follows:

Assuming that the wet bulb temperature is A, the dry bulb temperature is B, and the corresponding current humidity is C, the three meet the following conditions:

企业微信截图_16691908453440.png

企业微信截图_16691908518218.png

企业微信截图_16691908544507.png

企业微信截图_16691908572763.png

✎Note:

● The wet bulb temperature is not greater than the dry bulb temperature. When the two are the same, the humidity reaches the maximum 100%.

● The unit of dry and wet bulb temperature is (℃).

● The general value range of dry bulb is between 0 to 100℃, the command does not judge its range, so pay special attention when using this command.

Error code

Error codeContent
4084HThe value specified in (N) is out of the following range. 0 to 1
The value specified in (d1) is out of the following range. 0 to 100
A negative value is specified in (s).
A negative value is specified in (d2).
4085HThe output result of (d1)(s)(d2)(N) in the read application instruction exceeds the device range
4086HThe output result of (d1)(d2) in the writing application instruction exceeds the device range

Dry and wet bulb humidity comparison table

image-20221123154328-1.png

Example

image-20221123154337-2.png

MOVAVG/BIN 32-bit moving average filtering instructions

MOVAVG

(s1) is the data to be filtered, (s2) is the set sliding average window size, (d1) saves the process data in the instruction calculation in (s2+1) double-word devices after specifying the initial device, (d2 ) is the calculation end flag, (d3) saves the filtered result.
PLC Editor2 version that supports this instruction: 2.3.1 and above

-[MOVAVG (s1) (s2) (d1) (d2) (d3)]

Content, range and data type

ParameterContectRangeData typeData type (label)
(s1)The starting device number of the data to be filtered is stored0、2-126≤|(s)|<2128Single precision floating pointANYREAL_32
(s2)The sliding average window size or the initial device number of the sliding average window is stored1~4294967295Un-signed BIN 32 bitANY32
(d1)The storage instruction calculates the starting device number of the process data storage queue (consecutively occupies (s2+1) double-word devices)-Signed BIN 32 bitANY32_ARRAY
(d2)Instruction calculation end flag bit-BitANYBIT
(d3)The starting device number of the filtered result is stored-Single precision floating pointANYREAL_32

Device used

InstructionParameterDevices

Offset

modification

Pulse

extension

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

Features

Each time this instruction is executed, the input value (s1) will be saved to the calculation process data storage queue specified by (d1+2) starting device, where (d1) specifies the double-word device to store the current write process data queue index. The number of sliding average windows used to calculate the average value is specified in (s2). When the number of input values in the process save data queue reaches the number of sliding averages in (s2), the average calculation is started, and the value specified in (d2) The calculation end flag bit is ON. Save the average value of the data queue in the process to the initial soft component specified by (d3) as the operation result.

✎Note:

The larger the setting value in (s2), the greater the hysteresis of the output result in (d3)

When the contact before the MOVAVG instruction is closed, the calculation end flag is automatically reset, and the written index

图片22.png

Moving average is suitable for smoothing high-frequency oscillating signals. The picture above shows the effect of the sliding average command. The blue marked high-frequency oscillation signal can be used for sliding average to obtain the yellow marked curve.

Error code

Error codeContent
4084HThe input value of (s1)(s2) in the read application instruction exceeds the data range
4085HThe input value of (s1)(s2) in the read application instruction exceeds the device range
4086HThe input value of (d1)(d2)(d3) in the write application instruction exceeds the device range

Example
This instruction can be used in conjunction with the BD expansion module. When the channel value of the BD expansion module displayed in R0 is unstable, the channel value can be filtered through the following ladder diagram

图片23.png

① M18 is set to ON, and the digital quantity stored in R0 is converted into a floating-point input value;

② Specify the sliding average window size in R200;

③ D200~D201 record the position index in the current write cache queue, according to the number of sliding average windows specified in R200, fill the input value in R0 into the process data cache queue with D202 as the starting device;

④ When the number of written values reaches the number specified in R200, the S50 calculation end flag will be ON, and the calculated average value will be written into the soft component specified by D402.

FOLAG/BIN 32-bit first order lag filter instruction

FOLAG

Performing first-order lag filtering on the digital signal input by (s1), and output result is stored in (d), and the filter coefficient is adjusted by (s2), and the range is (0~1).
PLC Editor2 version that supports this instruction: 2.3.1 and above

-[FOLAG (s1) (s2) (d) ]

Content, range and data type

ParameterContectRangeData typeData type (label)
(s1)The starting device number of the data to be filtered is stored0、2-126≤|(s)|<2128Single precision floating pointANYREAL_32
(s2)Lag filter coefficient or the initial device number where the lag filter coefficient is stored0~1Single precision floating pointANYREAL_32
(d)The starting device number of the filtered result is stored-Single precision floating pointANYREAL_32

Device used

InstructionParameterDevices

Offset

modification

Pulse

extension

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

Features

First order lag filter formula:
Current filtering result (d) = filtering coefficient (s2) * current input value (s1) + (1 - filtering coefficient (s2)) * last filtering result (d).
Assume that the last filtering result is 10, and the input value this time is 20, resulting in a sudden change of 10. If the first-order lag filter is used, the filter coefficient is assumed to be a = 0.05, and the filtering value this time = 0.05 * 20 + 0.95 * 10 = 10.5, which makes the sudden change less serious, and has a good effect in filtering out pulse interference. The first-order lag filter will make the obtained data waveform smoother than the original waveform. At the same time, the smaller the filter coefficient, the better the hysteresis bigger.

✎Note: After the first-order filtering command is enabled, the filtering result is stored in (d) to calculate the next filtering result, and it is not recommended to modify it manually.

Error code

Error codeContent
4081HThe calculated data stored in (d) overflows
4084HThe input value of (s1)(s2)(d) in the read application instruction exceeds the data range
4085HThe input value of (s1)(s2)(d) in the read application instruction exceeds the device range

Example

图片24.png

①Set M0 to ON, convert the numerical value in R0 into a floating point number and store it in R10 as the filter input value;

②Set the lag filter coefficient to 0.05 and store it in D100;③After the FOLAG instruction is executed, the filtered output value is stored in R20.

✎Note:
① Filter coefficient range: 0~1, if it exceeds the range, an error will be reported.

②When filtering, the filtered output value in R20 is used to calculate the next output value, and manual modification is not recommended

RCD/BIN 16-bit data logging instruction

RCD(P)

Store (s2) data of the start device specified in (s1), and automatically store the data in the start device specified by (s3) according to the storage number calculated in (d). Every time the instruction is enabled, ( d) It will automatically add 1, (s4) specify the maximum number that can be stored.
PLC Editor2 version that supports this instruction: 2.3.1 and above

-[RCD (s1) (s2) (s3) (s4) (d) ]

Content, range and data type

ParameterContectRangeData typeData type (label)
(s1)Store the starting device number of the data to be recorded (occupies (s2) word devices)-BIN16 bitANY16
(s2)The number of devices that need to be recorded or the device number that stores the number of devices that need to be recorded1 to 65535Unsigned BIN16 bitANY16
(s3)The starting device number of data record storage (occupying (s4) words of device)-BIN16 bitANY16
(s4)The number of devices allowed to be occupied by the data record or the number of the device that stores the number of devices allowed to be occupied by the data record1 to 65535Unsigned BIN16 bitANY16
(d)The device number that stores the current recording times1 to 65535Unsigned BIN16 bitANY16

Device used

InstructionParameterDevices

Offset

modification

Dword expansion

Pulse

extension

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

Features

①When SM233 is ON, the loop recording function is turned on, and when the recorded data exceeds the number of devices allowed to be occupied by the setting in (s4), the recording starts from the specified device in (s3);

②When SM233 is OFF, the recorded data cannot exceed the allowed number of occupied devices set in (s4).

Error code

Error codeContent
4084HThe data in the read application instruction (s2), (s4) exceeds the specified range (s2=0, s4=0, s2>s4)
4085HWhen the device specified in the read application instruction (s1), (s2), (s4), and (d) exceeds the range of the corresponding device
4086HWhen the device occupied by the write application instruction (s3), (d) exceed the range of the corresponding device
4096HWhen the device in the read application instruction (s1) and (s3) are multiplexed

Example

图片25.png

①Set M0 to ON, set the number of devices to be recorded in D50 to 10, then the number of devices to be recorded is D0~D9;

②In D51, set the record data allowed to occupy the number of device to 100, then the record data allowed to store the device as R100~R199;

③Every time a rising edge is detected, record the data in D0~D9 to the device starting from R100, and the writing position is offset according to the current recording times;

④ If SM233 is OFF, the data will be recorded within the range of the currently allowed occupied device; if SM233 is ON, then circular recording will be performed, and the recording times in D300 will be increased by 1 for each recording.