LX5V Series Programming Manual V2.3
LX5V Series Programming Manual V2.3
3)
Website: http://www.we-con.com.cn/en
Phone: 86-591-8786886
Time: 21 October 2022
PLC LX5V Series Programming Manual (V2.3)
Content summary
This manual has a comprehensive introduction to the basic functions of WECON PLC Editor and the
actual use. This book is completely aimed at zero-based readers, is an essential reference book for
entry-level readers to quickly and fully grasp WECON PLC and WECON PLC Editor.
This book starts from the basic product of WECON PLC and the basic concept and operation of
WECON PLC Editor. It combines with a large number of cases and graphic analysis to
comprehensively and deeply explain the use of WECON PLC Editor Software, as well as PLC
program.
✎Safety Note
Before the installation, operation, maintenance and repair of the micro programmable control, please read this manual and other
related manuals to ensure correct use. Please use it after you have mastered the operation method, safety information and all
✎Note:
(1) Design considerations
In the event of an abnormality in the external power supply or failure of the programmable controller, to ensure the safe operation of
the entire system, be sure to install a safety circuit outside the programmable controller.
1) Be sure to install an emergency brake circuit, a protection circuit, an interlock circuit for reverse operation, such as an
emergency brake circuit, a protection circuit, a forward and reverse circuit, and an interlock circuit for the upper and lower
positioning limits to prevent machine damage, in the external circuit of the programmable controller.
2) When the programmable controller CPU detects abnormal conditions such as WDT errors through self-diagnosis, all
outputs are shut off. In addition, when the programmable controller CPU cannot detect abnormalities in the input/output
control part, etc., it cannot control the output. At this time, in order to make the machine operate safely, please design the
external circuit and mechanism.
3) Due to the failure of the relay and transistor of the output unit, it is impossible to control the state of the output to ON or
OFF. In order to ensure the safe operation of the machine, please design external circuits and mechanisms for output signals
related to major accidents.
(2) Installation Precautions
1) Please use it in the general specification environment described in the manual.
Do not use in the following places: places with dust, oily smoke, conductive dust, corrosive gas, flammable gas; places
exposed to high temperature, condensation, wind and rain; places with vibration or impact. Electric shock, fire, and
misoperation can also cause product damage.
2) When processing screw holes and wiring, do not let iron filings or wire ends fall into the ventilation window of the
programmable controller. It may cause fire, malfunction, or misoperation.
3) Please insert the connecting cable and display module accurately into the specified sockets. Poor contact may cause
misoperation.
● To prevent the temperature from rising, do not install at the bottom, top or vertical direction.Be
Note
● The installation and wiring must be performed when the external power supply is cut off. Otherwise, it may cause electric
Note
! Do not connect the empty terminal to the outside, otherwise the product will be damaged.
Attention
● Please connect the AC power supply to the dedicated terminal according to the content in the manual.
If the AC power supply is connected to the DC input/output terminal or the DC power supply terminal, the programmable controller
will be burnt out.
● Please do not supply power to the 24+ terminal of the basic unit from the external power supply, and to the empty terminal .
Do not wire from the outside, otherwise the product will be damaged.
Please ground the ground terminal of the basic unit according to the third method. But please do not share the ground with the
strong current system.
● The programmable controller will continue to work if there is an instantaneous power failure of less than 10ms.
Rememb
Attached
● When the power is cut for a long time or the voltage is low, the programmable controller will stop working and the
output will turn OFF, but once the power supply is restored, it will automatically restart.
Caution
● Please do not disassemble or modify, otherwise it may cause malfunction, malfunction, fire.
※For repair matters, please contact Fuzhou Wecon Electronic Technology Co., Ltd.
● After the power is turned off, perform the installation and disassembly of the extension cables and other connecting cables,
otherwise it may cause malfunctions and malfunctions.
(5) Maintenance
● Regular inspection: Whether the programmable controller is equipped with consumables with a shorter life.
● For relay output type, if the output relay works abnormally at a high frequency or drives a large-capacity load, you must pay
attention to its impact on the service life.
● Check with other equipment, please pay attention to the following points:
Whether there is an abnormal increase in the temperature inside the machine due to other heating elements or direct sunlight.
Whether dust or conductive dust has penetrated into the machine.
Whether there are loose wiring and terminals or other abnormalities
Contents
1 Execution of the program ................................................................................................................... 1
1.1 The composition of the scan ..................................................................................................... 1
Initialization ............................................................................................................................... 1
Input and output point refresh ..................................................................................................1
Operation of the program ......................................................................................................... 1
END processing .......................................................................................................................... 1
1.2 Scan time ................................................................................................................................... 2
Initial scan time ..........................................................................................................................2
1.3 The flow of each procedure .......................................................................................................2
1.4 Types of program execution ......................................................................................................3
2 Description of devices .......................................................................................................................19
2.1 User device .............................................................................................................................. 19
Input relay (X) .......................................................................................................................... 19
Output relay (Y) ....................................................................................................................... 19
Internal relay (M) .....................................................................................................................20
Status relay (S) ......................................................................................................................... 20
Timer (T) ...................................................................................................................................20
Counter (C) ...............................................................................................................................21
Long counter (LC) .....................................................................................................................22
High-speed counter (HSC) ....................................................................................................... 22
Data register (D & R) ................................................................................................................22
2.2 System device .......................................................................................................................... 23
Special Relay (SM) ....................................................................................................................23
Special Register (SD) ................................................................................................................ 23
2.3 Index Register .......................................................................................................................... 23
Index register ([D]) ...................................................................................................................23
2.4 Nesting .....................................................................................................................................24
Nesting (N) ............................................................................................................................... 24
2.5 Pointer ..................................................................................................................................... 24
Pointer (P) ................................................................................................................................ 24
2.6 Constant ...................................................................................................................................24
Decimal constant (K) ................................................................................................................24
Hexadecimal constant (H) ........................................................................................................24
Real number constant (E) ........................................................................................................ 24
String constant .........................................................................................................................25
2.7 Power-down retention setting ................................................................................................ 25
2.8 Special use of device ................................................................................................................25
3 Sequence control program instructions ........................................................................................... 26
3.1 Contact instructions .................................................................................................................26
Operation start, series connection, parallel connection .........................................................26
3.2 Combining instructions ............................................................................................................33
Initialization
c
The initial scan time indicates the time including this processing.
Initial scan time
It is the first scan time of the CPU module in RUN.
Process as the following way:
The value stored in SD134 (initial scan time (ms unit)) and SD135 (initial scan time (s unit)).
Key points
When the execution types of the programs are the same, they are executed in the order set in the execution order.
✎Note:
When executing instructions that can be completed with multiple cycles (such as OUT T, RAMP, RS, etc.), they should be programmed
in the scan program. If it is used in event execution type programs and mid-stage execution type programs, these instructions may
not be executed in multiple scan cycles, causing actual results to be different from the ideal results. Therefore, unless events,
interrupts and subroutines can be executed in each scan cycle. It is not recommended to use multi-cycle execution instructions in
other situations.
When multiple scan execution type programs are executed, the execution time of the scan execution type program is the time until
all scan execution type programs are executed. In addition, before the execution of the scan execution type program is completed, if
an interrupt program/event execution type program/subroutine is executed, the execution time will also be included.
Creation of multiple scanners
"Project Management"→ "Program"→ "Scan"→ Right click to create
1 Scan the program name: the program name requires to match case, and the program name cannot use the same name
with device name (the device name does not match case).
2 The input of /%$@&=~`^<>?:{}[],;!*.\\'" is not supported. It cannot exceed 64 characters. The default name is MAINx.
3 The number of scan programs that can be built is limited to 100.
4 Each scan program has been END ended, but only the last END instruction is completed to calculate a scan cycle.
5 The execution sequence runs from top to bottom in the order of creation.
Trigger type
The trigger of event execution type program is as follows.
(1) ON event of bit data (TRUE)
1 After the ON event is specified, if the contact that sets the trigger condition in the ON event is turned ON during the scan
program, the ON event program will be executed in the scan program page*1 or before the END instruction is executed.
2 The ON event program will only be executed once in a single scan cycle.
3 After the ON event is executed, you can set whether to clear the current value of the output (Y) and timer (T) used in the
program.
*1: Scan program paging: multiple scan programs are established, and each scan program is called a paging. After scan program A is
executed, before scan program B is executed, it will be judged whether an event program needs to be executed.
When it is the turn of the execution sequence of event execution type program C and Y50 is ON, the program is executed.
The devices that can be specified are as follows.
Project Content
Bit Device X, Y, M, SM
Device *1
Bit specification of word device D.b
*1 The indexed device cannot be specified.
After the specified time has elapsed, when it comes to the first execution sequence, the event execution type program C is executed.
Key points
When set to clear the current value of output and timer, and the scan time is longer than the set value of elapsed time, the current
value of output and timer will not be cleared.
Operational steps
(1) New event
Project management→ Program→ Event → Right click to create.
Configuration instructions:
1) Configuration interface:
2) Parameter content:
An interrupt name corresponds to an interrupt program, and the interrupt name cannot be repeated. Each interrupt has its
own trigger condition and execution program, and each interrupt program ends with END.
Interrupt has the characteristic of interrupting the original execution program and executing the interrupt first, but it cannot
interrupt the interrupt program being executed.
The interrupt program has the concept of priority. The smaller the priority value, the more priority the response. The priority
setting range is 0 to 2.
The actions when an interruption cause occurs are as follows:
1) Interrupt prohibition (DI) when an interruption cause occurs.
If the interrupt execution condition is triggered in a program that is forbidden by DI, the interrupt will not be executed. Even if the
subsequent program uses the EI instruction to allow interruption, the previously shielded interrupt program will not be executed.
Only the interrupt execution condition is triggered again. The interrupt program will be executed.
2) When multiple interrupt causes occur simultaneously in the interrupt enabled state.
The interrupt program with higher priority will be executed sequentially. In addition, when multiple interrupts with the same priority
occur at the same time, the actions are executed in the order of interrupt priority.
If three interrupt programs I0, I10, I16 are created, the priority of I0 is 1, the priority of I10 is 0, and the priority of I16 is 1. The
execution logic is shown in the figure below: I10 has the smallest priority and is executed first; I0 and I16 have the same priority and
are executed in the order of program establishment.
6) When the same interruption cause occurs during the execution of the interrupt program;
The interruption cause that occurred is stored, and after the interrupt program in execution ends, the interrupt program
corresponding to the stored interruption cause is executed. Even if the same interruption cause occurs multiple times, the
interruption cause is stored only once.
Interrupt trigger condition classification
(1) External input (X) interrupt
1) Description of external input interrupt
The external input interrupt is triggered by the rising or falling edge of the fixed X point input.
Supports the rising and falling edge interrupts of a total of 8 input points of X0 to X7, and supports a total of 16 external
input interrupts.
The same interrupt trigger condition cannot create multiple interrupt programs.
External input interrupt and high-speed counter cannot use the same X point.
You must use EI in the scan program to allow interrupts before the interrupt execution program will be executed.
The interrupt program name requires to match case, and the program name with the same name as the device cannot be
used (the device name does not match case),
The interrupt program name does not support the input of /%$@&=~`^<>?:{}[],;!*.\\'" characters,
The length of the interrupt program name cannot exceed 64 characters and cannot be typed. The default name is INTx.
Click Configure, and select external interrupt for execution type, as shown in the figure below (it can also be configured in "program
parameters" in "parameters" in project management):
Double-click the newly created interrupt program in the project management to start writing the interrupt execution program. As
shown in the figure above, a newly created interrupt program is INT_X0_UP, and the trigger condition is configured to execute the
interrupt program when the X0 rising edge is configured. If the EI instruction is used in the main program to allow interrupts, all
programs in INT_X0_UP will be executed whenever X0 changes from OFF to ON , That is, D0 will increment once.
Double-click the newly created timer interrupt program in the project management to start writing the interrupt execution program.
As shown in the figure above, a newly created timer interrupt program is INT0, and the trigger condition is configured to execute the
interrupt program every 10ms. If the main program uses EI to enable interrupts, all instruction programs in INT0 will be executed
every 10ms, namely D0 It will add 1 to 10ms.
Call the high-speed counter in the main program and enable interrupts:
Program operation:
Assuming that the High-speed counter channel 0 has been receiving pulses:
When the count value of HSC0 accumulates from 0 to 20000, all procedures of HSC0_20000 are executed.
When the count value of HSC0 is accumulated from 20000 to 30000, all procedures of HSC0_30000 are executed.
When the count value of HSC0 is accumulated from 30000 to 40000, all procedures of HSC0_40000 are executed.
Mask interrupt
(1) Mask through application instructions
The PLC interrupt is in the shielded state by default when it is powered on, and can only be used after the interrupt is allowed
through the EI instruction.
The interrupt mask instruction DI masks all interrupts without parameters, and masks some priority interrupts with parameters (refer
to the program flow instruction DI/EI for details).
(2) Mask through special registers SM and SD
1) External input interrupt mask register
External input interrupt mask register
Special register number Type of interrupt Instruction Defaults
SM352 X0 rising edge interrupt ON: shield interrupts; OFF: interrupt allowed OFF
SM353 X0 falling edge interrupt ON: shield interrupts; OFF: interrupt allowed OFF
SM354 X1 rising edge interrupt ON: shield interrupts; OFF: interrupt allowed OFF
SM355 X1 falling edge interrupt ON: shield interrupts; OFF: interrupt allowed OFF
SM356 X2 rising edge interrupt ON: shield interrupts; OFF: interrupt allowed OFF
SM357 X2 falling edge interrupt ON: shield interrupts; OFF: interrupt allowed OFF
SM358 X3 rising edge interrupt ON: shield interrupts; OFF: interrupt allowed OFF
SM359 X3 falling edge interrupt ON: shield interrupts; OFF: interrupt allowed OFF
SM360 X4 rising edge interrupt ON: shield interrupts; OFF: interrupt allowed OFF
(2) ✎Note:
1) When using the timer (OUT T), note that the output will not be reset when the subroutine is not called, and a specific
subroutine register must be used.
2) It is not allowed to call recursively between subprograms, that is, call SUB1 in SUB0, and then call SUB0 in SUB1. This is not
allowed.
3) The subroutine can be nested up to 32 levels. If the level exceeds 32 levels, a serious error will be reported and the Circuit
program operation will be forcibly stopped.
4) Unlike the LX3V series mainframe, the subroutine in the LX5V series mainframe ends with the END instruction instead of SRET.
2 Description of devices
Device list
Classification Type Device name Sign Range Mark
Bit Input X 0 to 1777 Octal number
Bit Output Y 0 to 1777 Octal number
Bit Internal relay M 0 to 7999 Decimal number
Bit Step relay S 0 to 4095 Decimal number
Bit/word Timer T 0 to 511 Decimal number
User device
Bit/word Counter C 0 to 255 Decimal number
Bit/double word Long counter LC 0 to 255 Decimal number
Bit/double word High-speed counter HSC 0 to 15 Decimal number
Word Data Register D 0 to 7999 Decimal number
Word Data Register R 0 to 29999 Decimal number
Bit Special SM 0 to 4095 Decimal number
System software
Word Special register SD 0 to 4095 Decimal number
Word Index register [D] 0 to 7999 Decimal number
Index register Word Index register V 0 to 7 Decimal number
Double word Long index register Z 0 to 7 Decimal number
Nested Bit Nested N 0 to 7 Decimal number
Pointer - Pointer P 0 to 4095 Decimal number
- Decimal constant K - Decimal number
Constant - Hexadecimal constant H - Hexadecimal number
Single precision floating point Real constant E - -
The input relay represents the original PLC external input signal status, and the external signal status is detected through the input X
port. 0 represents the external signal is open, and 1 represents the external signal is closed.
Using the program instruction method, the state of the input relay cannot be modified, and its node signals (normally open, normally
closed) can be used indefinitely in the user program.
The relay signal is identified by Signs such as X0, X1,......X7, X10, X11...... and its serial number is numbered in octal.
When an expansion module is connected, the extended X point will also use the X point as the component of the input signal state,
and the occupied X point is the starting position of the X point used by the PLC with 0 as the end of the X point, such as PLC Occupy
17 to 24 X points (X0 to X21, X0 to X27), at this time the X points of the expansion module will be stored starting from X30.
Output relay (Y)
The output relay is a Devices directly connected to the hardware port of the external user control device, and logically corresponds to
the physical output port of the PLC. After the PLC scans the user program each time, the component status of the Y relay will be
transmitted to the hardware port of the PLC. 0 means the output port is open; 1 means the output port is closed.
Y relay numbers are identified by Signs such as Y0, Y1,...Y7, Y10, Y11, etc., and their serial numbers are numbered in octal format. Y
relay components can be used indefinitely as promised by users .
In terms of hardware, according to the different output components, it can be divided into relay type, transistor type, solid state relay
type, etc. If there are output expansion module ports, they are numbered in sequence starting from the main module.
As shown in the figure above: when the normally open contact of X0 is turned on, the current value counter of T200 starts timing
from zero and counts up the 10ms clock pulse. When the current value is equal to the set value 223, the timer's normally open
contact is turned on and the normally closed contact is turned off, that is, the output contact of T200 will act after its coil is driven for
2.23s. After the normally open contact of X0 is disconnected, T200 is reset because the coil is de-energized. After reset, its normally
open contact is disconnected, and the normally closed contact is connected, and the current value returns to zero.
(2) Accumulative timer (T246 to T255)
When the X1 normally open contact in Figure b is turned on, the current value counter of T250 accumulates the 10ms clock pulse.
When the normally open contact of X1 is disconnected or stopped, the counting stops, and the current value remains unchanged.
When the normally open contact of X1 is turned on again, counting continues. When the accumulated time t1+t2 is 4.2s, the current
value is equal to the set value of 420, the normally open contact of T250 is turned on and the normally closed contact is turned off.
When the normally open contact of X2 is turned on, T250 will reset (because the coil of the accumulative timer will not reset when
the power is off, you need to use the normally open contact of X2 and the reset instruction to force T250 to reset).
(3) Setting value
The timer time can use the constants (K, H) in the program memory as the set value, or can be specified indirectly by the content of
the data register (D).
After PLC is powered on, multiplication is performed, D3=D0*2. Use the data of D3 as the timing time value of T10.
Counter (C)
The counter is used to complete the counting function. Each counter contains a coil, a contact, and a timer value register. Whenever
the driving signal of the counter coil changes from OFF to ON, the counter reading value increases by 1. If the timer value reaches the
preset time value, its contact action, a contact (NO contact) is closed, b contact (NC contact) is opened; If the timing value is cleared,
the output a contact will be opened, and b contact (NC contact) will be closed. Some timers have features such as power-down
retention, accumulation, etc., and maintain the value before power-down after power-on again.
The counters are identified by C0, C1,..., C255, and the order is numbered in decimal.
The counter (C) is a 16-bit counter.
The setting value of the 16-bit up counter is 1 to 32767. As shown in the working process of the up counter in Figure c, after the
normally open contact of X1 in the figure is turned on, C0 is reset, its corresponding bit storage unit is set to 0, the normally open
contact of C0 is disconnected, and the normally closed contact Point is turned on, and its current counter value is set to 0 at the same
time. X2 provides a counting input signal. When the reset input circuit of the counter is disconnected and the counting input circuit
changes from disconnected to connected (that is, the rising edge of the counting pulse), the current value of counter C0 is increased
by 1. After 10 count pulses, the current value of C0 is equal to the set value of 10, and its corresponding bit storage unit is set to 1,
and the Y0 contact is turned on at this time. When counting pulses again, the current value does not change until the reset input
signal is turned on, and the current value of the counter is set to 0.
*1 is an instruction used to create an efficient ladder switching program by opening and closing the common bus of the Circuit
program.
2.5 pointer
Pointer (P)
The pointer is the device used in the jump instruction (CJ instruction).
At present, the CALL instruction directly uses the subroutine name to call, and no longer uses the P pointer.
2.6 Constant
The constants are explained below.
Decimal constant (K)
“K” is a Sign that represents a decimal integer and is specified by K (for example: K123). It is mainly used to designate the set value
of a timer or counter or the value in the operand of an application instruction. In 16bit instructions, the value range of constant K is
-32768 to 32767; in 32bit instructions, the value range of constant K is -2147483648 to 2147483647.
Hexadecimal constant (H)
“H” is the Sign of hexadecimal number, specified by H□ (example: H123), mainly used to designate the value of the operand of the
application instruction. The value range of the constant H is 0000 to FFFF; in the 32-bit instruction, the value range of the constant K
is 0000, 0000 to FFFF, FFFF.
Real number constant (E)
“E” is the single-precision floating-point number representation Sign, specified by E□ (example: E1.23), mainly used to specify the
✎Note: The X and Y registers do not support the power-down save function.
7) Offset modification
The devices used in the LD, LDI, AND, ANI, OR, ORI instructions can all be indexed with D data devices (the status register S cannot be
modified).
D0 to D7999 can be used in index modification.
When the devices are input (X) and output (Y), the value of the index register is converted into an octal number and then added.
Example
• The LDF instruction is a falling edge pulse instruction, which turns on at the falling edge (ON→OFF) of the specified bit device.
When the bit of the word device is specified, it turns on only when the specified bit changes from 1→0.
ANDP, ANDF
• The ANDP instruction is a series connection instruction for rising edge pulses, and the ANDF instruction is a series connection
instruction for falling edge pulses. The AND operation is performed with the operation result up to that time as the operation result.
The ON/OFF information used in ANDP instructions and ANDF instructions is shown in the table below.
Device specified in ANDP, ANDF
ANDP status ANDF status
Bit device Bit specification of word device
OFF→ON 0→1 ON OFF
OFF 0 OFF OFF
ON 1 OFF OFF
ON→OFF 1→0 OFF ON
ORP, ORF
• The ORP instruction is a parallel connection instruction for rising edge pulses, and an ORF instruction is a parallel connection
instruction for falling edge pulses. The OR operation is performed with the operation result up to that time as the operation result.
The ON/OFF information used in ORP instructions and ORF instructions is shown in the table below.
Device specified in ORP, ORF
ORP status ORF status
Bit device Bit specification of word device
OFF→ON 0→1 ON OFF
OFF 0 OFF OFF
ON 1 OFF OFF
ON→OFF 1→0 OFF ON
Error code
There is no operation error.
Example
1) LDP, ANDP, ORP instructions (calculation starts when a rising edge is detected, serial connection, parallel connection)
In the above figure, when X000 to X002 changes from OFF to ON, M0 or M1 only maintains ON for 1 operation cycle.
2) LDF, ANDF, ORF instructions (calculation starts when a falling edge is detected, serial connection, parallel connection)
In the above figure, when X000 to X002 changes from ON to OFF, M0 or M1 only maintains ON for 1 operation cycle.
3) Bit specification of data register (D)
In the devices used for LDP, LDF, ANDP, ANDF, ORP, ORF instructions, the bits of the data register (D) can be specified.
To specify the bit of the data register, enter "." after the number of the data register (D), and then enter the bit number (0 to F). The
usable data registers are specified in bits, but only 16-bit data registers are valid.
Please specify the bit number in the order of 0,1,2,...9,A,B,...F starting from the low order.
Example:
The third bit of D0 determines the LDP contact ON (conduction)/OFF (non-conduction) when it changes from OFF to ON.
Features
ANB
• Perform AND operation of block A and block B and use it as the result of the operation.
• The Sign of the ANB instruction is not a contact Sign, but a connection Sign.
ORB
• Perform OR operation of block A and block B, and use it as the result of the operation.
• The ORB instruction connects circuit blocks with 2 or more contacts in parallel. The parallel connection of only 1 contact uses OR
instruction and ORI instruction, without ORB instruction.
• The Sign of the ORB instruction is not a contact Sign, but a connection Sign.
Error code
There is no operation error.
Example
Features
MPS
• Store the operation result (ON/OFF) before the MPS instruction.
• The MPS instruction can be used continuously up to 11 times. If the MPP instruction is used in the middle, the number of uses of
the MPS instruction will be -1.
MRD
• Read the operation result stored by the MPS instruction, and start the operation from the next step with the operation result.
MPP
• Read the operation result stored by the MPS instruction, and start the operation from the next step with the operation result.
• Clear the operation result stored by the MPS instruction.
• The used number of MPS instructions will be -1.
Error code
There is no operation error.
Example
MPS, MRD, MPP instructions (push stack, read stack, pop stack)
• After using the MPS instruction to store the intermediate result of the operation, it drives the output Y002.
• After reading the storage content using MRD instruction, drive output Y003.
The MRD instruction can be programmed multiple times.
• Use the MPP instruction to replace the MRD instruction in the final output loop, so as to reset it while reading the
above-mentioned stored content.
Features
Invert the results of operations up to the INV instruction.
Operation result before INV instruction Operation result after INV instruction is executed
OFF ON
ON OFF
Error code
There is no operation error.
Point
• The INV instruction executes the operation as a result of the previous operation, so it should be used in the same position as the
AND instruction. INV instruction cannot be used in the position of LD and OR instructions.
• When the INV instruction and ANB instruction are used together for ladder operation, pay attention to the inverted range.
Example
INV instruction (reverse operation result)
Features
MEP
• When the operation result before the MEP instruction is a rising edge (OFF→ON), it becomes ON (conduction state). When the
operation result before the MEP instruction is other than the rising edge, it turns off (non-conduction state).
• When using the MEP instruction, if multiple contacts are connected in series, pulse processing will be easier.
MEF
• When the operation result before the MEF instruction is a falling edge (ON→OFF), it becomes ON (conduction state). When the
operation result before the MEF instruction is other than the falling edge, it turns OFF (non-conduction state).
• When using the MEF instruction, if multiple contacts are connected in series, pulse processing will be easier.
Error code
There is no operation error.
Point
• For MEP instructions and MEF instructions, if the indexed contacts are pulsed by subroutines, FOR to NEXT
instructions, etc., they may not operate normally.
• The MEP instruction and MEF instruction perform actions based on the previous calculation results, so they should
be used in the same position as the AND instruction. The MEP instruction and MEF instruction cannot be used in the
position of LD instruction and OR instruction.
Example
1) MEP instruction (ON at the rising edge of the operation result)
When the value of D0 is 10, when X0 is ON (conducting), the Y12 contact is ON (conducting).
3) Bit specification in the data register
Among the devices used in the OUT instruction, the bit of the data register (D) can be specified.To specify the bit of the data register,
enter "." after the number of the data register (D), and then enter the bit number (0 to F). The usable data registers are specified in
bits, but only 16-bit data registers are valid.
Please indicate the positioning number in the order of 0,1,2,...9,A,B,...F starting from the low order.
Example:
In the example on the left, the state of X1 determines the ON (conduction)/OFF (non-conduction) of the third bit in D0.
SET instruction
When the execution instruction turns ON, the device specified in (d) will be in the following state.
• Bit device: Turn on the coil and contact.
• Bit specification of word device: Set the specified position to 1.
✎Note:
For the output relay (Y), if the SET instruction and the RST instruction are executed in the same operation, the instruction result close
to the END instruction (end of program) will be output.
Error code
Error code Content
4086H (d) In the case of using offset, the offset address exceeds the device range
Example
1) When using bit devices
The parallel SET instruction could be used multiple times in succession. In the following program example, this is the case for the
program with SET Y000 followed by RST Y000.
2) Offset modification
All the devices used in the SET instruction can be indexed with D data devices (the status register S cannot be modified).
D0 to D7999 can be used in index modification.
When the devices used are input (X) and output (Y), the value of the index register is converted into octal number and then added.
Example:
When the value of D0 is 10, when X0 is ON (conduction), the Y12 contact is ON (conduction), X0 is OFF (non-conduction), and the Y12
contact remains unchanged.
3) Bit specification in the data register
Among the devices used in the SET instruction, the bits of the data register (D) can be specified.
To specify the bit of the data register, enter "." after the number of the data register (D), and then enter the bit number (0 to F). The
usable data registers are specified in bits, but only 16-bit data registers are valid.
Please specify the bit number in the order of 0,1,2,…9,A,B,…F starting from the lower bit.
Example:
In the example on the left, the state of X1 is ON (conduction), and the third bit in D0 is ON (conduction). The state of X1 is OFF
(non-conduction), and the state of the third bit in D0 remains unchanged.
✎Note:
For timers and counters, when the RST instruction is executed in the program, subroutine, and interrupt program where the RST
instruction is jumped, the timer and counter may remain unchanged after reset, and the timer and counter will not operate.
Error code
Error code Content
4086H (d) write address exceeds the device range
Example
1) Use bit device
When the value of D0 is 10, when X0 is ON (conduction), the Y12 contact is OFF (conduction), X0 is OFF (non-conduction), and the
Y12 contact remains unchanged.
3) Bit specification in the data register
Among the devices used in the RST instruction, the bits of the data register (D) can be specified.
To specify the bit of the data register, enter "." after the number of the data register (D), and then enter the bit number (0 to F). The
usable data registers are specified in bits, but only 16-bit data registers are valid.
Please specify the bit number in the order of 0,1,2,…9,A,B,…F starting from the lower bit.
Example
In the example on the left, the state of X1 is ON (conduction), and the third bit in D0 is OFF (conduction). The state of X1 is OFF
(non-conduction), and the state of the third bit in D0 remains unchanged.
Features
When the execution instruction is ON→OFF, the specified device is turned ON, and when the execution instruction is other than
ON→OFF, it is turned OFF. When there is one PLF instruction for the device specified in (d) in one scan, the specified device will turn
on one scan.
✎Note:
If the PLF instruction is jumped by the CJ instruction, or the executed subroutine is not called by the CALL(P) instruction, the device
specified in (d) may be turned on for more than one scan. Be careful.
Error code
No Error code
Example
PLF instruction (differential output of falling edge)
In the above figure, when X000 changes from ON to OFF, only one operation cycle of M1 is ON.
Features
When the PLS instruction is OFF→ON, one scan of the specified device is turned on, and when it is other than OFF→ON, it is turned
off. When there is one PLS instruction for the device specified in (d) in one scan, the specified device turns on one scan.
✎Note:
If the PLS instruction is jumped by the CJ instruction, or the executed subroutine is not called by the CALL(P) instruction, the device
specified in (d) may be turned on for more than one scan. Be careful.
Error code
No Error code
Example
PLS instruction (differential output on rising edge)
In the above figure, when X000 changes from OFF to ON, only one operation cycle of M0 is ON.
Features
Indicates the end of the program including the main program, subprogram, interrupt program, and event. When the END instruction
is executed, the CPU module will end the program being executed.
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP P
CJ Parameter 1 ● ●
Features
CJ(P)
When the execution instruction is ON, the program with the specified pointer number is executed.
When the execution instruction is OFF, execute the next program.
1) Execute instructions.
2) Each scan is executed.
3) One scan is executed.
✎Note:
After turning ON the coil of the timer, if the timer whose coil is ON is jumped by the CJ(P) instruction, the measurement will not be
performed normally.
When the OUT instruction is jumped by the CJ(P) instruction, the scan time will be shorter.
When the CJ(P) instruction is used to jump backward, the scan time will be longer.
For the CJ(P) instruction, you can jump to a step smaller than the step number being executed. However, in order to avoid the time
limit of the watchdog timer, a method of jumping out of the loop during this period should be considered.
The jump instruction can only specify the pointer number in the same program file.
When jumping to the pointer number within the jump range during jump operation, the program after the jump destination pointer
number is executed.
The label procedure is shown below. When creating a loop program, move the cursor to the left of the bus bar of the Circuit program,
and enter the label (P) at the beginning of the loop block.
It is also possible to program the label at the position where the step number is less than the CJ instruction, but if the scan time
becomes more than 200ms (default setting), a watchdog timer error will occur, which requires attention.
When the pointer number in the operand is the same and the label is one, the operation is as follows.
(1) When X20 is ON, jump from the CJ instruction of X20 to label P9.
(2) When X20 is OFF and X21 is ON, jump from the CJ instruction of
X21 to label P9.
SM100 is always ON during the operation of the CPU module, so the usage method shown below will jump unconditionally.
The pointer number P63 of LX3V represents the jump to the END instruction. The P63 pointer of LX5V no longer provides this
function. If you need to use this function, please use the GOEND instruction.
Error code
No error message
Example
1) The situation to jump after OFF processing
After one operation cycle when X023 changes from OFF to ON, the CJ P7 instruction is valid.
With this method, the output between CJ P7 instruction and mark P7 can be turned off before jumping.
In the above program, if each input changes during the jump, the action of each coil is shown in the following table.
Content Contact state before jump Coil action in jump
Y,M,S X1, X2, X3 OFF Y1, M1, S1 OFF
(Y1, M1, S1) X1, X2, X3 ON Y1, M1, S1 ON
1ms, 10ms, 100ms timer X4 OFF Timer not working
(T0) X4 ON Timer interrupt (continue after X0 OFF)
Program timer X5 OFF, X6 OFF Timer not working, but the timer is reset when X13 is ON
(T192) X5 OFF, X6 ON Timing continues (contact action after X0 OFF)
Counter X7 OFF, X10 OFF Counting interrupt, but it is reset when X13 is ON
(C0) X7 OFF, X10 ON Count interruption (continue after X0 OFF)
X11 OFF Single-cycle application instructions are not executed in the jump
Application instructions
Multi-cycle application instructions are partially executable (such as
(MOV) X11 ON
high-speed pulse instructions)
3) The relationship between CJ instruction and MC to MCR jump
The relationship between the main control instruction and the jump instruction and the action content are as follows.
However, since the operation of ②, ④, and ⑤ will become complicated, please avoid using them.
CALL Parameter 1 ● ●
✎Note:
• Multiple CALL(P) instructions can call the same subprogram, but subprograms with the same program name are not allowed.
• Use program timers in subroutines (the same applies to interrupt programs). This timer counts when the coil instruction or the END
instruction is executed. If it reaches the timer setting value, the output contact will act when the coil instruction or END instruction is
2) Subroutine call
In the scan program, turn on M10 to call the subroutine SUB0, execute the Circuit program in the subroutine SUB0, until the END
instruction of the subroutine is executed, return to the scan program MAIN to execute LD M11.
3) Subroutine nesting
In the above figure, the subroutine SUB0 is called in the scan program, and the subroutine SUB1 is called in SUB0. So when the scan
program M10 is turned on, after the CALL instruction is executed, the subroutine SUB0 will be executed first.And after the CALL
instruction of SUB0 is executed, SUB1 will be executed first. After executing the END instruction of SUB1, return to SUB0 for
execution. After executing the END instruction of SUB0, return to the scan program MAIN. The program has only 2 levels of nesting,
and the number of nesting levels cannot be greater than 32.
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
DI Parameter 1 ●
Features
DI
• Even if the execution interrupt condition is triggered in the program, prohibit the interrupt program execution before executing the
EI instruction.
• When the PLC is powered on or after STOP, it will become the state after DI instruction is executed, and the interrupt program
cannot be executed.
• The DI instruction can choose whether to use parameters. When there is no parameter, it means that all interrupt programs are
prohibited. With parameters, according to the value in parameter s1, interrupt programs with this priority and lower priority are
prohibited.
• The priority of the interrupt ranges from 0 to 2. The smaller the value, the higher the response priority of the interrupt. That is, the
interrupt with priority 0 is the fastest to be responded.
• If there is no EI instruction before the DI instruction, the DI instruction is invalid.
EI
• Release the interrupt prohibition state when DI instruction is executed, and allow interrupt program to run.
• When the EI and DI instructions are not enabled, they all maintain the original enabled or forbidden interrupt program execution
status. The currently disabled interrupt priority can be viewed in SD151.
According to the interrupt prohibition instruction (DI instruction), the interrupt prohibition
instruction (DI instruction) below the specified priority, and the interrupt enable
Currently
instruction (EI instruction), the priority of the interrupt prohibition will be stored.
disabled
SD151 0: All priority interrupts are disabled (default); R(read only)
interrupt
1: Priority 1 and 2 interrupts are prohibited;
priority
2: Priority 2 interrupt is prohibited;
3: All priority interrupts are allowed
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
FOR Parameter 1 ● ● ● ● ●●●● ● ●●● ●
Features
• When the processing between the FOR to NEXT instruction is executed unconditionally (n) times, the next processing of the NEXT
instruction will be performed.
• (n) can be specified in the range of 1 to 32767. When specifying -32768 to 0, the same processing as (n)=1 will be performed.
• If you do not want to execute the processing between the FOR and NEXT instructions, use the CJ instruction to jump.
• The FOR instruction can be nested up to 5 levels.
✎Note:
• In the case of FOR to NEXT instruction programming with nesting between FOR to NEXT instructions, up to 5 levels can be achieved.
• Do not use IRET, SRET, RET, FEND, END and other instructions to block between FOR to NEXT instructions.
55 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
• If the number of repetitions is too large, the cycle time (operation cycle) becomes longer and the watchdog timer error occurs, you
need to change the watchdog timer time or reset the watchdog timer.
• The following program will become an error.
• If the FOR to NEXT instruction is repeatedly executed and ends midway, use the BREAK instruction.
Error code
Error code Content
4085H (s) read address exceeds the device range
4100H When the nesting of FOR to NEXT instructions exceeds 5 levels or the number of FOR to NEXT does not correspond
Example
The program INC D0 will be executed 10 times, and INC D1 will be executed 100 times.
After execution, D0 will be equal to 10 and D1 will be equal to 100.
Error code
Error code Content
4186H BREAK instruction is not used between FOR to NEXT instructions
Example
The program INC D0 will be executed 10 times, and INC D1 will be executed 100 times.
When M0 is OFF, D0 will be equal to 10 and D1 will be equal to 100 after execution.
When M0 is ON, the BREAK instruction is executed, and the current loop is exited. The INC D1 instruction will not be executed, and
the result D1=0.
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter1 Only use N0 to N7
MC
Parameter2 ● ● ● ● ●●●● ● ●●●
MCR Parameter1 Only use N0 to N7
Features
The main control instruction is used to create an efficient circuit program switching program by opening and closing the common bus
of the circuit program.
The transition of ordinary Circuit program and master control Circuit program is as follows:
■MC
• When the execution instruction of the MC instruction is turned on by the start of main control, the operation result from the start
of the MC instruction to the MCR instruction is the execution result of the instruction (loop). When the MC execution instruction is
OFF, the calculation results from the MC instruction to the MCR instruction are as follows.
✎Note:
• If there is no instruction (LD, LDI, etc.) connected to the bus after the MC instruction, a program structure error occurs.
• MC to MCR instructions cannot be used in FOR to NEXT, STL to RET, subroutines, events, and interrupts. In addition, there cannot be
instructions such as IRET, FEND, END, RET (SRET) inside MC to MCR to block.
• There can be up to 8 nests (N0 to N7). In the case of nesting, the MC instruction is used from the small number of nesting (N), while
The main control program 1 and the main control program 2 do not belong to the nested structure, so you can use N0 programming.
There is no limit to the number of times N0 can be used in this case.
2) Nested structure
When using the MC instruction, the number of nesting level N increases sequentially.(N0→ N1→ N2→ N3→ N4→ N5→ N6→ N7).
When returning, use the MCR instruction to release from the larger nesting level. (N7→ N6→ N5→ N4→ N3→ N2→ N1 → N0).
For example, when MCR N6 and MCR N7 are not programmed, if MCR N5 is programmed, the nesting level will return to 5 at
once.The nesting level can be programmed up to 8 levels (N7).
N2 N1 N0
As shown above:
87 Walk: Level N0, Y0 will follow X1 state only when X0 is ON.
95 Walk: Level N1, Y1 will follow X3 state only when X0 and X2 are both ON.
103 Walk: Level N2, Y2 will follow X5 state only when X0, X2, and X4 are ON at the same time.
109 Walk: Level N1, use MCR N2 to return to level N1. Y3 will follow the state of X6 only when X0 and X2 are both ON.
115 walk: level N0, use MCR N1 to return to level N0. Y4 will follow the state of X7 only when X0 is ON.
121 Walk: Does not belong to the main control structure, has nothing to do with X0, X2, X4, Y5 follows the state change of X10.
• The WDT instruction can be used more than twice in one scan.
✎Note:
• The watchdog timeout time can be set in the special register SD122. The default is 200ms.
• Use the special relay SM122 to control whether to turn on the watchdog timer function. The WDT instruction will be invalid after
closing.
The FOR to NXET instruction loop takes a long scan period for many times, which may exceed the set watchdog timer 300ms, causing
the PLC to report an error and cannot continue to run. After turning on M0, the WDT instruction will run, and the watchdog timer is
updated every cycle , So that it will not report an error to execute the program normally.
100ms subroutine timer (used in the subroutine, even if the T250 to T255 10ms cumulative timer
T192 to T199
subroutine is not called, it will still be updated) T256 to T383 1ms timer
Every time M0 changes from OFF→ON, C0 will increase by 1. When the value of C0 is added to K10, the normally open contact of C0
is closed and Y0 is output. At this time, M0 continues from OFF→ON, and the value of C0 will not change anymore.
The contact of C0 can only be turned OFF by RST/ZRST instruction and communication.
63 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
OUT LC instruction/Long counter output
32-bit counter instruction: When the operation result before the OUT instruction changes from OFF to ON, the current value of the
long counter specified in (d) will be +1. If counted, the normally open contact will be turned on and the normally closed contact will
change It is non-conductive.
-[OUT (d) (value)]
Content, range and data type
Parameter Content Range Data type Data type (label)
(d) Long counter device number - Counter ANY
(value) Long counter setting value 0 to 4294967295 Unsigned BIN 32 bit ANY_INT
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●
OUT LC
Parameter 2 ● ● ● ● ● ●● ● ●●●
Features
• When the calculation result before the OUT instruction changes from OFF to ON, the current value (count value) of the long
counter specified in (d) will be +1. If the count reaches (current value ≥ set value), the normally open contact will turn on On, the
normally closed contact becomes non-conductive.
• If the calculation result is ON, no counting is performed. (Counting input does not need to be pulsed.)
• After the count is reached, the count value and contact status will not change before the RST instruction or ZRST instruction is
executed.
• When the setting value is 0, the processing is the same as when it is 1.
Error code
Error code Content
4085H The (value) parameter exceeds the device range
Example
Each time M0 changes from OFF to ON, LC0 will increase by 1. When the value of LC0 is added to K10, the normally open contact of
LC0 is closed and Y0 is output. At this time, M0 continues from OFF→ON, and the value of LC0 will not change anymore.
The contact of LC0 can only be turned OFF by RST/ZRST instruction and communication.
Highest frequency
The maximum countable frequency of various high-speed counters is as follows:
Counter type Highest frequency
Single phase input counter (S/W) 150KHz
AB phase input counter [1 times frequency] 100KHz
AB phase input counter [2 times frequency] 100KHz
AB phase input counter [4 times frequency] 100KHz
Counting range: -2147483648 to 2147483647, which is a signed 32-bit ring counter.
Channel High-speed counter type X0 X1 X2 X3 X4 X5 X6 X7 X10 X11 X12 X13 X14 X15 X16 X17
Single phase input (S/W) A
HSC0
AB phase input A B
Single phase input (S/W) A
HSC1
AB phase input A B
Single phase input (S/W) A
HSC2
AB phase input A B
Single phase input (S/W) A
HSC3
AB phase input A B
Single phase input (S/W) A
HSC4
AB phase input A B
Use the OUT HSC instruction in the main program to enable High-speed counter. At this time, as long as there is an external pulse
input, the pulse value can be observed in HSC0 to HSC7.
In the double word composed of special soft components SD403 and SD402, the current input pulse frequency of HSC0 can be
monitored. Other channels also have corresponding registers, please refer to the description of special registers for details.
If the counter need to be stopped, just turn off the OUT HSC instruction.
Use the OUT HSC instruction in the main program to enable High-speed counter. At this time, as long as there is an external pulse
input, the pulse value can be observed in HSC0 to HSC7.
In the double word composed of special soft components SD403 and SD402, the current input pulse frequency of HSC0 can be
monitored. Other channels also have corresponding registers, please refer to the description of special registers for details.
When the value of HSC0 is greater than 0, the contact of HSC0 will be set, and the other channels are the same. As shown in the
circuit program below, Y0 will be turned on.
• If the device specified in (d) is Y0 to Y20, when (d) is set, Y will be directly mapped to the actual hardware output, regardless of the
✎Note:
The high-speed counter interrupt only supports a total of 100 programs, and each DHSCS is also counted in these 100. If it exceeds,
an operation error will be reported.
Error code
Error code Content
4084H The input device in (s2) exceeds the range of HSC0 to HSC7
4085H (s1) and (s2) read addresses exceed the device range
4086H (d) write address exceeds the device range
2406H The number of high-speed counter interrupts exceeds 100
4F81H DHSCS,SHSCR and DHSZ runs,but OUT HSC does not program
Example
To configure the high-speed counter, take HSC0 as an example.
In scanning MAIN, use the EI instruction to enable the interrupt, and then use the OUT HSC instruction to turn on the high-speed
counter.
After M0 is turned on, when the value of HSC0 changes from 19999→20000, the INT0 program is executed once, that is, D0 is
increased by 1.
When the value of HSC0 changes from 20000→20001, the INT0 program is not executed, that is, D0 remains at 1.
When the value of HSC0 changes from 20001→20000, the INT0 program is executed once, that is, D0 is increased by 1, and D0 is 2.
• If the device specified in (d) is Y0 to Y20, when (d) is set, Y will be directly mapped to the actual hardware output, regardless of the
scan cycle.
✎Note:
The high-speed counter interrupt only supports a total of 100 programs, and each DHSCR is also counted in these 100. If it exceeds,
an operation error will be reported.
Error code
Error code Content
4084H The input device in (s2) exceeds the range of HSC0 to HSC7
4085H The (s1) and (s2) read addresses exceed the device range
4086H The (d) write address exceeds the device range
2406H The number of high-speed counter interrupts exceeds 100
4F81H DHSCS,SHSCR and DHSZ runs,but OUT HSC does not program.
Example
To configure the high-speed counter, use HSC0 as an example.
Use the OUT HSC instruction to turn on the high-speed counter while scanning MAIN.
After M0 is turned on, when the value of HSC0 changes from 99→100, reset Y0 and D0 will increase by 1.
• If the device specified in (d) is Y0 to Y15, when (d), (d+1), (d+2) are set, Y will be directly mapped to the actual hardware output, not
affected by the scan cycle .
• When setting [Comparison Value 1] and [Comparison Value 2], please ensure that [Comparison Value 1]<[Comparison Value 2]. If
the settings are different, an operation error will occur, and the DHSZ instruction will not execute the action.
✎Note:
The high-speed counter interrupt only supports a total of 100 programs, and each DHSZ is also counted in these 100, and the DHSZ
instruction will occupy the space of 2 interrupt programs. If it exceeds, an operation error will be reported.
The comparison result occupies the unit of 3 consecutive addresses starting with (d). Please be careful not to overlap with other
controlled devices. In addition, when specifying the Y device, please set it not to exceed the actual number of Y point outputs.
Error code
Error code Content
4084H (s2) The input device exceeds the range of HSC0 to HSC7
4085H (s1)(s2) The read address exceeds the device range
4086H (d) The write address exceeds the device range
2406H The number of high-speed counter interrupts exceeds 100
4F81H DHSCS,SHSCR and DHSZ runs,but OUT HSC does not program
Example
To configure the high-speed counter, use HSC0 as an example.
Scanner
Execution results
7 Basic instructions
7.1 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
Parameter Content Range Data type Data type (label)
(s) Transmit source data or the device number stored data -32768 to 32767 Signed BIN16 ANY16_S
(d) Transmit destination device number - Signed BIN16 ANY16_S
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ● ●●●● ● ●● ● ●
MOV
Parameter 2 ● ● ● ●●●● ● ● ●
Features
• Transfer the BIN 16-bit data specified in (s) to the device specified in (d).
Error code
Error code Content
4085H The output result of (s) in read application instruction exceeds the device range
4086H The output result of (d) in write application instruction exceeds the device range
Example
Error code
Error code Content
4085H The output result of (s) in read application instruction exceeds the device range
4086H The output result of (d) in write application instruction exceeds the device range
Example
When M0 is set, the value of (D1, D0) is transferred to the value of (D3, D2): (D1, D0) → (D3, D2).
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 code Content
4084H In application instruction (n) input the data exceeds the specified range
4085H The output results of (s) and (n) in read application instruction exceed the device range
4086H The output result of (d) in write application instruction exceeds the device range
Example
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 code Content
4084H (s) and(n) input the data In application instruction exceed the specified range
4085H The output results of (s) and (n) in read application instruction exceed the device range
4086H The output result of (d) in write application instruction exceeds the device range
Example
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 code Content
4084H (s) and (n) input the data In application instruction exceed the specified range
4085H The output results of (s) and (n) in read application instruction exceed the device range
4086H The output result of (d) in write application instruction exceeds the device range
Example
When M0 is set, the value of (D1, D0), (D3, D2), (D5, D4), (D7, D6), (D9, D8) is set to 0.
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.
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.
When the number of digits of the device with the specified digit is 4 points, other digits are not affected.
Error code
Error code Content
4085H The output result of (s) in read application instruction exceeds the device range
4086H The output result of (d) in write application instruction exceeds the device range
Example
Example 1:
When M0 is set, the value of D0 is inverted and transferred to the value of D2.
Example 2:
invert input acquisition:
When the number of digits of the device with the specified digit is 4 points, other digits are not affected.
Error code
Error code Content
4085H The output result of (s) in read application instruction exceeds the device range
4086H The output result of (d) in write application instruction exceeds the device range
Example
When M0 is set, the value of (D1, D0) is reversed and transferred to the value of (D3, D2).
(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 code Content
4085H The output results of (s1) and (s2) in read application instruction exceed the device range
4086H The output result of (d) in write application instruction exceeds the device range
Example
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.
85 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
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
Parameter Content Range Data type Data type (label)
Comparison value data or the device storing Signed
(s1) -2147483648 to 2147483647 ANY32_S
the comparison value data BIN32
Comparison source data or the device storing Signed
(s2) -2147483648 to 2147483647 ANY32_S
the comparison source data BIN32
(d) Start bit device for output comparison result Bit ANYBIT_ARRAY
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ● ●●●● ● ● ● ●● ● ●
DCMP 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.
(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 code Content
4085H The output results of (s1) and (s2) in read application instruction exceed the device range
4086H The output result of (d) in write application instruction exceeds the device range
Example
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.
86 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
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
Parameter Content Range Data type Data type (label)
(d1) The start device that stores the exchange data -32768 to 32767 Signed BIN16 ANY16_S
(d2) The start device that stores the exchange data -32768 to 32767 Signed BIN16 ANY16_S
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ●●●● ● ● ●
XCH
Parameter 2 ● ● ● ●●●● ● ● ●
Features
• Exchange the BIN 16-bit data of (d1) and (d2).
• 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.
✎Note: If continuous execution instructions are used, conversion will be performed every operation cycle.
Error code
Error code Content
4084H In exchange mode, the devices in (d1) and (d2) are different
4085H The output results of (d1) and (d2) in the read application instruction exceed the device range
4086H The 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.
• 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).
✎Note: If continuous execution instructions are used, conversion will be performed every operation cycle.
Error code
Error code Content
4084H In exchange mode, the devices in (d1) and (d2) are different
4085H The output results of (d1) and (d2) in the read application instruction exceed the device range
4086H The 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 (D1, D0) and the value of (D3, D2) are exchanged.
(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 code Content
4085H The output results of (s1), (s2) and (s3) in the read application instruction exceed the device range
4086H The output result of (d) in write application instructions exceeds the device range
Example
(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 code Content
4085H The output results of (s1), (s2) and (s3) in the read application instruction exceed the device range
4086H The output results of (d) in the write application instruction exceeds the device range
Example
(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
Device Name Content
SM151 Carry It 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).
4086H The output result of (d) in the write application instruction exceeds the device range
Example
(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
Device Name Content
SM151 Carry It turns ON when the last bit shifted from the lowest is 1.
✎Note:
(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
SM151 Carry It 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 code Content
4084H A negative value is specified in (n)
4085H The output results of (d) and (n) in the read application instruction exceed the device range
4086H The 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 4 bits to get 12288.
(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
Devices Name Content
SM151 Carry It 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 code Content
4084H A negative value is specified in (n).
4085H The output results of (d) and (n) in the read application instruction exceed the device range
4086H The 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.
96 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
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
Parameter Content Range Data type Data type (label)
(d) The device start number for cycle shift left - Signed BIN 16 bit ANY16
(n) The number of times to cycle shift left 0 to 15 Signed BIN 16 bit ANY16
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ●●●● ● ● ●
ROL
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.
(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
Device Name Content
SM151 Carry It 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 code Content
4084H A negative value is specified in (n).
4085H The output results of (d) and (n) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
(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
Device Name Content
SM151 Carry It 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 code Content
4084H A negative value is specified in (n).
4085H The output results of (d) and (n) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
(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
Device Name Content
SM151 Carry It 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 code Content
4084H A negative value is specified in (n).
4085H The output results of (d) and (n) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
(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
Devices Name Content
SM151 Carry 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 code Content
4084H A negative value is specified in (n).
4085H The output results of (d) and (n) in the read application instruction exceed the device range
4086H The 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, carry the value in the D0 device to the left by 4 bits to get 24.
100 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
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
Data type
Parameter Content Range Data type
(label)
(s) The start number of the device storing the shifted data after shifting - Bit ANY_BOOL
(d) The shifted device start number - Bit ANY_BOOL
(n1) The length of shifted data 0 to 32767 Signed BIN 16 bit ANY16
(n2) Number of shifts 0 to 32767 Signed BIN 16 bit ANY16
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ● ● ● ● ●
SFTR 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.
Error code
Error
Content
code
When the value specified in (n1) and (n2) exceeds the range of 0 to 32767
4084H 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.
4085H When the device specified in read application instructions (s), (d), (n1) and (n2) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
Error Code
Error
Content
code
When the value specified in (n1) and (n2) exceeds the range of 0 to 32767
4084H 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.
4085H When the device specified in read application instructions (s), (d), (n1) and (n2) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
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.
When (N)=6
When a bit device is specified in (d), the device range
specified in the digit specification is shifted to the right.
(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
Device Name Content
SM151 Carry Set to ON/OFF according to the state of n-1 bit (1/0)
Error code
Error code Content
4084H A negative value is specified in (n).
4085H The output results of (d) and (n) in the read application instruction exceed the device range
4086H The 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.
Before execution:
After execution:
When a bit device is specified in (d), the left shift is performed in the device range specified in the digit specification.
Before execution:
After execution:
Related device
Devices Name Content
SM151 Carry When the operation result exceeds 32,767, the carry flag will be (ON).
SM152 Borrow When the operation result is less than -32,768, the borrow flag will be (ON).
SM153 Zero point When the operation result is 0, the zero flag will be (ON).
✎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
INC/INCP/DINC/DINCP instructions
instructions
Flag bit (zero, borrow, carry) Action No action
16-bit (S) + (+1) = (d) 32767 → 0 → +1 → +2 → 32767→-32768→-32767
operation
Calculation result (S) + (-1) = (d) ← -2 ← -1 ← 0 ← -32768 ——
Error code
Error code Content
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
Add 10 to the data in (D0), and store the operation result in (D2), that is, (D0) + 10 → (D2).
Related device
SM151 Carry When the operation result exceeds 32,767, the carry flag will be (ON).
SM152 Borrow When the operation result is less than -32,768, the borrow flag will be (ON).
SM153 Zero point When the operation result is 0, the zero flag will be (ON).
✎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
INC/INCP/DINC/DINCP instructions
instructions
Flag bit (zero, borrow, carry) Action No action
Error code
Error code Content
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
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).
Related device
Devices Name Content
SM151 Carry When the operation result exceeds 32,767, the carry flag will be (ON).
SM152 Borrow When the operation result is less than -32,768, the borrow flag will be (ON).
SM153 Zero point When the operation result is 0, the zero flag will be (ON).
✎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.
112 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
SUB/SUBP/DSUB/DSUBP
DEC/DECP/DDEC/DDECP instructions
instructions
Flag bit (zero, borrow, carry) Action No action
16-bit operation (S)-(+1)=(d) ←-2←-1←0←-32768 -32768→+32767→32766
Calculation result (S)-(-1)=(d) +32767→0→+1→+2→ ——
result 32-bit operation (S)-(+1)=(d) ←-2←-1←0←-2147483648 -2147483648→2147483647→2147483646
result (S)-(-1)=(d) 2147483647→0→+1→+2→ ——
Error code
Error code Content
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
Subtract 10 from the data in D0, and store the calculation result in D2, that is, (D0)-10 → (D2).
SM151 Carry When the operation result exceeds 2,147,483,647, the carry flag will be ON.
SM152 Borrow When the operation result is less than -2,147,483,648, the borrow flag will be ON.
SM153 Zero point When the operation result is 0, the zero flag will be ON.
✎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
DEC/DECP/DDEC/DDECP instructions
instructions
Flag bit (zero, borrow, carry) Action No action
16-bit (S)-(+1)=(d) ←-2←-1←0←-32768 -32768→32767→32766
Calculation operation result (S)-(-1)=(d) +32767→0→+1→+2→ ——
result 32-bit (S)-(+1)=(d) ←-2←-1←0←-2147483648 -2147483648→2147483647→2147483646
operation result (S)-(-1)=(d) +2147483647→0→+1→+2→ ——
Error code
Error code Content
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
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).
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
Multiply the data in (D0) by (D2), and store the operation result in (D5, D4), that is, (D0) × (D2) → (D5, D4).
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
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)).
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 code Content
4080H The input of divisor (s2) is 0
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
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) → (D4(quotient)) (D5( remainder)).
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 code Content
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).
• 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 code Content
4085H The output results of (d) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
Add one to the device value specified in D0, that is, (D0) + 1 → (D0).
• 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 code Content
4085H The output results of (d) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
Add one to the device value specified in (D1, D0), that is, (D1, D0) + 1 → (D1, D0).
• 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 code Content
4085H The output results of (d) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
Each time M0 is set, the value of the device specified in D0 will be -1, (D0)-1 → (D0).
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 code Content
4085H The output results of (d) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
Minus one on the device value specified in (D1, D0), that is, (D1, D0)-1 → (D0).
✎Note: If the continuous execution (NEG) instruction is used, every operation cycle will be inverted, so care should be taken.
Error code
Error code Content
4085H The output results of (d) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
In the two examples below, if D2=K4 and D4=K8, or D2=K8 and D10 is always K4.
Each time M0 is set, the device value specified in D0 is reversed.
DNEG/32-bit complement
DNEG(P)
After inverting the sign of the BIN 32-bit device specified in (d), store it in the device specified in (d).
-[DNEG (d)]
Content, range and data type
Data type
Parameter Content Range Data type
(label)
(d) The start device that stores the data complement of 2 -2147483648 to 2147483647 Signed BIN16 ANY16_S
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
DNEG Parameter 1 ● ● ● ● ●●●● ● ● ● ● ●
Features
• Invert the sign of the BIN 32-bit device specified in (d) and store it in the device specified in (d).
• Used when inverting positive and negative signs.
✎Note:
If you use continuous execution (DNEG) instructions, every operation cycle will be inverted, so care should be taken.
Error code
Error code Content
4085H The output results of (d) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
Each time M0 is set, the device value specified in (D1, D0) is reversed.
In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
Error code
Error code Content
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
When M0 is set, (D0) and (D2) are logically performed, and the value is stored in (D4), that is (D0)∨(D2) → (D4)
In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
Error code
Error code Content
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
When M0 is set, (D1, D0) and (D3, D2) are logically performed, and the value is stored in (D5, D4), that is, (D1, D0)∨(D3, D2) → (D5,
D4) ).
In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
Error code
Error code Content
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
When M0 is set, the logical AND operation of (D0) and (D2) is performed, and the value is stored in (D4), that is, (D0) ∧ (D2) → (D4).
In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
Error code
Error code Content
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
When M0 is set, perform logical AND operation of (D1, D0) and (D3, D2), and store the value in (D5, D4), (D1, D0) ∧ (D3, D2) → (D5,
D4) .
In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
Error code
Error code Content
4085H The output results of (s1) and (s2) in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
Example 1: When M0 is set, (D0) and (D2) are XOR operation, and the value is stored in (D4), (D0)∀(D2)→(D4).
Example 2: When used with the CML instruction, it can realize the logic exclusive OR (XORNOT) operation:
In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
Error code
Error code Content
4085H The output results of (s1) and (s2)in the read application instruction exceed the device range
4086H The output result of (d) in the write application instruction exceeds the device range
Example
When M0 is set, (D1, D0) and (D3, D2) are XOR operation, and the value is stored in (D5, D4), that is, (D1, D0) ∀ (D3, D2) → (D5, D4) )
Features
• 8-digit device → decimal device
Error code
Error code Content
4085H When reading the specified device range exceeds the corresponding device range
4086H When the specified device range for writing exceeds the range of the corresponding device
(s2) Calculate the initial 16-bit regions of BCC - BIN16 bit ANY16_S
Error code
Error code Content
4084H The read application instructions (s1) and (s3) input the data that exceeds the specified range
4085H The device specified in the read application instructions (s1), (s2) and (s3) exceeds the corresponding device range
4086H The device specified in the write application instruction (d) exceeds the corresponding device range
Example
When the trigger M0 is ON, calculate the a block check code (BCC) of 12-bit bytes of ASCII data starting from data register D0 by
“exclusive or operation”. The block check code (BCC) is stored in the low bit byte of data register D6.
Application example
In the example ,calculate the BCC code and send as information after adding to the string “%01→RC”.
The data transmission is carried out in the form of ASCII codes.
CC calculations use logical exclusive OR, addition, and subtraction.
Data register D6 D2 D1 D0
ASCII hexadecimal code 4 3 5 2 2 3 3 1 3 0 2 5
ASCII code C R # 1 0 %
↑
BCC check code 6 byte
BCC instruction is as below: Execution or operation
a b OR result
0 0 0
S1: logic exclusive OR 0 1 1
S2: The start of destination data 1 0 1
S3: destination data length
1 1 0
D: calculation result
After the execution BCC code is stored in the last byte of D6.
How to calculate block check code (BCC)
Calculate block check code (BCD) with XOR for each ASCII code.
BCC code
(s2) Device that stores the end address when getting the max data -32768 to 32767 Signed BIN16 ANY16_S
(d) Stores the max value between the device data of (s1) and (s2) -32768 to 32767 Signed BIN16 ANY16_S
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
(s1) ●●●● ● ● ●
MAX (s2) ●●●● ● ● ●
(d) ●●●● ● ● ●
Features
Use the BIN16 bit data specified in (s1) as the start address, and use the BIN16 bit data specified in (s2) as the end address to get the
maximum value between the device of (s1) and (s2).
✎Note
1 The devices specified by (s1) and (s2) should be the same type. The type of device (d) that gets the results could be different.
2 The device size specified by (s1) can’t exceed the device size specified by (s2). For example, MAX D1 D5 D10 works, but MAX
D5 D1 D10 doesn't.
Error code
Error code Content
4084H The read application instructions (s1) and (s2) input the data that exceeds the specified range
4085H The device specified in the read application instructions (s1) and (s2) exceeds the device range
4086H The device specified in the write application instruction (d) exceeds the device range
4093H The specified ranges (s1) and (s2) are not the same device
4094H The sequence of specified ranges (s1) and (s2) is abnormal
Example
Use (D1) as the start address, and use (D5) as the end address to get the max value between them and store the result in (D6). As the
figure above, the max value between (D1) and (D5) is the value in (D3) which is stored in (D6) for output.
(s2) Device that stores the end address when getting the minimum data -32768 to 32767 Signed BIN16 ANY16_S
(d) Stores the minimum value between the device data of (s1) and (s2) -32768 to 32767 Signed BIN16 ANY16_S
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
(s1) ●●●● ● ● ●
MIN (s2) ●●●● ● ● ●
(d) ●●●● ● ● ●
Features
Use the BIN16 bit data specified in (s1) as the start address, and use the BIN16 bit data specified in (s2) as the end address to get the
maximum value between the device of (s1) and (s2).
✎Note
1 The devices specified by (s1) and (s2) should be the same type. The type of device (d) that gets the results could be different.
2 The device size specified by (s1) can’t exceed the device size specified by (s2). For example, MAX D1 D5 D10 works, but MAX
D5 D1 D10 doesn't.
Error code
Error code Content
4084H The read application instructions (s1) and (s2) input the data that exceeds the specified range
4085H The device specified in the read application instructions (s1) and (s2) exceeds the device range
4086H The device specified in the write application instruction (d) exceeds the device range
4093H The specified ranges (s1) and (s2) are not the same device
4094H The sequence of specified ranges (s1) and (s2) is abnormal
Example
Use (D1) as the start address, and use (D5) as the end address
to get the max value between them and store the result in (D6).
As the figure above, the max value between (D1) and (D5) is the
value in (D3) which is stored in (D6) for output.
Related device
Devices Name Content
SM249 Signal alarm is valid After SM249 is ON, the following SM248 and SD249 act.
SM248 Signal alarm action SM249 is ON, when any one of the states S900 to S999 is active, SM248 is ON.
SD249 Signal alarm ON state minimum number Save the smallest number of actions in S900 to S999.
✎Note:
If you use the ANR instruction, reset in sequence every cycle.
If the ANRP instruction is used, it will be executed in only one operation cycle.
Error code
No operation error.
Example
The fault number is displayed by the signal alarm.
As shown below, when you write a program for diagnosing external faults, such as monitoring the content of SM249 (the smallest
number in the ON state), the smallest number in the ON state among S900 to S999 will be displayed. When multiple faults occur at
the same time, the next fault number can be obtained after eliminating the fault with the smallest number.
Monitoring is effective after SM249 is turned ON
Detect X1 for 2 seconds, turn ON, set S900
Error code
Error code Content
4084H The data input in (n) exceeds the specified range of 0 to 15.
4085H When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
Error code
Error code Content
4084H The data input in (n) exceeds the specified range of 0 to 31.
4085H When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
When n in D0 = the third bit is 1 (ON), M0 is set to 1 (ON).
When (n)=0, it will be no processing, and the content of the device specified in (d) will not change.
Bit devices are treated as 1 bit, and word devices are treated as 16 bits.
When multiple digits are 1, it will be processed at the upper position.
Error code
Error code Content
In the bit device specification of (s), when (n) is other than 0 to 8.
4084H In the word device specification of (s), when (n) is other than 0 to 4.
When the data of 2(n) bits starting from (s) are all 0.
4085H When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
Error code
Error code Content
In the bit device specification of (d), when (n) is other than 0 to 8.
4084H
In the word device specification of (d), when (n) is other than 0 to 4.
4085H When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
Error code
Error code Content
4085H When the device specified in the read application instructions (s) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
When M0 is ON, the number of ON bits in D0 is counted and stored in D1. The value after D1 is executed is 4.
✎Note:
When the instruction input is OFF, the instruction will not be executed, and the output of the ON digits of the action will remain the
same as before.
Error code
Error code Content
4085H When the device specified in the read application instructions (s) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
When M0 is ON, the number of ON bits in D0 is counted and stored in D10, and the value after D10 is executed is 4.
Error code
Error code Content
4084H The data input by (n) in the application instruction exceeds the specifiable range. N≤0
4085H When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
Add the data of D0, D1, and D2 and save the value obtained after dividing by 3 in D10. The calculated average value is 6.
✎Note:
When the device number exceeds, (n) is handled as a smaller value within the allowable range.
Error code
Error code Content
4084H The data input in (n) exceeds the specifiable range. N≤0
4085H When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
Add the data of D0, D2, and D4, and save the value obtained after dividing by 3 in D10 and D11, and the calculated average value is 6.
✎Note:
The decimal point of operation result will be rounded off and become an integer. If rounding occurs, SM152 (borrow flag) turns ON.
When the operation result is really 0, SM153 (zero flag) turns ON.
Error code
Error code Content
4084H When a negative value is specified in (s).
4085H When the device specified in the read application instructions (s) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
The square root of D0 is stored in D2, and the value of D0 is 100, so the value of D2 is 10.
✎Note:
The decimal point of operation result will be rounded off and become an integer. If rounding occurs, SM152 (borrow flag) turns ON.
When the operation result is really 0, SM153 (zero flag) turns on.
Error code
Error code Content
4084H When a negative value is specified in (s).
4085H When the device specified in the read application instructions (s) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
The square root of D0 is stored in D2, and the value of D0 is 110, so the value in the D2 soft component is 10 (the fractional part is
discarded), and the borrow flag SM152 is turned ON.
Error code
Error code Content
4084H When a negative value is specified in (n).
4085H When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
When M0=ON, the total of 16-bit data of D0 to D2 is saved in [D100, D101], and the accounting result is 18.
✎Note:
When the number of bits is specified in (d), the value of n ranges from 1 to 8, such as K8 (32-bit instructions, such as K8M0) without
K16 (64-bit instructions).
Error code
Error code Content
4084H When a negative value is specified in (n).
4085H When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
When M0=ON, the total of 16-bit data of D0 to D2 is saved in [D100, D101], and the accounting result is 18.
4085H When the device specified in read application instruction (s), (n1), (n2 )and (n3) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
4087H When the (d) parameter in the application instruction uses an unsupported device
Error code
Error code Content
When the value specified in (n1) exceeds the range of 1 to 32
4084H When the value specified in (n2) exceeds the range of 1 to 6
When the value specified in (n3) exceeds the range of 1 to n2
When the device specified in read application instruction (s), (d), (n1), (n2 )and (n3) exceeds the corresponding
4085H
device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
4089H The number of application instructions exceeded the limit.
Example
Refer to the function description example.
Error code
Error code Content
When the value specified in (n1) exceeds the range of 1 to 32
4084H When the value specified in (n2) exceeds the range of 1 to 6
When the value specified in (n3) exceeds the range of 1 to n2
When the device specified in read application instruction (s), (d), (n1), (n2 )and (n3) exceeds the corresponding
4085H
device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
4089H The number of application instructions exceeded the limit.
Example
Refer to the function description example.
Error code
Error code Content
4085H When the device specified in the read application instruction (d) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
When the rising edge of M0 is triggered, swap the low 8 bits and high 8 bits of D0 to get H8F2A.
✎Note:
If continuous execution instructions are used, conversion will be performed every scan cycle.
Error code
Error code Content
4085H When the device specified in the read application instruction (d) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
When the rising edge of M0 is triggered, the low 8 bits and the high 8 bits of D0 and D1 are swapped, and D0=H8F2A, D1=H3412 are
obtained.
Even if the device range storing the data before merging overlaps the device rangestoring merged data, it will be handled as normal.
Device range storing the data before merging Device range for storing merged data
(S)+0 to (s)+(n)-1 (D) to (d) + (n/2-1)
Error code
Error code Content
4084H The value specified in (n) exceed range of 0 to 32767
4085H When the device specified in the write application instruction (s),(d) and (n) exceeds the corresponding device range
Example
When M0 is ON, the data of D20 to D25 is separated according to byte units, and then stored in D10 to D12.
(1)High byte;
(2)Low byte;
(3)High byte data;
(4)Low byte data;
(5)*1: Carry below the decimal point.
Example
In the case of (n)=5, store the data up to the lower 8 bits of (s) to (s)+2 in (d) to (d)+4:
(1)(N)=5 is ignored.
(2)(N)=5.
By setting the number of bytes in (n), the range of BIN 16-bit data specified in (s) and the range of the device storing the byte data
specified in (d) will be automatically determined.
When the number of bytes specified in (n) is 0, no processing is performed.
Even if the device range storing the data before merging overlaps the device rangestoring merged data, it will be handled as normal.
Device range storing the data before merging Device range storing separated data
(s) to (s) + (n/2-1) (d)+0 to (d)+(n)-1
Error code
Error code Content
4084H The value specified by (n) exceed the range of 0 to 32767
4085H When the device specified in read application instruction (s) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
When M0 is ON, the data of D10 to D12 are separated according to byte units, and then stored in D20 to D25.
The hig-12 bit of the point (n) starting from the device specified in (s) will become 0.
When (n)=0, it will become no processing, and the content of point (n) starting from the device of (d) will not change.
Error code
Error code Content
When M0 is ON, D0 is separated every 4 bits and stored in D10 to D12. The result is D10 = HF, D11 = H8, D12 = HA.
The high (4-n) bits of the device specified in (d) will become 0.
When (n)=0, it will become no processing, and the content of the device in (d) will not change.
Error code
Code Content
4084H The data in (n) exceed the range of 0 to 4
4085H When the device specified in read application instruction (s) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
When M0 is ON, the low 4 bits of D0 to D3 are combined and stored in D10, the value is H236F.
As a separate reset instruction for the device, the RST instruction can be used for bit devices or word devices.
Reset M0
Reset the current value of T0
Reset D0
The batch write instruction of constant (for example: K0) has FMOV (P) instruction, which can write 0 to word devices (including bit
device specification).
Write K0 in D0 to D99.
✎Note:
Please specify the same type number for (d1) and (d2), and make (d1) number <(d2) number. When (d1) number ≥ (d2) number, only
1 point will be reset for the device specified in (d1).
ZRST(P) instruction is a 16-bit instruction, which can specify (LC) and (HSC) devices for (d1) and (d2).
The function of this Circuit program instruction is to set the value of the D0 to D100 device to 0.
·As a separate set instruction for the device, the SET instruction can be used for bit devices.
Set M1
Set Y1
Set S1
✎Note:
Please specify the same type number for (d1) and (d2), and make (d1) number <(d2) number. When (d1) number ≥ (d2) number, only
1 point will be set for the device specified in (d1).
Error code
Error code Content
4084H When the device type specified in (d1) is different from the device type specified in (d2).
4085H When the device specified in the read application instruction (d1) and (d2) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d1) exceeds the corresponding device range
4087H When the device type specified in (d1) and (d2) are not bit device.
Example
The function of this LAD instruction is to set the value of the M1 to M4 device to ON.
CRC-12 X12+X11+X3+X2+X+1
CRC-16 X16+X15+X2+1
CRC-32 X32+X26+X23+X22+X16+X12+X11+X10+X8+X7+X5+X4+X2+X+1
CRC-CCITT X16+X12+X5+1
✎Note:
When (s1) use KnX, KnY, KnM, KnS, n must be specified as 4.
Error code
Error code Content
4084H The range of (n) exceeds 1 to 256
4085H The data address of (s) to be converted exceeds the device range
4086H The (d) write address exceeds the device range
CRC value
CRC value generation object data storage target
storage target
CRC-XMODEM 16-bit mode (s) (s)+1 (s)+2 ... (s)+(n)/2-1 (d)
Low High Low High Low High Low High Low High
Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte
(s)=D100, Device D100 D100 D101 D101 D102 D102 D0 D0
CRC value
CRC value generation object data storage target
storage target
CRC-XMODEM 8-bit
(s) (s)+1 (s)+2 (s)+3 (s)+4 (s)+5 ... (s)+(n)-1 (d) (d)+1
mode
Low Low Low Low Low Low Low Low Low
Byte Byte Byte Byte Byte Byte Byte Byte Byte
D100 D101 D102 D103 D104 D105
Device - - D0 D1
Low Low Low Low Low Low
(s)=D100,
Contents
(d)=D0,(n)=6
of object 01H 03H 03H 02H 00H 14H 7BH 0CH
data
The CRC value (CRC-CCITT) in the CRC-XMODEM(P) instruction uses "X16+X12+X5+1" in the generating polynomial, but there are
many standardized generating polynomials for CRC values. If this generating polynomial is different, it will become a completely
different CRC value and should be noted. The main generating polynomials for CRC values are shown below.
Name Generator polynomial
CRC-12 X12+X11+X3+X2+X+1
CRC-16 X16+X15+X2+1
CRC-32 X32+X26+X23+X22+X16+X12+X11+X10+X8+X7+X5+X4+X2+X+1
CRC-CCITT X16+X12+X5+1
✎Note:
When (s1) use KnX, KnY, KnM, KnS, n must be specified as 4.
Error code
Error code Content
4084H The range of (n) exceeds 1 to 256
4085H The data address of (s) to be converted exceeds the device range
4086H The (d) write address exceeds the device range
LRC value
LRC value generation object data storage target
storage target
LRC 16-bit mode
(s) (s)+1 (s)+2 ... (s)+(n)/2-1 (d)
D100 D101 D102 D(s)+(n)/2-1 D0
Low High Low High Low High Low High Low High
Device
(s)=D100,(d)=D0, Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte
(n)=6 Contents of 8-bit 01H 03H 03H 02H 00H 14H E3H 00H
object data 16-bit 0301H 0203H 1400H 00E3H
(1) 8-bit conversion mode (when SM161=ON)
In the 8-bit conversion mode, only the low 8 bits (low byte) of the device of (s) are operated. The result uses 2 points from the soft
component specified in (d), storing the low 8 bits (bytes) in (d) and the high 8 bits (bytes) in (d) + 1.
In the case of the following program, the conversion is executed as follows
LRC value
LRC value generation object data storage target
storage target
LRC 8-bit mode (s) (s)+1 (s)+2 (s)+3 (s)+4 (s)+5 ... (s)+(n)-1 (d) (d)+1
Low Low Low Low Low Low Low Low Low
Byte Byte Byte Byte Byte Byte Byte Byte Byte
D100 D101 D102 D103 D104 D105
Device D0 D1
Low Low Low Low Low Low
(s)=D100,
Contents
(d)=D0,(n)=6
of object 01H 03H 03H 02H 00H 14H E3H 00H
data
✎Note:
When (s1) use KnX, KnY, KnM, KnS, n must be specified as 4.
Error code
Error code Content
4084H The range of (n) exceeds 1 to 256
4085H The data address of (s) to be converted exceeds the device range
4086H The (d) write address exceeds the device range
LRC operation is performed on the high 8 bits (bytes) and low 8 bits (bytes) of the 6 device starting at (D100). The result is stored to
the 16 bits of the (D0) soft component.
The low 8 bits (low byte) of the 6 device from (D100) are operated. The result uses 2 points from (D0) designated device, and stores
the low 8 bits (bytes) in (D0) and the high 8 bits (bytes) in (D1).
The standard deviation of the 5 device (16-bit data units) starting from the device specified in (D1) is calculated, and the result of the
calculation is stored in (D10).
The standard deviation of the 5 device (16-bit data units) starting from the device specified in (D1,D2) is calculated, and the result of
the calculation is stored in (D20,D21)
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 point Falling edge point
Object output
- Data value (example) - Data value (example)
(S1) 40 (S1)+1 140 (D)
(S1)+2 100 (S1) +3 200 (D) +1
(S1) +4 160 (S1) +5 60 (D) +2
(S1) +6 240 (S1) +7 280 (D) +3
... ... ...
- -
(S1)+2(n)-2 (S1)+2(n)-1 (D) +n-1
✎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 code Content
4084H When the value specified in (n) exceeds the range of 1 to 64
4085H When the device specified in the read application instruction (s1), (s2 )and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
Refer to the example in the function description.
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 point Falling edge point
Object output
- Data value (example) - Data value (example)
(S1)+1, (S1) 40 (S1)+3, (S1)+2 140 (D)
(S1)+5, (S1)+4 100 (S1) +7, (S1) +6 200 (D) +1
(S1) +9, (S1) +8 160 (S1)+11, (S1)+10 60 (D) +2
(S1) +13, (S1) +12 240 (S1) +15, (S1) +14 280 (D) +3
... ... ...
(S1)+4(n)-3, - (S1)+4(n)-1, -
(D) +n-1
(S1)+4(n)-4 (S1)+4(n)-2
✎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 code Content
4084H When the value specified in (n) exceeds the range of 1 to 64
4085H When the device specified in the read application instruction (s1), (s2 )and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
Refer to the example in the function description.
✎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 code Content
4084H When the value specified in (n) exceeds the range of 0 to 256
4085H When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
Refer to the example in the function description.
(n) Search the number of same data, maximum and minimum 1 to 128 Signed BIN 32 bit ANY32
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ● ●●●● ● ● ● ● ●
DSER 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.
193 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
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)
search results
The searched The value of the Comparison data Data
Maximum Minimum
device (S1) searched data (S1) (S2) value location Consistent (d)
value (d) +4 value (d+3)
(S1)+1, (S1) K100 0 ○ (First time)
(S1)+3, (S1)+2 K111 1
(S1)+5, (S1)+4 K100 2 ○
(S1) +7, (S1) +6 K98 3
(S1) +9, (S1) +8 K123 4
K100
(S1)+11, (S1)+10 K66 5 ○
(S1) +13, (S1) +12 K100 6 ○ (final)
(S1) +15, (S1) +14 K95 7
(S1) +17, (S1) +16 210 8 ○
(S1) +19, (S1) +18 K88 9
• The search result table based on the above example is shown below.
Device number Content Search result items
(d)+1, (d) 3 Number of identical data
(d)+3, (d)+2 0 The position of the same data (first time)
(d) +5, (d) +4 6 The position of the same data (last time)
(d) +7, (d) +6 5 The final position of the minimum
(d) +9, (d) +8 8 The 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 code Content
4084H When the value specified in (n) exceeds the range of 0 to 128
4085H When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
Refer to the example in the function description.
✎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 code Content
4085H When the device specified in the read application instruction (d) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
• It is assumed that the following data is written using the transfer instruction in advance.
Storage device Output
- Data value (example) - Example
(S1) D300=20 (D) M0
(S1)+1 D301=30 (D) +1 M1
(S1)+2 D302=10 (D) +2 M2
(S1) +3 D303=40 (D) +3 M3
... .... ... ...
(S1)+(n)-1 - (D) +n-1 -
Example
Refer to the example in the function description.
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.
✎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 code Content
4084H When the value specified in (n) exceeds the specified range of 1 to 32767
4085H When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
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.
M1 Phase B signal
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.
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 code Content
4084H When the value specified in (s2) is less or equal to 0
4085H When the device specified in the read application instruction (s2) and (d) exceeds the corresponding device range
Example
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.
Y2: When X10 changes from Off to On, output Y2=On 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.
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:
For the time stored in (d), when the hold time is 0 (unit: second), the actual value of (d) is as follows according to the
magnification specified in (s).
(s) Magnification (D)
K0 0 (D) ×1
K1 10 0 (D)×10
K2 100 0 (D) ×100
✎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.
When X0 is closed, D10=D11; when X0 is opened, the value of D10 remains unchanged, while D11 becomes 0.
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
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)
z x C y / 100 (3)
A B z / 65.566 ( 4)
✎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 code Content
The value specified in (n) is out of the following range. 0 to 1
4084H The value specified in (d1) is out of the following range. 0 to 100
A negative value is specified in (s).
4085H The output result of (d1)(s)(d2)(n) in the read application instruction exceeds the device range
4086H The output result of (d1)(d2) in the writing application instruction exceeds the device range
Dry and wet bulb humidity comparison table
Example
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 code Content
4084H The input value of (s1)(s2) in the read application instruction exceeds the data range
4085H The input value of (s1)(s2) in the read application instruction exceeds the device range
4086H The 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
① 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.
①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.
(1) The digit specification of n displayed by the 7-segment digital tube with BCD code
A 4-digit (103 digit) is used as an example in the following operation description, .
(2) The action of the digit selection switch (S+2, S+3)
1) The action when input S+2 with reduced digits is ON.Each time the switch is pressed, the number of digits specification is
changed according to 103 →102 →101 →100 →103.
2) The action when the input S+3 with increased digits is ON. Each time the switch is pressed, the number of digits
specification is changed according to 103 → 100 → 101 → 102 → 103.
(3) The action of the LED for displaying the selected digits (D2+4 to D2+7). The specified number of digits can be displayed by LED
by strobe signal D2+4 to D2+7.
(4) The operation of the data change switch in units of digits (S, S+1). The data is changed for the number of digits specified by the
"digit selection switch" above.
1) Increase the action when the input is ON. Each time the switch is pressed, the content of D1 changes according to
0→1→2→...→8→9→0→1.
2) Reduce the action when the input is ON. Each time the switch is pressed, the content of D1 changes according to
0→9→8→7...1→0→9.
These contents can be displayed in the 7-segment digital tube display.
As shown above, through a series of operations, you can write the target value into D1 while viewing the 7-segment display.
✎Note:
1 The setting of parameter n
Please refer to the parameter setting of SEGL (FNC 74) instruction. The setting range is 0 to 3.
2 The output format of the programmable controller, please use a transistor output type programmable controller.
3 About scan time (operation cycle) and display timing
The ARWS instruction is executed synchronously with the scan time (operation cycle) of the programmable controller.
In order to perform a series of displays, the scan time of the programmable controller needs to exceed 10ms.
When it is less than 10ms, please use the constant scan mode and run with a scan time longer than 10ms.
4 Number of occupied points of the device
The input of the device s occupies 4 points.
The corresponding hardware wiring is shown in the figure below, and the PLC should be transistor output type:
(1) The digital tube in the figure shows the value of D0. Press X10 to X13 to modify the value. The value of D0 can only be between 0
and 9999.
(2) When X20 is ON, the cursor position is thousands. Each time the back key (X12) is pressed, the specified position is switched in
the order of "thousands → hundred → ten → pieces → thousand"; if the forward key (X13) is pressed, the switching sequence is
reversed; the cursor position is determined by the strobe pulse signal (YO04 to YOO7) LED indication of connection.
(3) For the cursor position, each time you press the increment key (X11), the content of the position changes by 0 → 1→
2→……8→9→0→1, and when you press the decrement key (X10), press 0 →9→8→7→…… 1→0→9 changes, the modified value takes
effect immediately.
Example
Program
Wiring diagram
✎Note
1 Restrictions on the number of uses of instructions
HKY instructions, only one of them can be used in the program.
2 When the keyboard is pressed simultaneously
When multiple keys are pressed at the same time, the key pressed first is effective.
3 When the instruction contact is OFF
Even if it is OFF, the content of D2 does not change, but D3 to D3 +7 all become OFF.
4 Number of occupied points of the device
When 16 keys are connected, 4 points from the start device S of input (X) are occupied.
When 16 keys are connected, 4 points from the start device D1 of output (Y) are occupied.
It occupies 8 points from the start device D3 for key information output.
Please do not to overlap with the devices used in other controls of the machine.
D3 to D3+5: A to F key key information
D3+6: Keyboard detection output of A to F keys
D3+7: 0-9 key keyboard detection output
5 About the read timing of keyboard input
HKY instruction is executed synchronously with the operation cycle of the programmable controller.
It takes 8 operation cycles to complete a series of keyboard scans.
In order to prevent reading omissions caused by the filter delay of keyboard input, please use the [Constant Scan Mode] and [Timer
Interrupt] functions flexibly.
6 6. Output form
Please use a transistor output type programmable controller.
Related device
Devices Name Content
OFF: (d1) to (d1)+3 is being scanned, or the instruction is not executed
SM229 End of instruction execution
ON: (d1) to (d1)+3 cyclic output operation (1 to 4 digit scan) and then turn ON
Error code
Error code Content
4085H The output result of the read application instruction (s) and (d2) exceeds the device range
4086H The output result of the write application instruction (d1), (d2) and (d3) exceeds the device range
Example
Program
4085H The output result of the read application instruction (s) and (d2) exceeds the device range
4086H The output result of the write application instruction (d1), (d2) and (d3) exceeds the device range
Example
Program
.Wiring diagram
Timing diagram
Related device
Devices Name Content
If the ASCII code in D200 to D203 is "Stopped", the corresponding output port signal and its timing are as follows:
✎Note
Number of occupied points of the device: The low 8 bits of the output of the device (S) are occupied, and the high 8 bits do not
change.
Error code
Error code Content
4085H The output result of the read application instruction (s) and (d) exceeds the device range
4086H The output result of the write application instruction (d) exceeds the device range
Example
When M0 is set, the lower 4 bits of the data in D0 are decoded and output to the Y10 to Y17 ports. The corresponding table for
translation is shown in the above table (7-segment code decoding table). The table does not need to be prepared by the user, and the
comparison table is already available in the PLC system.
SM229 End of instruction execution After the processing is completed, SM229 is ON for one scan cycle
Error code
Error code Content
4084H The data input in the application instruction (n) exceeds the specified range
4085H The output result of the read application instruction (s) exceeds the device range
4086H The output result of the write application instruction (d) exceeds the device range
The corresponding hardware wiring is shown in the following figure. The content of D0 is displayed on the first group of digital tubes,
and the content of D1 is displayed on the second group of digital tubes. If the reading of D0 or D1 exceeds 9999, the program will run
into an error:
The digital tube used in the wiring diagram has its own display data latch, 7-segment decoding and driving, and 7-segment digital of
negative logic type (when the input port is low, it means that the input data is 1, or is strobed) Show tube. During display processing,
PLC's Y4 to Y7 ports will scan automatically, and only one port is ON each time as a bit strobe signal. At this time, the data on Y0 to Y3
ports is the BCD code data sent to the corresponding bit. When the bit strobe signal turns from ON→OFF, it is latched into the latch in
the digital tube. After internal decoding and driving, the digital tube displays the number. The PLC system cyclically processes Y4 to Y7
in turn, until all 4 bits are processed. In the same way, Y10 to Y13 are the data output ports of the second group of 4-digit digital
tubes, which share the bit strobe lines of Y4 to Y7. The processing methods are the same, and the display processing of the two
groups is performed at the same time. In the example, if D0=K2468 and D1=K9753, the first group will display 2 4 6 8 and the second
group will display 9 7 5 3.
It takes 12 scan cycles to complete a display refresh. After the processing is completed: According to the positive and negative logic of
the programmable controller, the positive and negative logic of the seven-segment code, etc., select according to the following
principles:
For a group of 4 digits, n=0 to 3. When two groups of 4 digits, n= 4 to 7.
Display group number Group 1 Group 2
Y data output polarity PNP NPN PNP NPN
Strobe and data polarity Identical Opposite Identical Opposite Identical Opposite Identical Opposite
the value of n 0 1 2 3 4 5 6 7
To input the number "2013", press the keys 2, 0, 1, 3 (X2, X0, X1, X3) in order. The operation of the PLC internal variables is shown in
the figure below.
When multiple keys are pressed, the first detected key is valid;
when the input number exceeds 4 digits, the first input number
changes overflow, leaving only the last 4 numbers input.
✎Note
1 When the keyboard is pressed simultaneously
When multiple keys are pressed at the same time, only the key pressed first is effective.
2 When the command contact is OFF
Even if it is OFF, the content of (d2) will not change, but (d2) to (d2)+10 will be OFF.
3 Occupied points of the device
✎ Connect the input of the number keys, occupying 10 points from (s).
Even when the number key is not connected (not used), since (d2) is already occupied, it cannot be used for other purposes.
✎ It occupies 11 points from the start device (d2) for key information output.
Please be careful not to overlap with the devices used in other controls of the machine.
(D2) to (d2)+9: Turn ON according to the input of number keys 0 to 9.
4085H The output result of the read application instruction (s) and (d1) exceeds the device range
4086H The output result of the write application instruction (d1) and (d2) exceeds the device range
Example
When X20 is on, if you want to input the number "20205689", press 2, 0, 2, 0, 5, 6, 8, 9 (X2, X0, X2, X0, X5, X6, X10, X11) in sequence ,
Then (the value in (D1,D0) is 20205689)
The data specified in (s) can be converted in the range of K0 to K9999 by BCD (decimal number).
When the data specified in (s) or (d) is digit specification, the conditions are as shown in the table below.
4084H The data input in the application instruction (s) exceeds the specified range
4085H The output result of the read application instruction (s) exceeds the device range
4086H The output result of the write application instruction (d) exceeds the device range
Example
When M0 is set, the BIN value of D200 is converted into BCD and stored in K1Y0.
The data specified in (s) can be converted within the range of 0 to 9999 (BCD).
When the data specified in (s) or (d) is digit specification, the conditions are as shown in the table below.
✎Note
The calculations in the CPU module such as the four arithmetic operations (+-×÷), increment and decrement instructions are all
performed by BIN (binary number). Therefore, when sending BCD (decimal) digital switch information to the CPU module, please use
the BIN(P) command (BCD→BIN conversion transfer command). In addition, when outputting to the 7-segment display of BCD
(decimal number), please use the BCD(P) command (BIN→BCD conversion transmission).
Error code
Error code Content
4084H The data input in the application instruction (s) exceeds the specified range
4085H The output result of the read application instruction (s) exceeds the device range
4086H The output result of the write application instruction (d) exceeds the device range
Example
When M0 is set, the BCD value of K1Y0 is converted into BIN and stored in D200.
The data specified in (s) can be converted within the range of 0 to 99999999 (BCD).
When the data specified in (s) or (d) is digit specification, the conditions are as shown in the table below.
4084H The data input in the application instruction (s) exceeds the specified range
4085H The output result of the read application instruction (s) exceeds the device range
4086H The output result of the write application instruction (d) exceeds the device range
Example
When M0 is set, the BCD value of K8Y0 is converted into BIN and stored in D200.
✎Note
In each binary floating point number (real number) operation instruction, the specified K and H values will be automatically
converted into a binary floating point number (real number), so there is no need to use the FLT instruction for conversion.
The inverse conversion instruction of this instruction is INT (convert a binary floating point value into a BIN integer).
Error code
4085H When the device specified in the read application instruction (s) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
Four arithmetic using binary floating point operations
(1) Calculation example
(D21,D20)÷(D25,D24) → (D29,D28)
Binary floating-point number division operation
→Binary floating-point number operation
(D29,D28)×(D27,D26) → (D11,D10)
Binary floating-point number multiplication
(D11,D10) → (D13,D12)
Binary floating-point calculations →
Decimal floating-point calculations monitoring
(D11,D10) → (D13,D12)
Binary floating point operations 32-bit BIN integer
✎Note
In each binary floating-point number (real number) operation instruction, the specified K and H values are automatically converted
into a binary floating-point number (real number), so there is no need to use the DFLT instruction for conversion.
The inverse conversion instruction of this instruction is INT (convert a binary floating point value into a BIN integer).
Error code
Error code Content
4085H When the device specified in the read application instruction (s) exceeds the corresponding device range
4086H When the device specified in the write application instruction (d) exceeds the corresponding device range
Example
When M2=ON, convert the BIN 32-bit integer -7963590 in [D1, D0] into a single-precision floating point number -7963590.0 and store
it in the [D101, D100] device.
Error code
Error code Content
The character string specified by (s) could not be converted into a numeric value
For example:
The first character is not a negative sign or a space, space appears in the middle of the number, decimal point
4082H appears twice. Except for the first character that appears non-characters and decimal points, the number in the
symbolic string with the decimal point is removed and the range between -32768 and 32767 is exceeded
Except for the first character, there are non-character and decimal Signs
For example, 3.4000 is 34000 after removing the decimal point, which is out of range.
4085H (s) read address exceeds the device range
408AH When the character number of character string the specified in (s) is other than 2 to 8.
243 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
408BH The maximum range of the device is read when (s) taking character string, but 00H is not found as the end
4086H When using offset, the offset address of (d) exceeds the device range
Example
Error code
Error code Content
The character string specified by (s) could not be converted into a numeric value.
For example:The first character is not a negative sign or a space, space appears in the middle of the number, decimal
point appears twice. Except for the first character that appears non-characters and decimal points, the number in
4082H the symbolic string with the decimal point is removed and the range between -2147483648 and 2147483647 is
exceeded
Except for the first character, there are non-character and decimal Signs
For example, 3.000000000 is 3000000000 after removing the decimal point, which is out of range.
4085H (s) read address exceeds the device range
408AH When the character number of character string the specified in (s) is other than 2 to 13.
The maximum range of the device is read when (d1) and (d2) taking character string, but 00H is not found as the
408BH
end
4086H When using offset, the offset address of (d) exceeds the device range
Example
ASCII code
"0"=30H "1"=32H "5"=35H
"A"=41H "2"=32H "6"=36H
"B"=42H "3"=33H "7"=37H
"C"=43H "4"=34H "8"=38H
(n)
K1 K2 K3 K4 K5 K6 K7 K8 K9
(d)
D200 C B C 0 4 3 2 1 8
D201 C B C 0 4 3 2 1
D202 C B C 0 4 3 2
D203 C B C 0 4 3
D204 C B C 0 4
D205 Unchanged C B C 0
D206 C B C
D207 C B
D208 C
Bit structure in the case of (n)=K2
ASCII
"0"=30H "1"=31H "5"=35H
"A"=41H "2"=32H "6"=36H
"B"=42H "3"=33H "7"=37H
"C"=43H "4"=34H "8"=38H
4084H When the value specified in (n) exceeds the range of 1 to 256
Example
4085H When the specified device range is read to exceed the corresponding device range
4086H When the specified device range is written to exceed the corresponding device range
Example
After converting the ASCII data stored in the upper and lower 8 digits (bytes) of the device specified in (s) into HEX code, it transmits
every 4 digits to the device specified in (d). The number of characters to be converted is specified in (n).
SM161 is shared with ASC, ASCI, BCC, CCD and CRC instructions. When using in 16-bit conversion mode, please always set SM161 to
OFF.
CCD/Check code
CCD(P)
Calculate the horizontal parity value and the sum check value of the error checking method used in communication and the like. In
addition to these error checking methods, there are CRC (Cyclic
Redundancy Check). To calculate the CRC value, use the CRC(P) command.
-[CCD (s) (d) (n)]
Content, range and data type
Parameter Content Range Data type Data type (label)
(s) The start number of object device - BIN16 bit ANY16
The start number of the storage destination
(d) - BIN16 bit ANY16_ARRAY (number of elements: 2)
device of the calculated data
(n) Number of data 1 to 256 BIN16 bit ANY16_U
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ● ●●●● ● ● ●
CCD Parameter 2 ● ● ● ●●●● ● ● ●
Parameter 3 ●● ● ●● ●
Features
Calculate the addition data and horizontal parity data of the data stored in (s) to (s)+(n)-1, and store the addition data in (d),
horizontal parity
The data is stored in (d)+1. The modes used by this instruction in calculation are 16-bit mode and 8-bit mode. For the operation of
each mode, please refer to the following content.
1091 at BCD
Horizontal parity
1091 at BCD
Horizontal parity
Error code
Error code Content
4084H When the value specified in (n) exceed the range of 1 to 256.
4085H When the specified device range is read to exceed the corresponding device range
4086H When the specified device range is written to exceed the corresponding device range
Example
Regarding D10 as the initial 10-point data, the addition data and horizontal parity data of the high and low 8-bit data are stored in the
Devicess of D0 and D0+1.
SM161 is shared with ASC, ASCI, BCC, CCD and CRC instructions. When using in 16 bits, always set to OFF for use.
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ● ●●●● ● ●● ● ●
GBIN
Parameter 2 ● ● ● ●●●● ● ● ●
Features
Convert the BIN 16-bit Gray code data stored in the device specified in (s) into BIN 16-bit data, and store it in the device specified in
(d).
GRY→BIN Mathematical Algorithm: Starting from the second bit from the left, XOR each bit with the decoded value of the left bit as
the decoded value of the bit (the leftmost bit remains unchanged).
Error code
Error code Content
4086H When the specified device range is written to exceed the range of the corresponding device
Example
It could be used when the encoder of Gray code method is used to detect the absolute position.
For S, the numerical are valid in the range of 0 to 32767.
BIN→GRY Mathematical Algorithm: Starting from the rightmost bit, XOR each bit with the left bit as the value corresponding to the
GRY bit, and the leftmost bit remains unchanged (equivalent to 0 on the left) .
Error code
Error code Content
4086H When the specified device range is written to exceed the corresponding device range
Example
4086H When the specified device range is written to exceed the corresponding device range
Example
Error code
Error code Content
4085H When the specified device range is read to exceed the corresponding device range
4086H When the specified device range is written to exceed the corresponding device range
Example
For example:
259 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
sign: -
Index: 128-127=1
mantissa: 1 2 22 2 21 2 23 1 2 1 2 2 1 0.75 1.75
value: 1.75 2 3.5
1
Non-standard figures
A non-standard figure represents a real number with a very small absolute value. The sign bit is 0 for a positive number and 1
for a negative number.
The exponent (e) is 0 and the actual exponent is -126.
The mantissa (f) is represented from 0 to 223-1, in the actual mantissa, bit 223 is 0, and the binary decimal point immediately
follows it.
Non-standard figure are shown as below:
For example:
sign:-
Index:-126
mantissa: 0 2 22 2 21 2 23 0 2 1 2 2 0 0.75 0.75
Value: 0.75 2 126
Zero
+0.0 and -0.0 values can be represented by setting signs, 0 for positive numbers and 1 for negative numbers. Both the
exponent and the mantissa are 0. +0.0 and -0.0 are both equal to 0.0.
Infinity
+∞ and -∞ values can be represented by setting signs, 0 for positive numbers and 1 for negative numbers. The exponent is
255 (28-1) and the mantissa is 0.
NaN
NaN (not a number) is generated when calculations such as 0.0/0.0, ∞/∞, or ∞-∞ result in a value other than a number or
infinity. The exponent is 255 (28-1), and the mantissa is non-zero.
✎Note
No NaN sign or mantissa area value (not non-zero) defined.
Error code
Error code Content
The COS value specified in (s) can be set within the range of -1.0 to 1.0.
The angle (calculation result) stored in (d) stores the value from 0 to π in radians.
Related device are as follows:
Content
Devices Name
Condition Operation
SM153 Zero The operation result is zero The zero flag (SM153) turns ON.
The value of (d) becomes the minimum value of 32-bit real
SM152 Borrow The absolutevalue of operation result<2 -126
numbers (2 -126), and the borrow flag (SM152) turns ON.
Error code
Error code Content
Example
Calculate the arc cosine value of 0.4 and the result is 1.159279.
• After calculating the SIN-1 (arc sine) value of the angle specified in (s), the calculation result is stored in the device number
specified in (d).
The SIN-1 value specified in (s) can be set within the range of -1.0 to 1.0.
The angle (calculation result) stored in (d) is stored in the unit of radians (-π/2) to (π/2).
Example
The angle (calculation result) stored in (d) is stored in the unit of radians (-π/2) to (π/2).
• The related devices are as follows.
Content
Devices Name
Condition Operation
SM153 Zero The operation result is zero The zero flag (SM153) turns ON.
The value of (d) becomes the minimum value of 32-bit real
SM152 Borrow The absolute value of operation result<2 -126
numbers (2 -126), and the borrow flag (SM152) turns ON.
Error code
Error code Content
Example
Example
Data type
Parameter Content Range Data type
(label)
The angle data for DCOSH (hyperbolic cosine) calculation Single precision
(s) 0, 2-126 ≤|(s)|< 2128 ANYREAL_32
or the device start number that stores the angle data real number
Single precision
(d) The start device number that stores operation result - ANYREAL_32
real number
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●●●● ● ● ● ● ● ●
DCOSH
Parameter 2 ●●●● ● ● ● ● ●
Features
• After calculating the DCOSH (hyperbolic cosine) value of the angle specified in (s), the calculation result is stored in the device
number specified in (d).
This instruction is to take the COSH value of a binary floating point number. The calculation formula is cosh value=(e s +e -s )/2.
• The related devices are as follows.
Content
Devices Name
Condition Operation
The value of (d) becomes the maximum value of 32-bit real
SM151 carry The absolute value of the operation result>2128
numbers (2128 ), and the carry flag (SM151) turns on.
Error code
Error code Content
Example
Calculate the hyperbolic cosine value of 2.5, and the result is 6.132289
Example
The instruction is to take the SINH value from a binary floating point number. The calculation formula is sinh value = (e s -e -s )/2.
The related devices are shown below.
Content
Devices Name
Condition Operation
SM153 Zero The operation result is zero The zero flag (SM153) turns ON.
The value of (d) becomes the minimum value of a 32-bit real
SM152 Borrow The absolute value of operation result <2-126
number (2-126), and the borrow flag (SM152) turns on.
The value of (d) becomes the maximum value of 32-bit real
SM151 Carry The absolute value of operation result > 2128
numbers (2128), and the carry flag (SM151) turns on.
Error code
Error code Content
Example
Calculate the hyperbolic sine value of 3.2 and the result is 12.24588
Example
The instruction is to take the TANH value of a binary floating point number. The calculation formula is tanh value=(e s -e -s )/(e s +e -s ).
The related devices are shown below.
Content
Device Name
Condition Operation
SM153 Zero The operation result is zero The zero flag (SM153) turns ON.
The value of (d) becomes the minimum value of a 32-bit real
SM152 Borrow The absolute value of operation result <2 -126
number (2-126), and the borrow flag (SM152) turns on.
Error code
Error code Content
Example
Example
4084H When the content of the device specified by (s) is an irregular number, a non-number and ±∞
Example
When constants (K, H) to (s1), (s2) are specified, the value is automatically converted to a binary floating point data.
4085H The write address in (s1) and (s2) exceed the device range
4086H The write address in (d) exceeds the device range
4084H When the content of the device specified by (s1) and (s2) is an irregular number, a non-number and ±∞
When constants (K, H) to (s1), (s2) are specified, the value is automatically converted to a binary floating point data.
4085H The write address in (s1) and (s2) exceeds the device range
4086H The write address in (d) exceeds the device range
4084H When the content of the device specified by (s1) and (s2) is an irregular number, a non-number and ±∞
When constants (K, H) to (s1), (s2) are specified, the value is automatically converted to a binary floating point data.
4085H The write address in (s1) and (s2) exceeds the device range
4086H The write address in (d) exceeds the device range
4084H When the content of the device specified by (s1) and (s2) is an irregular number, a non-number and ±∞
When constants (K, H) to (s1), (s2) are specified, the value is automatically converted to a binary floating point data.
4085H The write address in (s1) and (s2) exceeds the device range
4086H The write address in (d) exceeds the device range
Example
Error code
Error code Content
Error code
Error code Content
4085H (s) read address exceeds the device range
4086H (d) write address exceeds the device range
Example
✎Note
All floating-point operations are performed in binary floating-point. However, the binary floating point is a difficult-to-understand
value (special monitoring method), so by converting it into a decimal floating point operation, it is convenient for peripheral
equipment to monitor and so on.
Error code
Error code Content
Example
Content
Devices Name
Condition Operation
SM153 Zero The operation result is zero The zero flag (SM153) turns ON.
The value of (d) becomes the minimum value of a 32-bit real
SM152 Borrow The absolute value of operation result <2-126
number (2-126), and the borrow flag (SM152) turns on.
The value of (d) becomes the maximum value of 32-bit real
SM151 Carry The absolute value of operation result> 2128
numbers (2128), and the carry flag (SM151) turns on.
Error code
Error code Content
4085H (s) read address exceeds the device range
4086H (d) write address exceeds the device range
Example
(1) : Even if the command input is turned OFF and the DECMP command is not executed, (d) to (d)+2 will keep the state before X0 is
turned OFF.
When the constant (K, H) to the device specified in (s1), (s2) is specified, the value BIN→binary floating point data conversion is
processed automatically
✎Note: The device specified in (d) occupies 3 points [(d), (d)+1, (d)+2]. Please be careful not to overlap with devices used for other
purposes.
Error code
Error code Content
4085H The write address in (s1) or (s2) exceeds the device range
4086H The write address in (d) exceeds the device range
4084H When the content of the device specified by (s) or (s2) is an irregular number, a non-number and ±∞
Since the floating point number in R30 is greater than the floating point number in D30, M12 turns ON.
(1): Even if the instruction input is turned OFF and DEZCP instruction is not executed, (d) to (d)+2 will keep the state before X0 is
turned OFF.
When the constant (K, H) to the device specified in (s1), (s2), (s3) is specified, the value is automatically converted from BIN to binary
floating point for processing.
✎Note
The device specified in (d) occupies 3 points [(d), (d)+1, (d)+2]. Please be careful not to overlap with devices used for other purposes.
Please set the size relationship of the comparison data as [(s1)+1,(s1)]≤[(s2)+1,(s2)]. In the case of [(s1)+1,(s1)]>[(s2)+1,(s2)], it is
regarded as the value of [(s2)+1,(s2)] and [(s1)+1, (s1)] Same for comparison.
Error code
Error code Content
4085H The write address in (s1), (s2) and (s3) exceeds the device range
4086H The write address in (d) exceeds the device range
4084H When the content of the device specified by (s1), (s2) and (s3) is an irregular number, a non-number and ±∞
Example
Since 2.45 is greater than 1.456 and 2.45 is less than 2356, M41 is set to ON
The value specified in (s) can only be set to a positive number. (Cannot perform operations with negative numbers.)
• The related devices are as follows.
Content
Devices Name
Condition Operation
SM153 Zero The operation result is zero The zero flag (SM153) turns ON.
Error code
Error code Content
Converted string
The first one is the sign bit. In the sign, when binary floating point data data is positive, 20H (blank) is stored, and when it is negative,
2DH(-) is stored.
If the actual number of digits is less than all digits during conversion, 20H (blank) will be added between the sign and the first
number
If the decimal part of the binary floating point data data cannot be accommodated in the decimal part, the lower decimal part will be
rounded off.
2. Example: The total number of digits is 8, the number of decimal places is 2, and when -1.234 is specified, (d) will be stored in the
following way.
In the sign of the integer part, when the binary floating point data data is positive, 20H (blank) is stored, and when it is negative,
This example mainly shows that if the decimal place is set to 0, the decimal point 2EH(.) will be automatically omitted.
✎Note
When the binary floating point data is converted, the more digits, the lower the accuracy of the digits, the worse the accuracy of the
digits, and the conversion value may be inaccurate due to the progress.
Error code
Error code Content
4085H The read address of (s1) and (s2) exceeds the device range
4086H The write address of (d) exceeds the device range
When the content of the specified device (s1) and (s2) is an irregular number, a non-number, or ±∞
When the format specified in (s2) is other than 0 or 1
When the number of decimal places specified in (s2) +2 exceeds the range of 0 to 7
(1): discarded
(2): single-precision real number
When the sign is specified as 2BH(+) or omitted in the decimal point format, it will be converted as a positive value. In addition, when
the sign is specified as 2DH(-), it will be converted as a negative value.
3) If there are 20H (blank) or 30H (0) in the character string specified in (s) other than the first 0, 20H and 30H will be ignored
during conversion.
(1): ignore
(2): single-precision real number
(1): discarded
(2): single-precision real number
If the sign of the exponent part is specified as 2BH(+) or omitted in the exponential form, it will be converted as a positive value.
When the sign of the exponent is specified as 2DH(-), it will be converted as a negative value.
2) If there is 20H (blank) or 30H (0) in the character string specified in (s) other than the first 0, 20H and 30H will be ignored during
conversion.
In the exponential character string, if 30H (0) is stored between "E" and the value, 30H will be ignored during conversion.
(1): Ignore.
(2): Single precision real number.
408BH When (s) reading a character string, the maximum range of the device is read, but 00H is not found and the end
When there are characters other than 2BH (+), 2DH (-), 20H (space), 2EH (.), 45H (E), 65H(e), and 30 H(0) to 39H
4084H (9) in the string specified in (s)
When there are two or more 2EH(.) characters in the character string specified in (s).
Example
Example
The value specified in (s) can only be set to a positive number. (Cannot perform operations with negative numbers.)
• The related devices are as follows.
Content
Devices Name
Condition Operating
SM153 Zero The operation result is zero The zero flag (SM153) turns ON.
The value of (d) becomes the minimum value of a 32-bit
SM152 Borrow The absolute value of operation result <2-126
real number (2-126 ), and the borrow flag (SM152) turns on.
The value of (d) becomes the maximum value of 32-bit real
SM151 Carry The absolute value of operation result> 2128
numbers (2128 ), and the carry flag (SM151) turns on.
Error code
Error code Content
Example
• The value specified in (s) can only be set to a positive number. (Cannot perform operations with negative numbers.)
• The related devices are as follows.
Content
Devices Name
Condition Operating
SM153 Zero The operation result is zero The zero flag (SM153) turns ON.
The value of (d) becomes the minimum value of a 32-bit real
SM152 Borrow The absolute value of operation result <2-126
number (2-126 ), and the borrow flag (SM152) turns on.
The value of (d) becomes the maximum value of 32-bit real
SM151 Carry The absolute value of operation result> 2128
numbers (2128 ), and the carry flag (SM151) turns on.
Error code
Error code Content
Example
(You can enter "=", "<>", ">", "<", ">=", "<=" in "")
Content, range and data type
Parameter Content Range Data type Data type (label)
(s1) Comparison data or device storing comparison data -32768 to 32767 Signed BIN 16 bit ANY16_S
(s2) Comparison data or device storing comparison data -32768 to 32767 Signed BIN 16 bit ANY16_S
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
LD= s1, s2 ● ● ● ● ●●●● ● ●● ●
LD> s1, s2 ● ● ● ● ●●●● ● ●● ●
LD< s1, s2 ● ● ● ● ●●●● ● ●● ●
LD>= s1, s2 ● ● ● ● ●●●● ● ●● ●
LD<= s1, s2 ● ● ● ● ●●●● ● ●● ●
LD<> s1, s2 ● ● ● ● ●●●● ● ●● ●
AND= s1, s2 ● ● ● ● ●●●● ● ●● ●
AND> s1, s2 ● ● ● ● ●●●● ● ●● ●
AND< s1, s2 ● ● ● ● ●●●● ● ●● ●
AND>= s1, s2 ● ● ● ● ●●●● ● ●● ●
AND<= s1, s2 ● ● ● ● ●●●● ● ●● ●
AND<> s1, s2 ● ● ● ● ●●●● ● ●● ●
OR= s1, s2 ● ● ● ● ●●●● ● ●● ●
OR> s1, s2 ● ● ● ● ●●●● ● ●● ●
OR< s1, s2 ● ● ● ● ●●●● ● ●● ●
OR>= s1, s2 ● ● ● ● ●●●● ● ●● ●
OR<= s1, s2 ● ● ● ● ●●●● ● ●● ●
OR<> s1, s2 ● ● ● ● ●●●● ● ●● ●
Features
The BIN 16-bit data of the device specified in (s1) and the BIN 16-bit data of the device specified in (s2) are compared by normal
open contact processing.
The comparison operation result of each instruction is shown below.
When the content of D200 is above -29, and X1 is ON, Y11 is set
When the data of LC10 is 200000, Y10 is set, otherwise Y10 is reset.
When the 32-bit data composed of D201 and D200 exceeds -5000, and X1 is ON, Y11 is turned ON.
When X0 is ON and the value of LC10 is 200000, Y10 is set, otherwise it is reset.
When X1 is OFF and the 32-bit data composed of D1 and D0 is not equal to K-50000, Y11 is set.
(3) ORD instruction:
When X1 is ON, or the data of LC10 is equal to the data of LC10 is equal to 200000, Y0 is set.
When X2 and M30 are set, or the double word data composed of D101 and D100 is greater than or equal to 100000, M60 is set.
When the real number input in D0 is equal to E1.23, Y10 is ON, otherwise Y10 is OFF.
When the real number in R0 is greater than or equal to the real number in LC0, Y11 is ON, otherwise it is OFF.
If the input in D0, R0, LC0 is not a real number, it will report H4084 error.
(2) ANDE instruction:
Only when M0 is ON and D2 real number is not equal to E1.23 and R2 real number is less than real number LC2 , Y12 is ON, otherwise
all are OFF.
(3) ORE instruction:
When the real number of R4 is less than or equal to the real number of R15, or the real number R6 is equal to the real number R20,
Y13 is ON, otherwise Y13 is OFF.
408BH When (s1) or (s2) reading the string, the maximum range of the device is read but 00H is not found as the end.
Example
(1) 1、LDS instruction
Example
When 6:32:40 and 7:48:10 are added together
When the calculation result time exceeds 24 o'clock, the carry flag turns ON, and the value after 24 hours is subtracted becomes the
calculation result. For example, when 14:20:30 and 20:20:20 are added, the result is not 34:40:50, but 10:40:50.
When the calculation result is 0 (0 hour, 0 minute, 0 second), the zero flag turns on.
When 23:59:59 and 1 second are added, the result of the calculation is 0:00:00, and the carry flag and zero flag are turned on.
Related device are as follows:
Devices Name Content
SM151 Carry It is ON when the result of the TADD(P) instruction exceeds the maximum clock data value of 23:59:59
Example
When subtracting 10:40:20 and 3:50:10
When the calculation result time is a negative number, the borrow flag turns on and the data +24 is the calculation result. For
example, in the case of subtracting 4:50:32 and 10:42:12, the result is not -6:8:20, but 18:8:20.
When the calculation result is 0 (0 hour, 0 minute, 0 second), the zero flag turns on.
Related device are as follows:
Devices Name Content
SM152 Borrow It is ON when the result of the TSUB(P) instruction is less than 0:00:00
SM153 Zero It is ON when the result of the TSUB(P) instruction is at the time of 0:00:00:00
✎Note
• The devices specified in (s1), (s2), and (d) occupy 3 points respectively. Be careful not to overlap with the device used for machine
control.
314 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
• When using the clock data time (hour, minute, second) of the built-in real-time clock of the CPU module, use the TRD(P) instruction
to read the value of the special register and assign the word device to each operand.
Error code
Error code Content
4085H When reading the specified device range exceeds the corresponding device range
4086H When writing the specified device range exceeds the corresponding device range
When the values specified in (s1) and (s2) are other than 0 to 23
4084H
When the values specified in (s1)+1, (s2)+1, (s1)+2 and (s2)+2 are other than 0 to 59
Example
• The related devices are shown below. The clock data of these special registers are updated through END processing.
Devices Content
SD100 The second data of the clock data is stored in BIN code.
SD101 The sub-data of the clock data is stored in BIN code.
SD102 Time data of clock data is stored in BIN code.
SD103 The daily data of the clock data is stored in BIN code.
SD104 The monthly data of the clock data is stored in BIN code.
SD105 The year data of the clock data is stored in a 4-digit BIN code of the Gregorian calendar.
SD106 The week data of the clock data is stored in BIN code. (0: day, 1: one, ..., 6: six) are stored in BIN code.
✎Note
• The device specified in (d) occupies 7 points. Be careful not to overlap with the device used for machine control.
Error code
Error code Content
4086H When reading the specified device range exceeds the corresponding device range
Example
After the M0 coil is turned on, the current date and time are read as 2020-2-19 13:10:38 Wednesday
At the moment when the time 12:36:00 arrives, turn on the M0 coil and write the time.
Example
When 4 hours, 29 minutes and 31 seconds are specified in (s)
Error code
Error code Content
4085H When reading the specified device range exceeds the corresponding device range
4086H When writing the specified device range exceeds the corresponding device range
When the calculation result is not in the range of 0 to 32767
4084H When the value specified in (s) is not in the range of 0 to 9
When the value specified in (s)+1 and (s)+2 is not in the range of 0 to 59
Example
Example
When 35 hours, 10 minutes and 58 seconds are specified in (s)
Error code
Error code Content
4085H When reading the specified device range exceeds the corresponding device range
4086H When writing the specified device range exceeds the corresponding device range
When the calculation result is not in the range of 0 to 32767
4084H
When the value specified in (s)+1 and (s)+2 is not in the range of 0 to 59
Example
When M0 = ON, the duration of the state is accumulated, the time is recorded in D0, and the seconds less than 1 hour are recorded
in D1. When the accumulated time of D0 reaches 98 hours, the Y0 output state is ON. When the timing conditions are met, after
reaching the specified value (K98), the accumulated timing will continue and the reading will continue to increase; the current time
value D0 reaches the maximum value of 32767 hours and D1 reaches 3599 seconds, the timing measurement will stop. The current
time values D0 and D1 are cleared to 0.
When M0=ON, the duration of this state is accumulated, the time is recorded in D1, D0, and the seconds less than 1 hour are
recorded in D2. When the accumulated time of D1, D0 reaches 1000 hours, the Y0 output state is ON. When the timing conditions
are met, after reaching the specified value (K1000), the accumulated timing will continue, and the reading will continue to increase;
the current time values D1 and D0 reach the maximum value of 2147483647 hours, and when D2 reaches 3599 seconds, the timing
measurement will stop and the timing should be restarted. The current time values D0, D1, and D2 must be cleared to 0.
Example
When 29,011 seconds are specified in (s)
Error code
Error code Content
4085H When reading the specified device range exceeds the corresponding device range
4086H When writing the specified device range exceeds the corresponding device range
4084H When the value of (s) exceeds the range
Example
Example
When 45,325 seconds is specified in (s)
Error code
Error code Content
4085H When reading the specified device range exceeds the corresponding device range
4086H When writing the specified device range exceeds the corresponding device range
4084H When the value of (s) exceeds the range
Example
✎Note
The device specified in (s4) and (d) occupies 3 points. Be careful not to overlap with the device used for machine control.
When using the clock data time (hour, minute, second) of the built-in real-time clock of the CPU module, use the TRD(P) instruction
to read the value of the special register and assign the word device to each operand.
Error code
Error code Content
4085H When reading the specified device range exceeds the corresponding device range
4086H When writing the specified device range exceeds the corresponding device range
When the value specified in (s) and (s4) is not in the range of 0 to 23
4084H
When the value specified in (s2),(s3) (s4)+1 and (s4)+2 is not in the range of 0 to 59
M10 is turned ON
✎Note
• The devices specified in (s1), (s2), (s3), (d) occupy 3 points. Be careful not to overlap with the device used for machine control.
• When using the clock data time (hour, minute, second) of the built-in real-time clock of the CPU module, use the TRD(P) instruction
to read the value of the special register and assign the word device to each operand.
• When (s1)> (s2), two of (d), (d)+1, (d)+2 are ON/OFF.
After the coil is turned on, the reading time to D20 time is 8:30:00
M0/M12 is ON
Offset
Devices Pulse extension
instruction parameter modification
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●
TON Parameter 2 ● ● ● ● ●● ● ● ●●
Parameter 3 ●●
Timing Chart
Features
1) When the timer starts timing, the instruction after the timer starts to run when the timing time is greater than the time value of
"the product of S2 and S3".
2) When the timer value is greater than 0 and less than the time value of "the product of S2 and S3", the timer will stop whenever
the contact is disconnected, and when the contact is connected, the timer will start timing again.
T1 is used for storing time, setting the expected time as K10 and the time base as K10000.
After set on (M8) contact and waiting for the value in the turn-on delay timer (T1) to reach the estimated time of 10s, the contact of
(T1) on and output Y0.
If the (M8) contact is off in the process of turn-on delay timer (T1) timing, the turn-on delay timer (T1) value is
cleared to 0 and the timing ends.
Offset
Devices Pulse extension
instruction parameter modification
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●
TON Parameter 2 ● ● ● ● ●● ● ● ●●
Parameter 3 ●●
Timing Chart
Features
1) When the timer starts timing, the instruction after the timer starts to run when the timing time is greater than the time value of
"the product of S2 and S3".
2) When the coil in front of the timer is off, the TONR timer saves the current value. When the coil is on, the TONR timer continues to
timing.
3) The current value of TONR can be cleared using the reset command. After the preset time is reached, TONR maintains the current
value of the timer.
Precautions
• Avoid timer number conflict: the same timer number cannot be used for TON, TONR, TOF, TP, OUT_T timers at the same time. For
example, TON T32 and TOF T32 cannot be used at the same time (it may cause data confusion and not achieve the effect of the
corresponding instruction function).
Error code
T1 is used for storing time, setting the expected time as K10 and the time base as K10000.
When the (M8) contact off and on again during timing. (T1) maintains the value at the last disconnection and continues timing until
the estimated time of 10s. After the estimated time is reached, the (T1) contact on and output Y0. If the (M8) contact off in this time,
the (T1) contact is still ON but Y0 is off.
When (M0) contact turn ON, the (T1) timer value is cleared to 0 with the RST reset command, the (T1) contact is off, and the Y0 OFF.
Offset
Devices Pulse extension
instruction parameter modification
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●
TON Parameter 2 ● ● ● ● ●● ● ● ●●
Parameter 3 ●●
Timing Chart
Features
1) After the input is disconnected, the output is delayed for a fixed time before stopping. The timer bit turns on immediately when
the input is started and the current value is set to 0. When the input is disconnected, timing starts until the current time is equal to
the preset time, then timing stops.
2) When the preset value is reached, the timer bit is disconnected and the current value stops incrementing; If the input is turned on
again before the TOF reaches the preset value, the timer bit remains on.
3) For the TOF timer to start timing, the enable input must perform an on-off transition.
T1 is used for storing time, setting the expected time as K10 and the time base as K10000.
Make the (M8) contact ON and oFF, When (M8) ON, (T1) contact is ON and Y0 is ON. when (M8) OFF, (Y0) is OFF and (T1) starts timing.
When the estimated time of 5s is reached, the (T1) contact is also 0FF.
If the (M8) contact ON again during (T1) timing, the (T1) value clears to 0 and the timing ends
Offset
Devices Pulse extension
instruction parameter modification
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●
TON Parameter 2 ● ● ● ● ●● ● ● ●●
Parameter 3 ●●
Timing Chart
Features
Timer that outputs TRUE only for the set time after startup
1) When the enable input is turned on, timer (s1) is started and timer (s1) bit is immediately turned on. Timer (s1) stops as time
increases and reaches the expected time.
2) After timer (s1) reaches the predetermined time (s2), timer (s1) bit is disconnected. At this time, timer (s1) stops increasing. If the
enable input becomes FALSE, timer (s1) will reset. The expected time (s2) becomes 0.
3) After starting, if the enable input becomes FALSE before the timer (s1) reaches the expected time (s2), the timer will be reset after
reaching the expected time (s2).
T1 is used for storing time, setting the expected time as K5 and the time base as K10000.
When the enable input (M8) is on, the timer (T1) is started and the timer (T1) bit turns on immediately. Timer (T1) stops as time
increases and reaches the expected time.
After timer (T1) reaches a predetermined time of 5s, timer (T1) bit is disconnected. At this time, timer (T1) stops increasing. If the
enable input (M8) becomes FALSE, timer (T1) will reset. The expected time becomes 0.
After startup, if the enable input (M8) becomes FALSE before the timer (T1) reaches the estimated time of 5s, the timer will be reset
after reaching the estimated time of 5s.
•When the output value stored in (d) is a signed BIN 16-bit value, and the operation result
exceeds the range of -32768 to 32767, the situation is shown in the following example.
For example, when (s1) is 10 and (s3) is -32768,
the output value = -32768-10=8000H-000AH=7FFFH=32758.
Error code
Error code Content
4085H When the specified device range for reading exceeds the range of the corresponding device.
4086H When the specified device range for writing exceeds the range of the corresponding device.
4084H When the low limit specified in (s1) is greater than the high limit specified in (s2).
Example
When X000 is ON, when D0<(-1,000), the value of ( D0)-(-1,000) is stored in (D1).
• When -1,000≦ D0≦1,000, 0 is stored in D1.
• When D0<1,000, the value of (D0)-1,000 is stored in D1.
• When the output value stored in (d) is a signed BIN 32-bit value, and the
operation result exceeds the range of -2,147,483,648 to 2,147,483,647, the
situation is as the following example. For example, When (s1) and (s1)+1 are 1000,
(s3) and (s3)+1 are -2,147,483,648, then the output value=
-2,147,483,648-1000=80000000H-000003E8H=7FFFFC18H=2,147,482,648.
Error code
Error code Content
4085H When the specified device range for reading exceeds the range of the corresponding device.
4086H When the specified device range for writing exceeds the range of the corresponding device.
4084H When the low limit specified in (s1) is greater than the high limit specified in (s2).
• When (D1, D0)<(-10,000), the value of (D1, D0)-(-10,000) is stored in (D11, D10).
• When -10,000≦(D1, D0)≦10,000, 0 is stored in (D11, D10).
• When 10,000< (D1, D0), the value of (D1, D0)-10,000 is stored in D1.
For example, when -12,345 is specified in (s) (in the case of specifying signed)
When X000 is ON, convert the value of 16-bit data (BIN) D1000 into
decimal ASCII code, and then use PR instruction to output the
converted ASCII code character by character to the program of Y040 to
When X000 is ON, convert the value of 32-bit data (BIN) D1000 into decimal ASCII code, and then use PR (FNC 77) instruction to
output the converted ASCII code character by character to the program in Y040 to Y051 in time and time division.
ASCII S ASCII 100 ASCII 101 ASCII 102 ASCII 103 ASCII 104
Units of Tens of Hundreds of Thousands of Ten thousands
ASCII code
ASCII code ASCII code ASCII code ASCII code of ASCII code
For example, When -25,108 is specified in (s)
• The ASCII data specified in (s) to (s)+2 is within the range of -32,768 to +32,767.
• In “Sign”, set 20H when the converted data is positive, and set 2DH when it is negative. (When other than 20H or 2DH is set, it will
be treated as positive data. (DABIN(P))
• The range of the ASCII code set in each digit is 30H to 39H.
• When the ASCII code set in each bit is 20H or 00H, it will be treated as 30H.
Error code
Error code Content
When the Sign data exceeds the range of 30H to 39H, 20H, 00H, 2DH;
4084H When the ASCII code of each bit specified in (s) to (s)+2 exceeds the range of 30H to 39H, 20H, 00H;
When the ASCII data specified in (s) to (s)+2 is other than -32,768 to +32,767.
4085H The read address of (s) exceeds the device range.
4086H The write address of (d) exceeds the device range.
Example
When X000 is ON, the Signs set in D20 to D22 and the ASCII code data of 5-digit
decimal numbers are converted into BIN values, and then stored in the program of D0.
344 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
DDABIN/Decimal ASCII → BIN32-bit data conversion
DDABIN(P)
The decimal ASCII data stored after the device number specified in (s) is converted into BIN 32-bit data and stored in the device
number specified in (d).
-[DDABIN (s) (d) ]
Content, range and data type
Parameter Content Range Data type Data type (label)
The start number of the device that stores data (ASCII code) to
(s) - String ANYSTRING_SINGLE
be converted into a BIN value
(d) The device number for storing conversion result - Signed BIN 32 bit ANY32_S
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●● ● ● ●
DDABIN
Parameter 2 ● ● ● ●●●● ● ● ● ● ●
Features
The decimal ASCII data stored after the device number specified in (s) is converted into BIN 32-bit data and stored in the device
specified in (d).
• The ASCII data specified in (s) to (s)+5 is within the range of -2,147,483,648 to +2,147,483,647. In addition, the data stored in the
high byte of (s)+5 will be ignored.
• In the Sign data, set 20H when the converted data is positive, and set 2DH when it is negative. (When other than 20H or 2DH is set,
it will be treated as positive data. (DABIN(P))
• The range of ASCII code set in each digit is 30H to 39H.
• When the ASCII code set in each bit is 20H or 00H, it will be treated as 30H.
345 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
Error code
Error code Content
When the Sign data exceeds the range of 30H to 39H, 20H, 00H and 2DH;
4084H When the ASCII code of each bit specified in (s) to (s)+5 exceeds the range of 30H to 39H, 20H and 00H;
When the ASCII data specified in (s) to (s)+5 exceeds the range of -2,147,483,648 to +2,147,483,647
When X000 is ON, the Signs set in to D20 to D25 and the ASCII code data of 10-digit decimal numbers are converted into BIN values
and then saved to the program in D0 to D1.
•Only in the case of controlling high limit value, set the minimum value of
data range in the low limit value specified in (s1).
• Only in the case of controlling low limit value, set the maximum value of
data range in the high limit value specified in (s2).
Error code
Error code Content
4085H The read address exceeds the device range
4086H The write address exceeds the device range
4084H High limit <low limit
Example
When X000 is ON
• When D0 <500, D1 is 500.
• When 500 ≤ D0 ≤ 5,000, D1 is the value of D0.
• When 5,000 <D0, D1 is 5,000.
Example
Operation:
• When (D1, D0) <10,000, (D11, D10) is 10,000.
• When 10,000 ≤ (D1, D0) ≤ 1,000,000, (D11, D10) is the value of (D1, D0).
• When 1,000,000 <(D1, D0), (D11, D10) is 1,000,000.
• If the calculation result is not an integer value, round the first digit below the decimal point.
• The X coordinate data of the conversion data for scaling should be set in ascending order.
• For (s1), set within the range of the conversion data for scaling ((s2), (s2) + 1 device value).
✎1 Like points 4, 5, and 6, if the coordinates are specified by 3 points, the intermediate value could be the output value.
In this example, the output value (median value) is specified by the Y coordinate of point 5.
When the X coordinate is the same at 3 or more points, the value of the second point is also output.
✎2 Like points 8 and 9, if the coordinates are specified by 2 points, the output value is the value of the Y coordinate of next point.
In this example, the output value is specified by the Y coordinate of point 9.
• If the operation result is not an integer value, round the first digit below the decimal point.
• The X coordinate data of the conversion data for scaling should be set in ascending order.
• For (s1), set within the range of the conversion data for scaling ((s2), (s2) + 1 device value).
• If the same X coordinate is specified for multiple points, the Y coordinate value of the second point will be output.
• Set the number of coordinate points of conversion data for scaling within the range of 1 to 2,147,483,647.
• Setting example of conversion table for scaling.
In the case of scaling conversion characteristics as shown in the figure below, set it as the following data sheet.
• When the output value stored in (d) is a signed BIN 16-bit value, and the operation
result exceeds the range of -32,768 to 32,767, the situation is shown in the following
example.
For example, when (s1) is -100 and (s3) is -32,768,
the output value = -32768+(-100)=8000H-FF9CH=7F9CH=32668.
Error code
Error code Content
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
When X000 is ON
• When D0<0, the value of (D0)+(-1,000) is stored in D1.
• When D0=0, 0 is stored in D1.
• When 0<D0, the value of (D0)+(1,000) is stored in D1.
361 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
DZONE/BIN 32-bit data zone control
DZONE(P)
After adding the offset value specified in (s1) or (s2) to the input value specified in (s3), it is stored in the device number specified in
(d).
-[DZONE (s1) (s2) (s3) (d)]
Content, range and data type
-2147483648 to
(s1) The negative offset value for addition in the input value BIN32 bit ANY32_S
2147483647
-2147483648 to
(s2) The positive offset value for addition in the input value BIN32 bit ANY32_S
2147483647
-2147483648 to
(s3) Input value for zone control BIN32 bit ANY32_S
2147483647
The start number of the device storing the output value
(d) - BIN32 bit ANY32_S
controlled by zone control
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ● ●●●● ● ● ● ●● ● ●
Parameter 2 ● ● ● ● ●●●● ● ● ● ●● ● ●
DZONE
Parameter 3 ● ● ● ● ●●●● ● ● ● ● ●
Parameter 4 ● ● ● ●●●● ● ● ● ● ●
Features
After adding the offset value specified in (s1) or (s2) to the input value (BIN 32-bit value) specified in (s3), it is stored in the device
number specified in (d). The offset value is controlled as follows.
Condition The value stored in the output value
When input value ((s3), (s3)+1)<0 Input value ((s3), (s3)+1) + negative offset value (s1), (s1)+1
When input value ((s3), (s3)+1)=0 0
When input value ((s3), (s3)+1)>0 Input value ((s3), (s3)+1) + positive offset value (s2), (s2)+1
• When the output value stored in (d) and (d)+1 is a signed BIN 32-bit value,
and the operation result exceeds the range of -2,147,483,648 to
2,147,483,647, the situation is shown in the following example.
For example, (s1), (s1)+1 is -1,000, (s3), (s3)+1 is -2,147,483,648, then the
output value=-2,147,483,648+(-1000)=80000000H+FFFFFC18H=2,147,482,648.
Error code
Error code Content
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
Error code
Error code Content
The device range of point (n) starting from (s1) or (s2) is partially consistent with the device range of point (n)
4084H
starting from (d). (duplicate)
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
-2147483648 to
s1 The start device that stores addition operation data BIN32 bit ANY32_S
+2147483647
Addition data or the starting device that stores -2147483648 to
s2 BIN32 bit ANY32_S
addition operation data +2147483647
d The start device that stores the operation data - BIN32 bit ANY32_S
n The number of addition operation data 0 to 65535 BIN32 bit ANY32_S
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●●●● ● ● ● ● ●
Parameter 2 ●●●● ● ● ● ●● ● ●
DBK+
Parameter 3 ●●●● ● ● ● ● ●
Parameter 4 ●● ● ●● ●
Features
Add the BIN 32-bit data of point (n) starting from the device specified in (s1) and the BIN 32-bit data of point (n) starting from the
device specified in (s2), and store the operation result in the device specified in (d).
• Block addition operations are performed in 32-bit units.
When a device is specified in (s2) (when specified with a sign)
• When (s1) or (s2) and (d) are specified with the same device (completely consistent), operation could be performed. However, if
the device range of point (n) starting from (s1) or (s2) partially matches (overlaps) the device range of point (n) starting from (d), an
error occurs.
Error code
Error code Content
The device range of point (n) starting from (s1) or (s2) is partially consistent with the device range of point
4084H
(n) starting from (d). (duplicate)
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
(s1) The start device that stores the subtracted data -32768 to +32767 BIN16 bit ANY16_S
Subtraction data or the start device that stores
(S2) -32768 to +32767 BIN16 bit ANY16_S
the subtraction data
(d) The start device that stores the operation result - BIN16 bit ANY16_S
(n) The number of subtraction operation data 0 to 65,535 BIN16 bit ANY16
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●●●● ● ● ●
Parameter 2 ●●●● ● ●● ● ●
BK-
Parameter 3 ●●●● ● ● ●
Parameter 4 ●● ● ●● ●
Features
Subtract the BIN 16-bit data of point (n) starting from the device specified in (s1) and the BIN 16-bit data of point (n) starting from
the device specified in (s2), and store the result in the device specified in (d).
• Block subtraction operations are performed in 16-bit units.
When a device is specified in (s2)
• When an underflow or overflow occurs in the operation result, the conditions are as follows. In this case, the carry flag does not
change to ON.
Error code
Error code Content
4084H The device range of point (n) starting from (s1) or (s2) is partially consistent with the device range of
point (n) starting from (d). (duplicate)
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
• When (s1) or (s2) and (d) are specified with the same device (completely consistent), operation could be performed. However, if
the device range of point (n) starting from (s1) or (s2) partially matches (overlaps) the device range of point (n) starting from (d), an
error occurs.
Error code
Error code Content
The device range of point (n) starting from (s1) or (s2) is partially consistent with the device range of point (n)
4084H
starting from (d). (duplicate)
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
When X020 is ON, use “BKCMP=” instruction to compare the 4-point 16-bit data (BIN) starting from D100 and the 4-point 16-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
• (d) is specified outside the device range of point (n) starting from (s1) and (s2).
• The comparison operation result of each instruction is shown below.
Instruction sign Condition Comparative results
DBKCMP= (s1)=(s2) ON
• When all the comparison operation results stored in point (n) starting from (d) are ON (1), SM156 (block comparison signal) would
turn ON.
Error code
Error code Content
4084H When (n) is out of range
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
When X020 is ON, use DBKCMP= instruction to compare the 4 points 32-bit data (BIN) starting from D100 and the 4 points 32-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
Error code
Error code Content
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
When X020 is ON, use BKCMP<> instruction to compare the 4-point 16-bit data (BIN) starting from D100 and the 4-point 32-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
• (d) is specified outside the device range of point (n) starting from (s1) and (s2).
• The comparative operation result of each instruction is shown below.
Instruction sign Condition Comparative results
DBKCMP<> (s1)≠(s2) ON
• When all the comparison operation results stored in point (n) starting from (d) are ON (1), SM156 (block comparison signal) would
turn ON.
When X020 is ON, use DBKCMP<> instruction to compare the 4-point 32-bit data (BIN) starting from D100 and the 4-point 32-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
When X020 is ON, use BKCMP> instruction to compare the 4-point 16-bit data (BIN) starting from D100 and the 4-point 16-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
• (d) is specified outside the device range of point (n) starting from (s1) and the device range of point (n) starting from (s2).
• The comparison operation result of each instruction is shown below.
Instruction sign Condition Comparative results
DBKCMP> (s1)>(s2) ON
• When all the comparative operation results stored in point (n) starting from (d) are ON (1), SM156 (block comparison signal) would
turn ON.
Error code
Error code Content
4084H When (n) is out of range
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
When X020 is ON, use DBKCMP> instruction to compare the 4-point 32-bit data (BIN) starting from D100 and the 4-point 32-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
When X020 is ON, use BKCMP>= instruction to compare the 4-point 16-bit data (BIN) starting from D100 and the 4-point 16-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
• (d) is specified outside the device range of point (n) starting from (s1) and the device range of point (n) starting from (s2).
• The comparison operation result of each instruction is shown below
Instruction sign Condition Comparative results
DBKCMP>= (s1)>=(s2) ON
• When all the comparison operation results stored in point (n) at the beginning of (d) are ON (1), SM349 (block comparison signal)
will turn ON.
Error code
Error code Content
When X020 is ON, use DBKCMP>= instruction to compare the 4-point 32-bit data (BIN) starting from D100 and the 4-point 32-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
When X020 is ON, use BKCMP< instruction to compare the 4-point 16-bit data (BIN) starting from D100 and the 4-point 16-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
• (d) is specified outside the device range of point (n) starting from (s1) and the device range of point (n) starting from (s2).
• The comparison operation result of each instruction is shown below.
Instruction sign Condition Comparative results
DBKCMP< (s1)>=(s2) ON
• When all the comparison operation results stored in point (n) starting from (d) are ON (1), SM349 (block comparison signal) would
turn ON.
When X020 is ON, use DBKCMP< instruction to compare the 4-point 32-bit data (BIN) starting from D100 and the 4-point 32-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
• When all the comparison operation results stored in point (n) starting from (d) are ON (1), SM156 (block comparison signal) would
turn ON.
Instruction sign Condition Comparative results
BKCMP<= (s1)>=(s2) ON
• When all the comparison operation results stored in point (n) starting from (d) are ON (1), SM156 (block comparison signal) would
turn ON.
Error code
Error code Content
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
When X020 is ON, use BKCMP<= instruction to compare the 4-point 16-bit data (BIN) starting from D100 and the 4-point 16-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
• (d) is specified outside the device range of point (n) starting from (s1) and the device range of point (n) starting from (s2).
• The comparison operation result of each instruction is shown below.
Instruction sign Condition Comparative results
DBKCMP<= (s1)>=(s2) ON
• When all the comparison operation results stored in point (n) starting from (d) are ON (1), SM156 (block comparison signal) would
turn ON.
Error code
Error code Content
4084H When (n) is out of range
4085H When the specified device range for reading exceeds the range of the corresponding device
4086H When the specified device range for writing exceeds the range of the corresponding device
Example
When X020 is ON, use DBKCMP<= instruction to compare the 4-point 32-bit data (BIN) starting from D100 and the 4-point 32-bit data
starting from D200, and save the result to the program in the 4-point of the device starting from M10.
In addition, when the comparative results (4 points starting from M10) are all ON (1), Y000 turns ON.
Related device
Devices Name Content
SM153 Zero bit Data readout usually starts from (s)+1, but when the pointer (s) is 0, the zero bit SM153 will operate.
✎Note:
The data after reading would not change the content of (s)+(n) due to reading.
In the case of continuous execution (SFRD) instructions, each scan time (operation cycle) will be read sequentially, but the content of
(s) + (n) would not change. When the pointer (s) is 0, it would become no processing, and the content of (d) would not change.
Output the product number that should be taken out in hex 4 digits to Y0 to Y17
2) Program 2
Turn X0 from OFF to ON, and this instruction acts according to the following numbers 1 to 3. (The content of D10 remains
unchanged),
1 The content of D2 is read out and sent to D20.
2 D10 to D3 all shift one register to the right.
3 The contents of pointer D1 are reduced by 1.
Each time M1 is ON, for the values of D20 input first in D101 to D106, the last saved value would be saved in D10, and then the data
saved number (pointer D100) will be reduced by 1.
When the data entered first is the content in the table below.
Pointer D100 K3
D101 H1234
D102 H5678
D103 HABCD
Data
D104 H0000
D105 H0000
D106 H0000
Related device
Devices Name Content
When the content of pointer (s) exceeds (n)-1, it becomes no processing (no writing), and the carry flag SM151
SM151 carry
turns ON.
✎Note:
In the continuous execution type (SFWR) instruction, you should be noted that each scan time (operation cycle) will be stored
Data register D258 to D356 (99 points) for pointer D257 storing product
number
Output the first-in product number to D357 according to the requirements
Output the product number that should be taken out in hex 4 digits to Y0
to Y17
2) Program 2
When X0=1, the content of D0 is stored in D2, and the content of D1 becomes 1. When X0 changes from OFF to ON again, the
content of D0 is stored in D3, the content of D1 becomes 2, and so on. If the content of D1 exceeds n-1, the instruction is not
processed, and the carry flag M8022 will be set to 1.
When X10=ON, insert the data of D100 into No. 3 of the data table of D0 to D4.
However, when the number of saved data exceeds 7, the FINS(P) instruction is not executed (the device range used in the data table
is D0 to D7).
✎Note:
✎The user is responsible for the management of the device range used in the data sheet.
✎The range of the data table is (d) after the data storage number (d) of the device ((d) + 1).
Error code
Code Content
FDEL(P) instruction is executed when the value of (d) is 0.
The storage data of the table of (d) exceeds 512.
4084H
When the data set in (n) is other than the following, 1≤(n)≤512.
When the FDEL(P) instruction is executed, the table position (n) of the deleted data is greater than data storage number.
4085H When the device specified in the read application instruction (d) and (n) exceeds the corresponding device range.
4086H When the device specified in the write application instruction (s) and (d) exceeds the corresponding device range.
Example
When X10 is ON, delete the second data in the data table of D100 to D105, and save the deleted data in D0. However, when the
number of data saved is 0, do not execute the FDEL instruction. (The device range used in the data table is D100 to D107.)
As in the example above, X0 to X7 can quickly update the input signal after M8 is turned on. After X0 triggers Y20, output Y20 to Y27
quickly through the next REF Y20 K8 instruction.
(2) REF refreshes the high-speed counter HSC
As in the example above, turn M0 OM, and refresh the current input pulse of high-speed counter, and store the latest high-speed
counter value in HSC0, and store the current high-speed counter value in R1000 address.
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
REFF Parameter 1 ● ● ●● ● ●● ● ●
Features
In programmable controller, X0 to X17 use a digital filter. The default filter time constant is set by SD2280 and SD2281, and the filter
could be temporarily changed to 0 to 60ms through the REFF instruction.
When the high-speed counter or X input terminal interrupt function is used, the filter time of the relevant port is automatically the
shortest time, and the filter time of the irrelevant port is still the original set value.
MOV instruction could also be used to directly assign to SD2280 and SD2281 to change the filter time, but it would not change the
value of SD2280 and SD2281.
✎Note:
The X point filtering before this instruction may be out of control (if SD2280 and SD2281 are set to 0, the X point before the
instruction will be completely out of control).
Error code
Error code Content
4085H The (n) read address exceeds the device range
4084H (n) is not in the range of 0 to 60
Example
After M0 is turned on , the filter wave of X0 to X17 in the ladder program after the REFF instruction will temporarily be 3ms, and
SD2280 and SD2281 would not change.
• The output destination special relay of the timing clock specified in (d) should be SM340 to SM344.
• Store the count value of the number of scans in SD340 to SD344 corresponding to the output destination special relay of the timing
clock specified in (d).
• The count value of the number of scans, SD340 to SD344, becomes (n1)+(n2) or reset when the instruction input (instruction) is
turned ON.
Special relay (d) for timing clock output Device for counting the number of scans
SM340 SD340
SM341 SD341
SM342 SD342
SM343 SD343
SM344 SD344
• The operation starts at the rising edge of instruction input, and the output destination special relay of the timing clock is turned
ON/OFF by the END instruction. Even if the instruction input is disconnected, the operation would not stop. It stops when it is STOP
or the power is off.
• The cases where (n1) and (n2) are set to 0 are as follows.
The status of (n1) and (n2) The ON/OFF status of (d)
(n1)=0, (n2)≥0 Fixed as (d)=OFF
(n1)>0, (n2)=0 Fixed as (d)=ON
Example
Use the DUTY instruction to make Y0 flip once every cycle.
Set M0, SM340 will be ON for one cycle and OFF for one cycle.
(d) The start number of the device storing random number --- Signed BIN16 ANY16
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
RND Parameter 1 ● ● ● ●●●● ● ● ●
Features
A pseudo-random number from 0 to 32767 is generated, and the value is stored as a random number in the device specified in (d).
Error code
Error code Content
4086H The write address of (d) exceeds the device range
Example
Pseudo-random numbers from 0 to 9 would be generated.
(d2) Operation result array start device number Form type LIST
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●● ●
Parameter 2 ●● ●
DEXMN Parameter 3 ●● ●
Parameter 4 ●● ●
Parameter 5 ●● ●
Feature
(1) Instruction function description
From the data set given by S1, Select the data combination whose number is less than or equal to S2 (select the maximum number of
data) and the sum value is closest to S3 (target value). The selected result is stored in array D1 according to the position
corresponding to array S1.
The error code of the instruction execution is stored in D2, and the number of the selected is stored in D2+2, and the difference
between the selected array and the target value is stored in D2+4.
(2) Detailed parameter description
Input parameter S1
Unit Number of bytes Features Description Range
s1
Double word The number of input data Specify the number of input data 1 to 32
s1+1
s1+2
Double word The first data
s1+3
s1+4
Double word The second data
s1+5 Input data 0 to 16777215
... ... ...
s1+64
Double word The 32nd data
s1+65
Input parameter S3
Unit Number of bytes Features Parameter Description Range
s3
Double word Specify target data Specify the selected target data 0 to 16777215
s3+1
Parameter d1
Unit Number of bytes Features Parameter Description Range
Parameter d2
Number Remarks Remarks
Unit Features Parameter Description
of bytes
-1: The number entered is out of range
d2
-2: The number of selected data is out
of range
-3: The target data is out of range
Select the ≥0: execute
Double -4: The input data is out of range
execution result Error code correctly
word (If there are repeated errors, the top
d2+1 OR Error code <0: Error code
error will be reported first. For example,
the number of inputs is 0 and the target
data is -30. At this time, an error of -1
will be reported)
d2+2 Double The number The number of Actually Read-only
d2+6 Double
Operation time Total time used (ms)
d2+7 word
d2+8 Number of
Double Read-only
Reserved combinations (where
d2+9 word
the result is)
d2+10
Double Cache for internal
to Internal use
word calculation
d1+73
✎Note:
In the case of a large number of data, a watchdog timeout may occur. This is because the calculation takes a lot of time.
The current timetable for this instruction is as below. Please use the maximum number of data selected according to the timetable.
The number of arrays 1 2 3 4 5 6 7 8
The number of selected Time unit (ms)
1 <0.1 <0.1 <0.1 <0.1 <0.1 <0.1 <0.1 <0.1
2 <0.1 <0.1 <0.1 <0.1 <0.1 <0.1 <0.1
3 <0.1 <0.1 <0.1 <0.1 <0.1 <0.1
4 <0.1 <0.1 <0.1 <0.1 <0.1
5 <0.1 <0.1 <0.1 <0.1
6 <0.1 <0.2 <0.2
7 <0.2 <0.2
8 <0.2
Select a combination with a sum close to 300 from the data above, and the results selected by D300 (D1) are as below:
Bit 1 and Bit 3 of D300 are 1, and the data positions of 1 and 3 are currently selected. The indicated positions are D204 (99) and D208
(200).
D400 (D2) running results are as below:
.
• Specify the speed at the start of origin return in (s1). (It should be in the range of 1 to 200,000)
• Specify the crawling speed in (s2). (It should be in the range of 1 to 200,000)
• Specify the device number of the input number of the near-point signal (DOG) to be input in (s3).
• Specify the device that outputs pulses in (d). Only Y devices with positioning parameters could be specified.
• After the DOG contact signal of this instruction disappears, the pulse stops immediately.
• The pulse frequency could be modified during operation.
407 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
✎Note:
Please do not duplicate soft components used for other controls.
When designing the near-point DOG, please consider that there is enough time to be ON to fully decelerate to the crawl speed.
Please set the near-point DOG between the reverse limit 1 (LSR) and the forward limit 1 (LSF). When near-point DOG, reverse limit 1
(LSR), forward limit 1 (LSF) do not form the relationship shown in the figure below, the action may not be performed.
Please make the crawling speed slow enough. Since it does not decelerate to stop, if the crawling speed is too fast, the stop position
will shift due to inertia.
Error code
Error code Content
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (s3) and (d) exceed the device range
4088H The same pulse output axis (d) is used and has been started.
Example
Set Y1 as the output axis at a maximum speed of 200K, a offset speed of 500, and a acceleration/deceleration time of 100ms. Origin
return is performed at the frequency of 200Khz, and it runs at a crawling speed after receiving the origin signal X0, and it stops after
the X0 signal is reset.
.
• Specify the speed at the start of origin return in (s1). (It should be in the range of 1 to 200000)
• Specify the crawling speed in (s2). (It should be in the range of 1 to 200000)
• Specify the device number of the input number of the near-point signal (DOG) to be input in (s3).
• Specify the device that outputs pulses in (d1). Only Y devices with positioning parameters could be specified.
• Specify the bit device that specify the pulse output direction signal in (d2). Only the device specified in parameters and universal
output could be specified.
• After the DOG contact signal of this instruction disappears, the pulse stops immediately.
• The pulse frequency could be modified during operation.
✎Note:
Please do not duplicate soft components used for other controls.
When designing the near-point DOG, please consider that there is enough time to be ON to fully decelerate to the crawl speed.
Please set the near-point DOG between the reverse limit 1 (LSR) and the forward limit 1 (LSF). When near-point DOG, reverse limit 1
(LSR), forward limit 1 (LSF) do not form the relationship shown in the figure below, the action may not be performed.
Please make the crawling speed slow enough. Since it does not decelerate to stop, if the crawling speed is too fast, the stop position
will shift due to inertia.
Error code
Error code Content
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (s3), (d1) and (d2) exceed the device range
4088H The same pulse output axis (d1) is used and has been started.
Example
Set Y1 as the output axis and Y10 as the direction axis at a maximum speed of 200K, a offset speed of 500, and a
acceleration/deceleration time of 100ms. Origin return is performed at the frequency of 200Khz, and it runs at a crawling speed after
receiving the origin signal X0, and it stops after the X0 signal is reset.
Set Y0 as the output axis and Y1 as the direction axis with the maximum speed of 200K, the offset speed of 500, and the
acceleration/deceleration time of 100ms, and run at a frequency of 200,000, and send 200,000 pulses after receiving the X0 signal.
Specify the number of output pulses -32768 to 32767 Signed BIN16/ ANY16_S/
(s1)
(relative address) -2147483648 to +2147483647 Signed BIN32 ANY32_S
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ● ●●●● ●● ●
Parameter 2 ● ● ● ● ●●●● ●● ●
DRVI
Parameter 3 ●
Parameter 4 ● ● ● ●
Features
This instruction uses incremental mode (specified by position of relative address) to perform single-speed positioning.
With the current stop position as the starting point, specify the movement direction and movement amount (relative address) for
positioning.
• Specify the positioning address of the user unit with a relative address in (s1). (It should be in the range of -2147483647 to
+2147483647)
• Specify the instruction speed of user unit in (s2). (It should be in the range of 1 to 200,000)
• Specify the device that outputs pulses in (d1). Only Y devices with positioning parameters could be specified.
• Specify the bit device of the output direction signal in (d2). Only the devices and general outputs specified in the parameters could
be specified.
• The pulse frequency and pulse position could be modified during the operation of this instruction.
✎Note:
Please do not duplicate device used for other controls.
Error code
Error code Content
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (d1) and (d2) exceed the device range
4088H The same pulse output axis (d1) is used and has been started.
Example
Set Y0 as the output axis, and Y1 as the direction axis with the maximum speed in 200K, and the offset speed in 500, and the
acceleration/deceleration time in 100ms. Send a high-speed pulse with acceleration and deceleration at a frequency of 200KHZ, and
a pulse number of 200K.
• Specify the positioning address of user unit with a absolute address in (s1). (It should be in the range of -2,147,483,647 to
+2,147,483,647)
• Specify the instruction speed of user unit in (s2). (It should be in the range of 1 to 200,000)
• Specify the device that outputs pulses in (d1). Only Y devices with positioning parameters could be specified.
• Specify the bit device of the output direction signal in (d2). Only the devices and general outputs specified in the parameters could
be specified.
• The pulse frequency and pulse position could be modified during the operation of this instruction.
✎Note:
Please do not duplicate device used for other controls.
Error code
Error code Content
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (d1) and (d2) exceed the device range
4088H The same pulse output axis (d1) is used and has been started.
Example
Set Y0 as the output axis, and Y1 as the direction axis with the maximum speed in 200K, and the offset speed in 500, and the
acceleration/deceleration time in 100ms. Send a high-speed pulse with acceleration and deceleration at a frequency of 200KHZ,
starting at the origin position and ending at 200,000
✎Note:
Please do not duplicate device used for other controls.
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (s3) and (d) exceed the device range
4088H The same pulse output axis (d) is used and has been started.
Example
Set Y0 as the output axis at a maximum speed of 200K, and a offset speed of 500, and a acceleration/deceleration time of 100ms.
Send a high-speed pulse with acceleration and deceleration at a frequency of 200KHZ, a pulse number of 200K.
2) Waiting time
When (s) +(n-1)*10+6 =1, it is the waiting time. When (s) +(n-1)*10+7 =0, it is waiting D register, when =1, it is waiting constant.
After the pulse output of the current segment is completed, start timing. When the timing time is up, it will immediately jump to he
specified pulse segment; the timing time could be constant or specified by register D, unit: ms (range: 1-65,535ms).
Example 2: Three pulses are needed now. The pulse frequency of the first segment is 20,000Hz, and the number of pulses is 20,000,
and the waiting time is K100ms. The pulse frequency of the second segment is 40,000Hz, and the number of pulses is 40,000; and the
waiting time is K100ms. The pulse frequency of the third segment is 60,000,and the number of pulses is 60,000 with no waiting
conditions.
The number of segments Pulse frequency The number of pulses Waiting mode Condition
1 20,000 20,000 waiting time K100
2 40,000 40,000 waiting time D100
3 60,000 60,000 No waiting conditions K0
3) Waiting signal
When (s) +(n-1)*10+6=2, it is waiting signal high level (ON status). When (s) +(n-1)*10+6 =3, it is waiting signal low level ( OFF status).
When (s) +(n-1)*10+7 =0, it means waiting for X signal, and =1 means waiting for M signal, =2 means waiting for S signal, =3 means
waiting for Y signal.
Example 3: Three pulses are needed now. The pulse frequency of the first segment is 20,000Hz, and the number of pulses is 20,000,
and the waiting signal is M2. The pulse frequency of the second segment is 40,000Hz, and the number of pulses is 40,000; and the
waiting signal is X2. The pulse frequency of the third segment is 60,000,and the number of pulses is 60,000 with no waiting
conditions.
The number of segments Pulse frequency The number of pulses Waiting mode Condition
1 20,000 20,000 Waiting signal high level M2
2 40,000 40,000 Waiting signal low level X2
3 60,000 60,000 No waiting conditions K0
4) Trigger signal
When (s) +(n-1)*10+6 =4, it is the rising edge of trigger signal. When (s) +(n-1)*10+6 = 5, it is the falling edge of trigger signal.
(s) +(n-1)*10+7 =0 means waiting for X signal, =1 means waiting for M signal, =2 means waiting for S signal, =3 means waiting for Y
signal.
After the current pulse segment starts to send pulses, if the external bit signal triggers operates (ON state) before the current number
of pulses are sent, the next pulse is sent immediately. At the end of the pulse transmission of the current segment, if the signal is not
triggered (OFF state), the next pulse will continue to be sent (that is, the configured pulse segment will be pulsed in a mode without
waiting conditions. But if the current pulse is receiving a trigger signal during the process, it will directly accelerate and decelerate to
the next pulse).
Example 4: Three pulses are needed now. The pulse frequency of the first segment is 20,000Hz, and the number of pulses is 20,000,
If a signal is received in the acceleration section (deceleration section), it will directly accelerate (decelerate) in the current section to
the next pulse frequency.
✎Note: Please do not duplicate device used for other controls.
Error code
Error code Content
4084H The table parameter input data that exceeds the specified range
The table parameter with the first address in the read application instruction (s) exceeds the device range, and
4085H
the output result of the read parameter (s), (d1) and (d2) exceeds the device range
4088H The same pulse output axis (d1) is used and has been started.
✎Note:
Please do not duplicate device used for other controls.
If the acceleration time is 0, no acceleration action will be performed, and the speed is changed to the instruction speed immediately.
If the deceleration time is 0, no deceleration action will be performed, and it will stop immediately when the drive contact is OFF.
4088H The same pulse output axis (d1) is used and has been started.
Example
Set the highest frequency to 200,000K, the offset speed to 500, and the acceleration/deceleration time to 100ms.
✎Note:
Please do not duplicate device used for other controls. Since this instruction has no direction, the direction polarity is invalid, and it
always increases with the current address.
When the reverse limit is used, it will act as the forward limit.
Error code
Error code Content
4084H The data input in the application instruction (s) and (n) exceed the specified range
4085H The result output in the read application instruction (s), (n) and (d) exceed the device range
4088H The same pulse output axis (d) is used and has been started.
• Specify the output pulse width in (s1). (The setting range is 0 to 32,767)
• Specify the output pulse period in (s2). (The setting range is 1 to 32,767)
• Specify the device that outputs pulses in (d). Only Y devices with positioning
parameters can be specified.
• The pulse width and pulse period can be modified during pulse sending.
✎Note:
1 Please do not duplicate device used for other controls.
2 Set pulse width and cycle time. Please set the value of pulse width (s1) and period (s2) as (s1)≤(s2).
3 About pulse output: This instruction is executed in interrupt mode. When the instruction power flow is OFF, the output stops,
and (s1) and (s2) could be modified when the PWM instruction is executed. If it is modified to an incorrect parameter, the sending of
PWM pulse will be stopped.
Related device
Output shaft Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
Percentage mode sign SM897 SM957 SM1017 SM1077 SM1137 SM1197 SM1257 SM1317
Output shaft Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
PWM unit selection SM902 SM962 SM1022 SM1082 SM1142 SM1202 SM1262 SM1322
Take Y0 as an example: When SM902 is OFF, the Y0 PWM output cycle and pulse width are in "ms"; When SM902 is ON, the Y0
PWM output cycle and pulse width are in "us".
Error code
Error code Content
4084H The data input in the application instruction (s1) and (s2) exceed the specified range or (s1)>(s2)
4085H The result output in the read application instruction (s1), (s2) and (d) exceed the device range
4088H The same pulse output axis (d) is used and has been started.
Output shaft Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
PWM unit selection SM902 SM962 SM1022 SM1082 SM1142 SM1202 SM1262 SM1322
Take Y0 as an example: When SM902 is OFF, the Y0 PWM output cycle and pulse width are in "ms"; When SM902 is ON, the Y0
PWM output cycle and pulse width are in "us".
Error code
Error code Content
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2) and (d) exceed the device range
4088H The same pulse output axis (d) is used and has been started.
Example
The period is set to 100ms, if the duty cycle is set to 500, the output is high for 50ms and low for 50ms; if the duty cycle is set to 100,
the output is high for 10ms and low for 90ms; duty cycle If it is set to 900, then the output is high for 90ms and low for 10ms;
The waveform diagram is as follows, the period is 300ms, the duty cycle is 100, and the output is 30ms high level and 270ms low
level:
(s1) is the starting address, and occupies 6 consecutive addresses. s1 is the target position (absolute positioning) of X axis , s1+2 is
the target position (absolute positioning) of Y axis, and s1+4 is the target position (absolute positioning) of Z axis. The range is
-2147483648 to +2147483647.
Specify the synthetic output frequency in (s2) . The range is 1 to 141421.
Specify the device of output pulse in (s2) ,only Y0/Y2 could be specified, and consecutive addresses (Y0, Y1, Y2, Y3) are occupied .
SM345: Set the mode of switching line interpolation. When SM345=0, it is two-axis line interpolation mode. When
SM345=1, it is three-axis line interpolation mode.
If d1 specifies Y0 and SM345=0, Y0 and Y1 are occupied. If SM345=1, Y0, Y1 and Y2 are occupied;
If d1 specifies Y2 and SM345=0, Y2 and Y3 are occupied. If SM345=1, the software reports an error.
Specify the bit device of output direction signal in d2 and occupy 3 consecutive addresses, which indicate the directions of the X, Y,
and Z axes in turn.
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (d1) and (d2) exceed the device range
4088H The same pulse output axis (d1) is used and has been started.
Example
Set Y0 as the interpolation starting axis, Y5 as the direction starting axis, and the maximum speed is 2000, the offset speed is 500,
and the acceleration/deceleration time is 500ms. Send a absolute position line interpolation output based on the original position
which is with acceleration and deceleration, and the end position is X (Y0) axis 100, Y (Y1) axis 100, and the pulse synthesis frequency
is 1000.
(s1) is the starting address, and occupies 6 consecutive addresses. s1 is the target position (relative positioning) of X axis , s1+2 is
the target position (relative positioning) of Y axis, and s1+4 is the target position (relative positioning) of Z axis. The range is
-2147483648 to +2147483647.
Specify the synthetic output frequency in (s2) . The range is 1 to 141421.
Specify the device of output pulse in (s2), only Y0/Y2 could be specified, and consecutive addresses (Y0, Y1, Y2, Y3) are occupied .
SM345: Set the mode of switching line interpolation. When SM345=0, it is two-axis line interpolation mode. When
SM345=1, it is three-axis line interpolation mode.
If d1 specifies Y0 and SM345=0, Y0 and Y1 are occupied. If SM345=1, Y0, Y1 and Y2 are occupied;
If d1 specifies Y2 and SM345=0, Y2 and Y3 are occupied. If SM345=1, the software reports an error.
Specify the bit device of output direction signal in d2 and occupy 3 consecutive addresses, which indicate the directions of the X, Y,
and Z axes in turn.
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (d1) and (d2) exceed the device range
4088H The same pulse output axis (d1) is used and has been started.
Example
Set Y0 as the interpolation starting axis, Y5 as the direction starting axis, and the maximum speed is 2000, and the offset speed is 500,
and the acceleration/deceleration time is 500ms. Send a relative position line interpolation output based on the relative position
which is with acceleration and deceleration , and the incremental position is X (Y0) axis 100, Y (Y1) axis 100, and the pulse synthesis
frequency is 1000.
(s1) is the starting address, and occupies 6 consecutive addresses. s1 is the target position (absolute positioning) of X axis , s1+2 is
the target position (absolute positioning) of Y axis, and s1+4 is the target position (absolute positioning) of Z axis. The range is
-2147483648 to +2147483647.
Specify radius or center mode in (s2), and occupy 4 consecutive addresses. The center coordinate of s2+0 is in the difference value
of the number of pulse output of X axis relative to the current position, or the number of the pulse of radius R. The center
coordinate of s2+2 is in the difference value of the number of pulse output of Y axis relative to the current position. When using
radius, the value must be 0X7FFF FFFF. The range is 1 to 141421.
Specify the synthetic output frequency in (s3) . The range is 1 to 100000.
Specify the device of output pulse in (d1), only Y0 could be specified, and consecutive addresses (Y0, Y1) are occupied .
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (d1) and (d2) exceed the device range
4088H The same pulse output axis (d1) is used and has been started.
Set Y0 as the interpolation starting axis, Y5 as the direction starting axis, and the maximum speed is 2000, and the offset speed is 500,
and the acceleration/deceleration time is 500ms. Send a absolute position clockwise circular interpolation output based on the
absolute position with acceleration and deceleration, and the target position is X (Y0) axis 100, Y (Y1) axis 100, and the the radius is
1000 pulse in radius mode, and the pulse synthesis frequency is 1000.
s1 is the starting address, and occupies 4 consecutive addresses. s1 is the target position of X axis (relative positioning), s1+2 is the
target position of Y axis (relative positioning). The range is -2147483648 to +2147483647.
Specify radius or center mode in (s2), and occupy 4 consecutive addresses. The center coordinate of s2+0 is in the difference value
of the number of pulse output of X axis relative to the current position, or the number of the pulse of radius R. The center
coordinate of s2+2 is in the difference value of the number of pulse output of Y axis relative to the current position. When using
radius, the value must be 0X7FFF FFFF. The range is 1 to 141421.
Specify the synthetic output frequency in (s3) . The range is 1 to 100000.
439 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
Specify the device of output pulse in (d1), only Y0 could be specified, and consecutive addresses (Y0, Y1) are occupied .
Specify the bit device of output direction signal in (d2), and occupy 2 consecutive addresses, which indicate the directions of the X
and Y axes in turn.
✎Note:
1 Please do not duplicate device that used for other controls.
2 When using interpolation instruction, the parameter settings (such as acceleration/deceleration time and other parameters)
are subject to the starting axis specified by d1.
3 The maximum radius supported by circular interpolation is plus or minus 800,000 pulses, and the radius cannot be zero.
4 There are two modes for setting s2: IJ mode (circle center coordinate mode) and R mode (radius mode). When the value of
s2+2 is set to 0x7FFF FFFF, it is R mode (radius mode), otherwise it is IJ mode (circle center coordinate mode).
5 IJ mode: Regardless of absolute position interpolation or relative position interpolation, s2 is only expressed as the
difference of the pulse output number between the coordinates of the center of the circle on the XY axis (Y0/Y1) relative to the
current position, and both are in the offset value.
6 R mode (radius mode): When the value of R is greater than 0, it indicates that it is an arc less than or equal to 180 degrees.
When the value of R is less than 0, it indicates that it is an arc greater than or equal to 180 degrees. A full circle cannot be generated
In R mode because there are infinite solutions.
7 When s1 indicates the relative position of target position, a reasonable target position needs to be set to ensure that the
target arc path can be generated correctly. When s1+0=0 and s1+2=0, it means that a full circle is generated.
8 When using the interpolation instruction, parameter settings (such as celebration/deceleration time and so on) are subject
to the X axis (Y0);
9 The actual synthetic frequency S (the lowest frequency value) is the lowest base frequency of the output synthetic
frequency. The calculation modes are as follows:
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (d1) and (d2) exceed the device range
4088H The same pulse output axis (d1) is used and has been started.
Set Y0 as the interpolation starting axis, Y5 as the direction starting axis, and the maximum speed is 2000, and the offset speed is 500,
and the acceleration/deceleration time is 500ms. Send a relative position clockwise circular interpolation output based on relative
position with acceleration and deceleration, and the incremental position is X (Y0) axis 100, Y (Y1) axis 100, and the the radius is 1000
pulse in radius mode, and the pulse synthesis frequency is 1000.
s1 is the starting address, and occupies 4 consecutive addresses. s1 is the target position of X axis (absolute positioning), s1+2 is
the target position of Y axis (absolute positioning). The range is -2147483648 to +2147483647.
Specify radius or center mode in (s2), and occupy 4 consecutive addresses. The center coordinate of s2+0 is in the difference value
of the number of pulse output of X axis relative to the current position, or the number of the pulse of radius R. The center
coordinate of s2+2 is in the difference value of the number of pulse output of Y axis relative to the current position. When using
radius, the value must be 0X7FFF FFFF. The range is 1 to 141421.
442 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
Specify the synthetic output frequency in (s3) . The range is 1 to 100000.
Specify the device of output pulse in (d1), only Y0 could be specified, and consecutive addresses (Y0, Y1) are occupied .
Specify the bit device of output direction signal in (d2), and occupy 2 consecutive addresses, which indicate the directions of the X
and Y axes in turn.
✎Note:
1 Please do not duplicate device that used for other controls.
2 When using interpolation instruction, the parameter settings (such as acceleration/deceleration time and other parameters)
are subject to the starting axis specified by d1.
3 The maximum radius supported by circular interpolation is plus or minus 800,000 pulses, and the radius cannot be zero.
4 There are two modes for setting s2: IJ mode (circle center coordinate mode) and R mode (radius mode). When the value of
s2+2 is set to 0x7FFF FFFF, it is R mode (radius mode), otherwise it is IJ mode (circle center coordinate mode).
5 IJ mode: Regardless of absolute position interpolation or relative position interpolation, s2 is only as the difference of the
pulse output number between the coordinates of the center of the circle on the XY axis (Y0/Y1) relative to the current position, and
both are in the offset value.
6 R mode (radius mode): When the value of R is greater than 0, it indicates that it is an arc less than or equal to 180 degrees.
When the value of R is less than 0, it indicates that it is an arc greater than or equal to 180 degrees. A full circle cannot be generated
In R mode because there are infinite solutions.
7 When s1 indicates the relative position of target position, a reasonable target position needs to be set to ensure that the
target arc path can be generated correctly. When s1+0=0 and s1+2=0, it means that a full circle is generated.
8 When using the interpolation instruction, parameter settings (such as celebration/deceleration time and so on) are subject
to the X axis (Y0);
9 The actual synthetic frequency S (the lowest frequency value) is the lowest base frequency of the output synthetic
frequency. The calculation modes are as follows:
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (d1) and (d2) exceed the device range
4088H The same pulse output axis (d1) is used and has been started.
Set Y0 as the interpolation starting axis, Y5 as the direction starting axis, the maximum speed is 2000, the offset speed is 500, and the
acceleration/deceleration time is 500ms. Send a absolute position counterclockwise circular interpolation output based on relative
position with acceleration and deceleration, and the target position is X (Y0) axis 100, Y (Y1) axis 100, and the the radius is 1000 pulse
in radius mode, and the pulse synthesis frequency is 1000.
s1 is the starting address, and occupies 4 consecutive addresses. s1 is the target position of X axis (absolute positioning), s1+2 is
the target position of Y axis (absolute positioning). The range is -2147483648 to +2147483647.
Specify radius or center mode in (s2), and occupy 4 consecutive addresses. The center coordinate of s2+0 is in the difference value
of the number of pulse output of X axis relative to the current position, or the number of the pulse of radius R. The center
coordinate of s2+2 is in the difference value of the number of pulse output of Y axis relative to the current position. When using
radius, the value must be 0X7FFF FFFF. The range is 1 to 141421.
Specify the synthetic output frequency in (s3) . The range is 1 to 100000.
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (d1) and (d2) exceed the device range
4088H The same pulse output axis (d1) is used and has been started.
Set Y0 as the interpolation starting axis, Y5 as the direction starting axis, the maximum speed is 2000, the offset speed is 500, and the
acceleration/deceleration time is 500ms. Send a relative position reverse circular interpolation output based on relative position
with acceleration and deceleration, and the incremental position is X (Y0) axis 100, Y (Y1) axis 100, and the the radius is 1000 pulse in
radius mode, and the pulse synthesis frequency is 1000.
(s1) is the starting address, and occupies 8 consecutive addresses. s1 is the target position (absolute positioning) of X axis , s1+2 is
the target position (absolute positioning) of Y axis, and s1+4 is the target position (absolute positioning) of Z axis, and s1+6 is the
lead range of Z axis. The lead range is 0 K 4 2 R .(The range is -2147483648 to +2147483647.)
Specify radius or center mode in (s2), and occupy 4 consecutive addresses. The coordinate of circle center of s2+0 is in the
difference value of the number of pulse output of X axis relative to the current position, or the number of the pulse of radius R.
The coordinate of circle center of s2+2 is in the difference value of the number of pulse output of Y axis relative to the current
position. When using radius, the value must be 0X7FFF FFFF. The range is 1 to 141421.
Specify the synthetic output frequency in (s3) . The range is 1 to 100000. Helical interpolation can switch the synthetic frequency
Ze
lead K=50, and the actual radian * 2 )
K
7 When using the interpolation instruction, parameter settings (such as acceleration/deceleration time and so on) are subject
to the X axis (Y0);
8 The actual synthetic frequency S (the lowest frequency value) is the lowest base frequency of the output synthetic
frequency. The calculation modes are as follows:
turns of helical interpolation n is determined by formula (1), and recalculate the end point coordinates of X axis and Y axis
according to the number of turns of interpolation.
The final interpolation result is: make sure that lead is equal to K, and the end point of Z axis is equal to Ze .The actual end point
position of X and Y axes Xe ' ,Ye ' may not be equal to the set Xe, Ye , but it must pass through the set point Xe, Ye in the
whole circle.
Ze Zs
n (1)
K
10 In helical interpolation radius mode, the center distribution table of whole circle is as below. (For example: the starting
point coordinate 0,0,0 ,the end point coordinate (0,0, Ze) ).
Helical interpolation Coordinate of circle Helical interpolation Coordinate of circle
Radius value R Radius value R
direction center direction center
R>0 (0, R) Counterclockwise R>0 (0, -R)
Clockwise circular
-R < 0 (0, -R) circular -R < 0 (0, R)
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (d1) and (d2) exceed the device range
4088H The same pulse output axis (d1) is used and has been started.
Set Y0 as the interpolation starting axis, Y4 as the direction starting axis, and the maximum speed is 2000, and the offset speed is 500,
and the acceleration/deceleration time is 500ms. Send a absolute position clockwise circular helical interpolation output based on
the absolute position with acceleration and deceleration, and the target position is X (Y0) axis 0, Y (Y1) axis 0 and Z (Y2) axis 5000,
and the lead is 5000, and the radius is 5000 pulse in radius mode, and the synthesis frequency is 1000.
(s1) is the starting address, and occupies 8 consecutive addresses. s1 is the target position (relative positioning) of X axis , s1+2 is
the target position (relative positioning) of Y axis, and s1+4 is the target position (relative positioning) of Z axis, and s1+6 is the lead
range of Z axis. The lead range is 0 K 4 2 R .(The range is -2147483648 to +2147483647.)
Specify radius or center mode in (s2), and occupy 4 consecutive addresses. The coordinate of circle center of s2+0 is in the
difference value of the number of pulse output of X axis relative to the current position, or the number of the pulse of radius R.
The coordinate of circle center of s2+2 is in the difference value of the number of pulse output of Y axis relative to the current
position. When using radius, the value must be 0X7FFF FFFF. The range is 1 to 141421.
Specify the synthetic output frequency in (s3). The range is 1 to 100000. Helical interpolation can switch the synthetic frequency
Ze
Ze=75, lead K=50, and the actual radian * 2 )
K
7 When using interpolation instruction, parameter settings (such as acceleration/deceleration time and so on) are subject to
the X axis (Y0);
8 The actual synthetic frequency S (the lowest frequency value) is the lowest base frequency of the output synthetic
frequency. The calculation modes are as follows:
turns of helical interpolation n is determined by formula (1), and recalculate the end point coordinates of X axis and Y axis
according to the number of turns of interpolation.
The final interpolation result is: make sure that lead is equal to K, and the end point of Z axis is equal to Ze .The actual end point
position of X and Y axes Xe ' ,Ye ' may not be equal to the set Xe, Ye , but it must pass through the set point Xe, Ye in the
whole circle.
Ze Zs
n (1)
K
10 In helical interpolation radius mode, the center distribution table of whole circle is as below. (For example: the starting
point coordinate 0,0,0 ,the end point coordinate (0,0, Ze) ).
Helical interpolation Coordinate of Helical interpolation Coordinate of
Radius value R Radius value R
direction circle center direction circle center
R>0 (0, R) Counterclockwise R>0 (0, -R)
Clockwise circular
-R < 0 (0, -R) circular -R < 0 (0, R)
4084H The data input in the application instruction (s1) and (s2) exceed the specified range
4085H The result output in the read application instruction (s1), (s2), (d1) and (d2) exceed the device range
4088H The same pulse output axis (d1) is used and has been started.
Set Y0 as the interpolation starting axis, Y4 as the direction start axis, and the maximum speed is 2000, and the offset speed is 500,
and the acceleration/deceleration time is 500ms. Send a relative position clockwise circular helical interpolation output based on the
relative position with acceleration and deceleration, and the target position is X (Y0) axis 0, Y (Y1) axis 0 and Z (Y2) axis 5000, and the
lead is 5000, and the radius is 5000 pulse in radius mode, and the synthesis frequency is 1000.
(s1) is the starting address, and occupies 8 consecutive addresses. s1 is the target position (absolute positioning) of X axis , s1+2 is
the target position (absolute positioning) of Y axis, and s1+4 is the target position (absolute positioning) of Z axis, and s1+6 is the
lead range of Z axis. The lead range is 0 K 4 2 R .(The range is -2147483648 to +2147483647.)
Specify radius or center mode in (s2), and occupy 4 consecutive addresses. The coordinate of circle center of s2+0 is in the
difference value of the number of pulse output of X axis relative to the current position, or the number of the pulse of radius R.
The coordinate of circle center of s2+2 is in the difference value of the number of pulse output of Y axis relative to the current
position. When using radius, the value must be 0X7FFF FFFF. The range is 1 to 141421.
Specify the synthetic output frequency in (s3). The range is 1 to 100000. Helical interpolation can switch the synthetic frequency
Ze
Ze=75, lead K=50, and the actual radian * 2 )
K
7 When using the interpolation instruction, parameter settings (such as acceleration/deceleration time and so on) are subject
to the X axis (Y0);
8 The actual synthetic frequency S (the lowest frequency value) is the lowest base frequency of the output synthetic
frequency. The calculation modes are as follows:
turns of helical interpolation n is determined by formula (1), and recalculate the end point coordinates of X axis and Y axis
according to the number of turns of interpolation.
The final interpolation result is: make sure that lead is equal to K, and the end point of Z axis is equal to Ze .The actual end point
position of X and Y axes Xe ' ,Ye ' may not be equal to the set Xe, Ye , but it must pass through the set point Xe, Ye in the
whole circle.
Ze Zs
n (1)
K
10 In helical interpolation radius mode, the center distribution table of whole circle is as below. (For example: the starting
point coordinate 0,0,0 ,the end point coordinate (0,0, Ze) ).
Helical interpolation Radius Coordinate of Helical interpolation Radius Coordinate of circle
direction value R circle center direction value R center
R>0 (0, R) Counterclockwise R>0 (0, -R)
Clockwise circular
-R < 0 (0, -R) circular -R < 0 (0, R)
4084H (S1) (s2) input data that exceeds the specified range in application instruction.
4085H The output result of (s1)(s2)(d1)(d2) in the read application instruction exceeds the device range.
4088H The same pulse output axis (d1) is used and has been started.
Set Y0 as the interpolation starting axis, Y4 as the direction starting axis, and the maximum speed is 2000, and the offset speed is 500,
and the acceleration/deceleration time is 500ms. Send a absolute position counterclockwise circular helical interpolation output
based on the absolute position with acceleration and deceleration, and the target position is X (Y0) axis 0, Y (Y1) axis 0 and Z (Y2) axis
5000, and the lead is 5000, and the radius is 5000 pulse in radius mode, and the synthesis frequency is 1000.
(s1) is the starting address, and occupies 8 consecutive addresses. s1 is the target position (relative positioning) of X axis , s1+2 is
the target position (relative positioning) of Y axis, and s1+4 is the target position (relative positioning) of Z axis, and s1+6 is the lead
0 K 4 2 R
range of Z axis. The lead range is .(The range is -2147483648 to +2147483647.)
Specify radius or center mode in (s2), and occupy 4 consecutive addresses. The coordinate of circle center of s2+0 is in the
difference value of the number of pulse output of X axis relative to the current position, or the number of the pulse of radius R.
The coordinate of circle center of s2+2 is in the difference value of the number of pulse output of Y axis relative to the current
position. When using radius, the value must be 0X7FFF FFFF. The range is 1 to 141421.
Specify the synthetic output frequency in (s3). The range is 1 to 100000. Helical interpolation can switch the synthetic frequency
Ze
Ze=75, lead K=50, and the actual radian * 2 )
K
7 When using interpolation instruction, parameter settings (such as acceleration/deceleration time and so on) are subject to
the X axis (Y0);
8 The actual synthetic frequency S (the lowest frequency value) is the lowest base frequency of the output synthetic
frequency. The calculation modes are as follows:
of helical interpolation n is determined by formula (1), and recalculate the end point coordinates of X axis and Y axis according
to the number of turns of interpolation.
The final interpolation result is: make sure that lead is equal to K, and the end point of Z axis is equal to Ze .The actual end point
position of X and Y axes Xe ' ,Ye ' may not be equal to the set Xe, Ye , but it must pass through the set point Xe, Ye in the
whole circle.
Ze Zs
n (1)
K
10 In helical interpolation radius mode, the center distribution table of whole circle is as below. (For example: the start point
coordinate 0,0,0 ,the end point coordinate (0,0, Ze) ).
Helical interpolation Radius Coordinate of Helical interpolation Radius Coordinate of circle
direction value R circle center direction value R center
R>0 (0, R) Counterclockwise R>0 (0, -R)
Clockwise circular
-R < 0 (0, -R) circular -R < 0 (0, R)
4084H (S1) (s2) input data that exceeds the specified range in application instruction.
4085H The output result of (s1)(s2)(d1)(d2) in the read application instruction exceeds the device range.
4088H The same pulse output axis (d1) is used and has been started.
Set Y0 as the interpolation starting axis, Y4 as the direction starting axis, and the maximum speed is 2000, and the offset speed is 500,
and the acceleration/deceleration time is 500ms. Send a relative position counterclockwise circular helical interpolation output
based on the relative position with acceleration and deceleration, and the target position is X (Y0) axis 0, Y (Y1) axis 0 and Z (Y2) axis
5000, and the lead is 5000, and the radius is 5000 pulse in radius mode, and the synthesis frequency is 1000.
When positioning instruction action, such as the limit switch of forward limit or reverse limit, acts, please set and connect forward
limit 1 (LSF) and reverse limit 1(LSR) on the CPU module if you want to use CPU for retreat, and these two limits should act before the
forward limit 2 or the reverse limit 2 of the servo amplifier.
Special device:
Output axis Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
Forward limit SM883 SM943 SM1003 SM1063 SM1123 SM1183 SM1243 SM1303
Reverse limit SM884 SM944 SM1004 SM1064 SM1124 SM1184 SM1244 SM1304
If forward limit 1(LSF) and reverse limit 1(LSR) are not set, servo motor will stop automatically even if the forward limit 2 or the
reverse limit 2 is in action. But the positioning instruction in action can’t identify this situation, it will output pulses until the
instruction ends.
When forward limit or reverse limit acts, it will stop according the set stop method (deceleration stop, immediate stop).
If the instruction has no direction, then both the forward limit and the reverse limit are valid for the instruction.
(4) Direction polarity
When [0: increase current address by forward pulse output] is selected, the current address increases when the forward pulse is
output, and decreases when the reverse pulse is output.
When [1: Increase current address by reverse pulse output] is selected, the current address is increased during reverse pulse output
and decreased during forward pulse output.
460 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
The default is 0: increase the current address through forward pulse output。
Special device:
Output axis Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
Direction polarity SM885 SM945 SM1005 SM1065 SM1125 SM1185 SM1245 SM1305
(5) Origin return correlation (ZRN)
Origin return enable [default is 1: enable the origin return function]
Select [0: turn off origin return function], that is, the origin return instruction is disabled and cannot be used.
Select [1: turn on origin return function], that is, the origin return instruction is enabled and can be used normally.
Origin return direction [default is 0: the direction of origin return is negative]
Select [0: the direction of origin return is negative], that is, the pulse output count is negative.
Select [1: the direction of origin return is positive], that is, the pulse output count is positive.
Special device:
Output axis Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
Origin return enable SM886 SM946 SM1006 SM1066 SM1126 SM1186 SM1246 SM1306
Origin return direction SM887 SM947 SM1007 SM1067 SM1127 SM1187 SM1247 SM1307
(6) External signal correlation
External signal start [default is 0: turn off the external signal start function]
Select [0: turn off external signal start function], that is, the external signal start function is not used.
Select [1: turn on external signal start function], that is, when an external signal is received, the pulse will be sent.
External signal logic [default is 0: OFF signal]
Select [0:OFF signal], that is, when the signal is OFF, it means the signal is received.
Select [1: ON signal], that is, when the signal is ON, it means the signal is received.
For the specific external signal, refer to the external signal of the word Devices. The external signal is affected by the scan cycle and is
judged in the instruction. If the X signal is used as an external signal, the signal is affected by the X point filtering.
Special device:
Output axis Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
External signal start SM892 SM952 SM1012 SM1072 SM1132 SM1192 SM1252 SM1312
External signal logic SM893 SM953 SM1013 SM1073 SM1133 SM1193 SM1253 SM1313
[1: Stop immediately]: Stop immediately after receiving the stop signal without decelerating movement.
2 Modify to the number of unreachable pulses (only support instructions with direction. If there is no direction, stop pulse
sending)
✎Note: When the frequency is modified during the operation, acceleration would accelerate again from zero. There will be
discontinuous acceleration.
(16) Oringin return mode
Output axis Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
Origin return mode SD914 SD974 SD1034 SD1094 SD1154 SD1214 SD1274 SD1334
[SD919, [SD979, [SD1039, [SD1099, [SD1159, [SD1219, [SD1279, [SD1339,
Origin return distance
SD918] SD978] SD1038] SD1098] SD1158] SD1218] SD1278] SD1338]
Origin return mode 0:
Origin return mode 2: When the signal is received, go to the specified origin return distance and then search for the origin 0 at
crawling speed.
Origin return mode 2: Start running toward zero based on the current position, and search for the origin at crawling speed after
reaching zero.
9 Electronic cam
9.1 Electronic CAM (ECAM) instruction
DEGEAR/Electronic gear/32 bit hand wheel instruction
DEGEAR
Electronic gear function refers to the function of multiplying the speed of the driving shaft by the set gear ratio and outputting to the
driven shaft at this speed to control the mechanical operation.
-[DEGEAR (s1) (s2) (s3) (d1) (d2)]
Set the 32-bit gear ratio: 18518517: 12345678, set the 15 address of the data buffer to 1, and enable the 32-bit gear ratio function.
M1 turns ON to turn on the electronic gear command, M2 turns ON, LC0 will increase by 1 every 100ms, at this time SD880:LC0
always = 18518517:12345678.
(3) Use of gear ratio switching function
Error code
Error code Content
4E80H E-cam table loading error
4E81H The currently numbered form has a cam in use
4084H Data exceeding 1 to 2 is specified in (s1)
4085H The (s2) table exceeds the device range
Example
Realize the mutual switching between electronic cam form 1 and form 2
✎Note:
1 According to the above Circuit program, first set M2, configure table 1 data, and use ECAMCUT to designate table 1 as
electronic cam operation table 1.
2 Set M200 to configure the cam running command DECAM.
3 Set M201 to enable electronic cam operation. And automatically prepare table 2 data, and assign table 2 data as electronic
cam operation table 2.
4 Set the second position of D2004 to 1 to turn on the electronic cam switching table function. At this time, table 1 is run in
the current cycle, and table 2 is run in the next cycle.
5 Use manual addition (M110) to change the master axis (LC0), and the slave axis pulse number SD880 will also change, and
the ratio is the ratio of Table 1 (1:2).
6 When LC0 = 100, the program automatically switches to Table 2 to run, LC0 increment: SD880 increment = 2000:120500.
And currently running table 2 and next cycle running table 1. When LC0 = 2100, switch back to Table 1 to run.
✎Note:
After the curve is successfully generated by the ECAMTBX instruction, the cam table can be uploaded to the upper computer for
viewing in the PLC of the PLC Edit upper computer software.
Example
For details, please refer to "9.2 Instruction manual of Electronic CAM (ECAM )".
(1) Parameters
Parameter Content Range Data type Data type (label)
-2147483648 to
(s1) Specify to receive the input pulse of the master axis Signed BIN 32 bit ANY32
+2147483647
(s2) Specify the data buffer area of the ECAM instruction Form LIST
(s3) The external start signal of ECAM needs to be X/M/S/D.b Signed BIN 32 bit ANY32
Parameter 1 ● ● ●●
Parameter 2
DECAM Parameter 3 ● ● ● ● ●●
Parameter 4 ●
Parameter 5 ● ● ●
(2) Function description
When the contact M0 is turned on, the PLC activates ECAM function, but the ECAM function is not yet running at this time, it just
initializes the parameters of the cam. It includes that D1000 to D1005, D1031, D1032 will be cleared and check whether the cam
table is correct. After initialization, these registers still need to be set for control.
This instruction configures the relevant registers and required data for cam operation, and enables the function of ECAM, but the
cam does not actually run. To actually enable the ECAM function, the relevant device in the cache address of the instruction (such as
D1000 in the instruction) is also needed to control the start and stop of the cam.
If the instruction is disconnected, the cam stops working.
Refer to the description of "9.2.2.5 ECAM function register" for the definition of cam parameter devices.
(3) Instruction error description
When the instruction is running, PLC will check the relevant cam parameters in the cache address and prompt the corresponding
error. You can find the error according to the prompt [PLC Error code information]:
Error code Content
4084H The parameter set in the instruction exceeds the limit
4085H The device used in the instruction exceeds the maximum device number
4088H Multiple application instructions use the same output axis for pulse output
4E80H ECAM table loading error
4E81H The currently numbered form has a cam in use
4E82H ECAM table address error
4E83H The electronic cam table exceeds the device range
When an error occurs, the ECAM function is not enabled at this time.
(4) Devices involved in instruction execution
Devices Content
SD881 (high byte), SD880 (low byte) Y000 Output pulse number. Decrease when reversed. (Use 32 bits)
SD941 (high byte), SD940 (low byte) Y001 Output pulse number. Decrease when reversed. (Use 32 bits)
SD1001 (high byte), SD1000 (low byte) Y002 Output pulse number. Decrease when reversed. (Use 32 bits)
SD1061 (high byte), SD1060 (low byte) Y003 output pulse number. Decrease when reversed. (Use 32 bits)
SD1121 (high byte), SD1120 (low byte) Y004 Output pulse number. Decrease when reversed. (Use 32 bits)
SD1181 (high byte), SD1180 (low byte) Y005 Output pulse number. Decrease when reversed. (Use 32 bits)
SD1241 (high byte), SD1240 (low byte) Y006 Number of output pulses. Decrease when reversed. (Use 32 bits)
SD1301 (high byte), SD1300 (low byte) Y007 Output pulse number. Decrease when reversed. (Use 32 bits)
3) Example description
The following figure shows the ECAM data, where the spindle length is 50000, the output unit is the number of pulses, and the
synchronization range is 20000 to 30000. When running into the synchronization zone, the synchronization terminal output can
be used as a control signal. To create ECAM data, please refer to the ECAM data. Hardware circuit Y1 outputs pulse to connect
to X0, and it means that the spindle input terminal receives the output pulse of Y1.
This example is to use the software PLC Editor2 to set the table.
Instructions
1 When executing the program, the special register is set first. The set parameters are as follows:
A. Double word is composed of SD881 and SD880, the current position of Y0 is cleared to 0,
B. Start the high-speed counter HSC0 and configure it as a single-phase input to receive the high-speed pulse input of X0
(in this case, the pulse of X0 comes from the output pulse of Y1).
2 SET M0 to start the ECAM, Y axis starts to perform variable speed movement. The main axis receives variable speed input
pulse of Y axis, the slave axis outputs pulse according to the ECAM curve, and when the main axis position is 20000-30000
in each cycle, Y7 is ON state.
✎Note: Special registers must be set before the ECAM is started. Set the upper and lower limits of the synchronization position of
3) Example explanation
The following figure shows the ECAM running table (the spindle length is 0 to 100000 for a cycle), and its output is the
number of pulses. When the external signal X2 is triggered by the rising edge, execute two consecutive tables (D1014=2), and
wait for the X2 rising edge Trigger again, and execute two consecutive tables again, and so on.
This example uses the software PLC EDITOR to ECam0. Please refer to 9.2.2.5 for the detailed steps of creating an ECAM curve.
The Y1 axis of the hardware circuit outputs pulse and connects to the X0 axis input terminal, indicating that input terminal
position of master axis is to receive the pulse output of Y1 axis as input.
Operation steps
1 When the program is executed, set special registers first, and the set parameters are as follows:
A. The contents of SD880, SD881 and SD940, SD941 are cleared to 0
B. Set D1014=2 (repeat the form twice)
2 Set M0: Configure and start the cam. When M0 is the rising edge, set D1003-Bit5 to use an external start signal;
when D1005=2, Y1 outputs pulses, and Y0 axis has not output yet at this time.
3 The external signal X2 is triggered, and Y0 axis is output with the ECAM curve; the output stops after 2 cycles.
4 RST M0: Close the ECAM mode; if runs RST M0 when the ECAM is running, Y0 axis will stop output immediately.
Number of repetitions=1
Address 15 Aperiodic electronic cams or periodic delay electronic cams. The electronic cam table will be
32-bit unsigned integer
Address 16 executed immediately after the spindle rotates the set number of pulses
When executing aperiodic electronic cams or periodic delayed electronic cams, if address 3 (Bit0-delayed start enable) is set, the
delayed start function is enabled. The slave axis receives a cam start signal. If the electronic cam table is not executed immediately,
the table is run after delaying the spindle rotation for several pulses. At this time, the number of delayed pulses must be set for
address 16.
As shown in the figure below: When the system receives a cam start signal, the electronic cam table will be executed immediately
after the spindle rotates the set number of pulses.
Delayed start pulse=10
The chart is mainly divided into 4 parts, namely the relative position of the master/slave axis, the relative speed of the master/slave
axis, the relative acceleration of the master/slave axis, and the bottom data setting. The first three parts are used to display the CAM
data set by the user. The horizontal axis is the main axis, and the vertical axis is the position of the slave axis, the speed ratio of the
slave axis to the master axis, and the acceleration ratio of the slave axis to the master axis. The data setting area is introduced as
follows:
1 Displacement resolution: Provide users to set the total number of data points occupied by the table, and the setting range
is from 10 to 512, one point occupies 4 WORD Devicess.
2 Data setting: Describe the displacement change of the master/slave axis by function.
3 Import: describe the displacement change of the master/slave axis through a point-to-point method.
4 Export: Export and archive the change relationship of the master/slave axis in a point-to-point manner.
1) Functionally describe the position changes of the master and slave axes
Select [Data Setting] in the data setting area and the "Data Setting Window" will appear, which allows the user to describe the
curve of the entire cam in a function, rather than a point-to-point description. At present, Wecon PLC provides 3 cam curve
modes for users to choose, namely: Const Speed (constant speed), Const Acc (uniform acceleration), BSpline (cycloid).
②. In the synchronization zone and the spindle at the same speed and output the cutting signal (CLR0);
③. After leaving the synchronization zone, the slave axis will decelerate and move back to the origin to complete a cycle of
cutting. After knowing the stroke, the speed relationship can be drawn.
2) In the peeling process, the most important thing is speed synchronization. For example, when the cutting knife contacts
the material, it must be synchronized with the material speed. If the cutting knife speed is greater than the synchronous
speed during contact, a force that pulls the material forward will cause the material to be uneven. If the speed is lower
than the material speed, it will appear. Blocking phenomenon.
3) The planning of the synchronization area will affect the operation of the actual equipment. If the synchronization area is
larger in a cutting cycle, the acceleration and deceleration time will be smaller, which means that the equipment needs to
be accelerated and decelerated in a short time. For motors and machines The impact of the cutter is very large, and it is
easy to cause the servo over-current alarm and the equipment cannot operate normally.
Slave axis
among them
Parameter 4 synchronization Floating
V1(V2)=Master (slave) axis speed
magnification
Address 7 F1(F2)=Master (slave) axis speed (Hz)
D1(D2)=Master (slave) shaft diameter
R1 (R2) = master (slave) axis pulse number per revolution
Calculation method two:
Slave axis synchronization magnification=1mm The number of
pulses required by the slave axis/
Number of pulses required by 1mm spindle
Address 16 End of After the curve is correctly generated, the calculated end position
Parameter 10 synchronization 32-bit integer of the spindle synchronization area can be used to set the lower
Address 17 zone limit of the synchronization area.
It is valid only when parameter 6 acceleration curve is set to 4.
Address 18 Slave axis minimum
Make sure that the actual maximum speed of the slave axis
limit operation Floating
Parameter 11 cannot be less than the speed corresponding to this value.
Address 19 magnification
Thereby adjusting the slope of the deceleration section.
✎Note:
When setting the maximum limit magnification, synchronization magnification, and minimum limit operation magnification, the
material length boundary is also determined. Several limit values are as follows:
1 The speed of the shortest material (Lm1) satisfies: the actual maximum operating magnification = the maximum limit
magnification, and the adjustment area is a constant speed + deceleration process.
2 The shortest normal material (Lm2): the actual maximum operating magnification = the maximum limit magnification, the
adjustment area is the acceleration + deceleration process.
Therefore, the length of the material determines the type of operation of the slave axis:
① When Lm1 ≤ L <Lm2, this is a short material, and its 0 ≤ actual maximum operating magnification ≤ maximum limit magnification
② When Lm2 ≤ L <Lm3, this is a normal material, and its minimum limit operation magnification ≤ actual maximum operation
magnification ≤ maximum limit magnification
③ When L ≥ Lm3, this is a long material, and the actual maximum operating magnification = minimum limit magnification. There is a
residence zone, the longer the material, the longer the residence time.
2) Example
The process result will be different according to the difference of the maximum limit magnification, synchronization magnification
and minimum limit operation magnification.
① Synchronous magnification <minimum limit operation magnification <maximum limit magnification
Normal materials:
Long material:
In this case, when the material is long, there is no deceleration into the synchronization zone. The parameter settings are as follows:
The situation of short material and normal material is the same as described in 2.1.
Long material: (no deceleration process in the adjustment zone)
(4) Case
1) Control requirements:
①. Use rotary saw curve to automatically generate cam table.
②. For the equipment matched with the cutting axis and the feeding axis, the servo parameter is 1,000 pulse/rev.
③. Related parameters:
Cutting material length is 1000 mm, cutting shaft circumference is 60πmm, feeding shaft circumference is 100πmm, and
feeding shaft speed is 1,000 Hz
2) Parameters required to establish rotary saw curve
Parameter 1: You eed to input the length of the spindle cutting material because the cutting material length is 1000mm, it is
converted to pulse
1000*1000/100Pi=3183 (pulse)
Parameter 2: The circumference of the slave shaft, that is, the number of pulses required for one revolution of the slave shaft
1000 pulse
Parameter 3: The synchronization length of the slave axis is set to approximately 1/3 of the circumference of the slave axis as
1000/3=333 pulse.
Parameter 4: During synchronization, the speed ratio of master and slave
Parameter 5: The maximum magnification limit is: set to 10 times the synchronization magnification as 50/3 (floating point number).
Parameter 6: Low WORD is set to 0 - uniform acceleration
High WORD set to 0 - LEFTCAM
Parameter 7: Set the curve generation result to 0
Using curve generation instructions, ECAMTBX generates curves.
Spindle length
Slave length
Slave synchronization length
Acceleration curve
CAM curve solution resolution
Set as rotary saw curve
Flying saw control is used in pipe cutting machines, beverage filling and other equipment that needs to move with the processed
product; its action is to add axis (slave axis)-start to accelerate and follow the processed product, and after moving to the
synchronization zone, it will contact the processed product Start processing at a constant speed. After leaving the synchronization
zone, the speed will decrease and stop, and then return to the starting position. All the stroke feeding axes (spindles) have been
feeding at a constant speed. As shown below.
②. Related parameters
The processing length of the feeding shaft is 660 mm, and the circumference of the feeding shaft is 60πmm
The machining length of the machining shaft is 40 mm
One rotation of the machining axis is 20 mm
The feed shaft speed is 1000 Hz
2) Establish flying saw curve by rotary saw curve
The parameters needed to establish rotary saw curve
Spindle length (processing length): Assuming that the spindle servo parameter is 1000 pulse/rev and the mechanism parameter
is 60π mm/rev, then 1pulse is 0.188mm. If the actual processing length is 660mm→convert to 660/0.188=3501 pulse.
Slave axis length(machining axis length):
First consider that the slave axis servo parameter is 1000 pulse/rev and the mechanism parameter is 20mm/rev, then
1pulse=0.01mm can be obtained.
The actual measured slave shaft machining length is 40 mm → converted to 2000 Pulse.
The location of the synchronization zone;
The lower limit of the synchronization zone is when the actual START0 signal is triggered, the slave axis goes from 0 to the position
200 where it catches up with the spindle speed;
The upper limit of the synchronization zone is the position 500 where the processing time ends and the processing equipment also
leaves.
The speed ratio of master and slave axis in synchronization zone: the speed ratio of the master axis and slave axis in the
synchronization zone.
The speed ratio of master and slave axis when returning:
After the total length of the stroke subtracts the stroke of the following movement, the return stroke length can be obtained, and
then use the following stroke distance = return stroke distance to know the speed ratio when returning = 3.
3) Establish flying saw curve automatically by rotary saw curve
① Establish a positive area curve
Parameter 1: It needs to input the processing length of the spindle feeding shaft to be 660mm, which is converted to pulse
660*1000/60pi=3501 pulse; Since the chase shear needs to return to the origin after the machining is completed, the pulse of
Parameter 1: Need to input the processing length of the spindle feeding shaft to be 660mm, which is converted to pulse
660*1000/60pi=3501 pulse; Since the chase shear needs to return to the origin after the machining is completed, the pulse of
the spindle =3501/2 =1750 pulse;
Parameter 2: Reverse running size is -2000;
Parameter 3: Same;
Parameter 4: Same;
Parameter 5: Same;
Parameter 6: Low word setting 0: uniform acceleration;
High word setting H8000: LeftCam continues the existing table data.
4) Generate tables with the function of flying saw
Parameter 1: Need to input the processing length of the spindle feeding shaft to be 660mm, which is converted to pulse
660*1000/60pi=3501 pulse;
Parameter 2: Slave shaft processing length is 40mm, conversion 40*1000/20=2000 pulse;
Parameter 3: Slave axis synchronization length setting agrees that 1/3 of the slave axis circumference is 2000/3=667 pulse;
Parameter 4:
Spindle length
Slave length
Slave synchronization length
Acceleration curve
CAM curve solution resolution
Set as rotary saw curve
Curve generation
instruction
Then set the starting address of the parameter, check the ECam0 form in [Electronic Cam] when downloading, the system
will automatically fill in the data of the above form into the corresponding parameter address.
3) Specified key point parameters table
Address Instruction Set value Address Instruction Set value
S0 Curve generation result S0+19 Resolution of segment 2 0
S0+1 Error parameter location S0+20
Spindle position of segment 3 1700
S0+2 Total resolution 100 S0+21
S0+3 Number of key point 1-10 S0+22
Slave axis position of segment 3 2000
S0+4 S0+23
Initial position of slave axis ——
S0+5 S0+24 Curve type of segment 3 0
S0+6 Spindle position of segment 0 Reserved S0+25 Resolution of segment 3 0
S0+7 Slave axis position of segment 0 Reserved S0+26
Spindle position of segment 4 1900
S0+8 S0+27
Spindle position of segment 1 600
S0+9 S0+28
Slave axis position of segment 4 600
S0+10 S0+29
Slave axis position of segment 1 0
S0+11 S0+30 Curve type of segment 4 0
S0+12 Curve type of segment 1 0 S0+31 Resolution of segment 4 0
S0+13 Resolution of segment 1 0 S0+32
Spindle position of segment 5 2000
S0+14 S0+33
Spindle position of segment 2 1500
S0+15 S0+34
Slave axis position of segment 5 0
S0+16 S0+35
Slave axis position of segment 2 1200
S0+17 S0+36 Curve type of segment 5 0
S0+18 Curve type of segment 2 0 S0+37 Resolution of segment 5 0
5) If you do not need to fill in the data in the form, you can use the Circuit program to replace the form data:
Special address
Devices Content
SD881 (high byte), SD880 (low byte) Y000 Output pulse number. Decrease when reversed. (Use 32 bits)
SD941 (high byte), SD940 (low byte) Y001 Output pulse number. Decrease when reversed. (Use 32 bits)
SD1001 (high byte), SD1000 (low byte) Y002 Output pulse number. Decrease when reversed. (Use 32 bits)
SD1061 (high byte), SD1060 (low byte) Y003 output pulse number. Decrease when reversed. (Use 32 bits)
SD1121 (high byte), SD1120 (low byte) Y004 Output pulse number. Decrease when reversed. (Use 32 bits)
SD1181 (high byte), SD1180 (low byte) Y005 Output pulse number. Decrease when reversed. (Use 32 bits)
SD1241 (high byte), SD1240 (low byte) Y006 Number of output pulses. Decrease when reversed. (Use 32 bits)
SD1301 (high byte), SD1300 (low byte) Y007 Output pulse number. Decrease when reversed. (Use 32 bits)
Appendix
Rotary saw parameter table
Rotary saw curve parameter setting
Offset
Parameter Name Format Instruction
address
Address 0
Parameter 1 Spindle length 32-bit integer The moving cut length of the feeding axis moving. Unit: pulse.
Address 1
Address 2 The circumference of the cutting axis (including the tool length).
Parameter 2 Slave length 32-bit integer
Address 3 Unit: pulse. Range [-2,000,000,000, 2,000,000,000]
The length of the slave axis synchronization zone is smaller than the
Address 4
slave axis length, generally set to 1/3 of the slave axis length. (When
Parameter 3 Slave sync length 32-bit integer the new S type rotary saw is selected, the value satisfies 40 *sync
Address 5 ratio<=sync length< slave axis length-2. ). Sync area range: 0<sync
area length<|slave axis length|
Calculation method one:
In the synchronization zone, the speed of the master axis and the
slave axis are equal, and the sync magnification calculation method:
V1(V2)=Master (slave) axis speed
Address 6 Slave axis sync F1(F2)=Master (slave) axis speed (Hz)
Parameter 4 Floating
magnification D1(D2)=Master (slave) axis diameter
R1 (R2) = master (slave) axis pulse number per revolution
Calculation method two:
Slave axis sync magnification=the number of pulses required by
Address 7
1mm slave axis/the number of pulses required by 1mm spindle
Address 8 Slave axis maximum Maximum magnification = maximum speed of slave axis/maximum
Parameter 5 Floating
Address 9 magnification limit speed of spindle
Address 14 After the curve is generated correctly, the calculated start position
Synchronization zone
Parameter 9 of the spindle synchronization area could be used to set the lower
Address 15 start position 32-bit integer
limit of the synchronization area.
Address 16 After the curve is correctly generated, the calculated end position of
Parameter End of
the spindle synchronization area could be used to set the lower limit
10 Address 17 synchronization zone 32-bit integer
of the synchronization area.
It is valid only when parameter 6 acceleration curve is set to 4.
Address 18 Slave axis minimum
Parameter Make sure that the actual maximum speed of the slave axis cannot
limit operation Floating
11 be less than this value magnification corresponds to the speed so as
Address 19 magnification
to adjust the slope of the deceleration section.
The maximum The maximum magnification of the actual operation of slave axis:
Address 20
Parameter magnification of the It is sync magnification when it is long material, and it is between
Floating
11 actual operation of sync magnification and maximum limit magnification when it is
Address 21
slave axis short material.
Slave axis
Parameter 4 synchronization Floating
among them
magnification
V1(V2)=Master (slave) axis speed
F1(F2)=Master (slave) axis speed (Hz)
D1(D2)=Master (slave) axis diameter
Address 7
R1 (R2) = master (slave) axis pulse number per revolution
Calculation method two:
Slave axis synchronization magnification=1mm The number of pulses
required by the slave axis/1mm The number of pulses required by the
spindle
Address 8 Slave axis maximum Maximum magnification = maximum speed of slave axis/maximum
Parameter 5 Floating
Address 9 magnification limit speed of main axis
Address 14 After the curve is generated correctly, the calculated starting position
Synchronization zone 32-bit
Parameter 8 of the spindle synchronization area can be used to set the lower limit
Address 15 start position integer
of the synchronization area.
Address 16 After the curve is correctly generated, the calculated end position of
End of 32-bit
Parameter 9 the spindle synchronization area can be used to set the lower limit of
Address 17 synchronization zone integer
the synchronization area.
The maximum The maximum magnification of the actual operation of slave axis:
Address 20
magnification of the It is sync magnification when it is long material, and it is between sync
Parameter 11 Floating
actual operation of magnification and maximum limit magnification when it is short
Address 21
slave axis material.
Address 4
Parameter 3 Reserved Retained Reserved 2 to 32767
Address 5
Parameter 4 Address 6 Accelerated time 16-bit integer Pulse acceleration time ms 2 to 32767
Parameter 5 Address 7 Deceleration time 16-bit integer Pulse deceleration time ms 50 to 511
Parameter 6 Address 8 Resolution 16-bit integer Pulse resolution Length 51 to 512
Parameter 7 Address 9 Reserved Reserved Reserved
Address 10 Number of pulses of Number of pulses of spindle in the last
Parameter 8 32-bit integer Pulse
Address 11 spindle in the last segment segment (high and low)
Address 12 Number of pulses of slave Number of pulses of slave axis in the last
Parameter 9 32-bit integer Pulse
Address 13 axis in the last segment segment(high and low)
S0+4
Start position of slave axis Double word Set the start offset position of slave axis Reserved
S0+5
S0+6 Spindle segment 0 Single word
The master/slave axis of segment 0 is always 0 Reserved
S0+7 Slave axis segment 0 Single word
S0+8
Spindle segment 1 Double word The number of pulse of spindle segment 1 32-bit integer
S0+9
S0+10
Slave axis segment 1 Double word The number of pulse of slave axis segment 1 32-bit integer
Key S0+11
10 Communication instruction
10.1 Communication port protocol setting
PROTOCOL/communication port protocol setting
PROTOCOL(P)
Set (s) protocol for (n) communication port.
-[PROTOCOL (s) (n)]
Content, range and data type
Data type
Parameter Content Range Data type
(label)
(s) Protocol number to be set - Unsigned BIN 16 bit ANY16
(n) Which communication port to set, 0 means COM1, 1 means COM2 *1 0, 1 Unsigned BIN 16 bit ANY16
Device used
Offset Pulse
Devices
modification extension
Instruction Parameter
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ●●●●● ●● ● ●
PROTOCOL
Parameter 2 ● ● ● ●●●●● ●● ● ●
Features
This instruction is mainly used to set the protocol during run, and can also be used in the first cycle of run.
The value of the protocol address (COM1 SD2542, COM2 SD2592) and the protocol modification flag (COM1 SD2543, COM2 SD2593)
can be directly set according to the command parameters.
The specific calculation formula for setting the protocol modification flag (COM1 SD2543, COM2 SD2593) is: (parameter setting value
+ offset of the corresponding serial port's initial special soft component + 10)*2
For example, setting the protocol to 2 is (2 +2593-2590 +10)*2, which is (2+3+10) *2=30. At this time, SD2592 will be set to 1, and
SD2593 will be set to 32.
✎Note: Whether it is by self-calculation and then modifying the setting value of the identifier (COM1 SD2543, COM2 SD2593) to the
protocol, or using this instruction to set, it is possible to modify the protocol when the PLC is in the RUN state.
Regarding the protocol modification flags (COM1 SD2543, COM2 SD2593): During the RUN process, the first cycle of setting the
protocol and modifying the flags is correct (judging at END) to the correct first cycle. When the modification is completed, the
protocol modification flags (COM1 SD2543, COM2 SD2593) is cleared, and then set the same value will not be processed. Mainly to
avoid repeated settings multiple times.
Agreement Number
Agreement Number Content
0H Wecon Modbus slave
2H ModbusRTU slave
3H ModbusASCII slave
10 H User-defined protocol
20 H ModbusRTU master station
30 H ModbusASCII master
4085H The read address of (s) and (n) exceeds the device range
4084H (n) is not 1
Example
Example above
M1 changes from OFF to ON during the run
SD2592 will be set to 32 (20H), SD2593 will be set to 90 and then it will be cleared. At this time, it means that the setting is
successful.
Example above
M1 changes from OFF->ON during run
SD2540 will be set to 129 (H81, baud rate: 9600, stop bit: 1, data bit: 8, parity bit: none), SD2541 will be set to 280 and then cleared.
At this time it has been set successfully
●The value of the station number address (COM1 SD2544, COM2 SD2594) and the station number modification flag (COM1 SD2545,
COM2 SD2595) can be directly set according to the command parameters.
●The specific calculation formula for setting the station number modification flag (COM1 SD2545, COM2 SD2595) is: (parameter
setting value + offset of the corresponding serial port's initial special device + 10)*2
●For example, setting the COM2 station number to 1 is (1 +2595-2590 +10)*2, which is (1 +5+10) *2=32. At this time, SD2594 will be
set to 1, and SD2595 will be set to 32.
✎Note: Whether it is by self-calculation and then modifying the ID (COM1 SD2545, COM2 SD2595) setting value to the station
number, or setting with this instruction, the station number can be modified when the PLC is in the RUN state.
●Regarding station number modification identification (COM1 SD2545, COM2 SD2595): During RUN, when the station number is set
and the modification identification is correct (judgment at END) to the correct first cycle, the station number will be modified when
the modification is completed (COM1 SD2545, COM2 SD2595) are cleared, and then set the same value will not be processed. Mainly
to avoid repeated settings multiple times.
Related software components
Devices Content
Example above
M1 changes from OFF->ON during run
SD2594 will be set to 2, SD2595 will be set to 34 and then it will be cleared. At this time it has been set successfully
B4、B5、B6、
Bit number B0 B1、B2 B3 B10 B11
B7、B8、B9
Data Stop
Name Parity Baud rate(bps) STX ETX
length Bit
9600 001000
0 19200 001001
7-bit 1-bit None None
off
38400 001010
b2, b1
57600 001011
(0,0): None
Content 115200 001100
(0,1): Odd parity (ODD)
187500 001101 Turn on STX, the Turn on ETX, the
1 (1,1): Even parity (EVEN)
8-bit 2-bit 230400 001110 STX value is set ETX value is set
on
460800 001111 in SD2600 in SD2601
921600 010000
Example
When M1 is ON, the sending and receiving data of communication after executing instruction is stored as the following figure.
Some configuration and preparation of serial communication are needed for actual programming to communicate as expected, such
as setting the transceiver mode of serial port, baud rate, number of bits, parity, software protocol settings, timeout judgment
conditions, and data preparation for the transceiver buffer, send and receive flag processing, etc.,
A relatively complete RS communication setup program is shown as follows:
Serial port parameters settings:
Baud rate 112500, stop bit 1, data bit 8, parity bit none
Set the protocol as a custom protocol
Sending interval: 5ms
Receiving timeout: 100ms
Number of repetitions: 3 times
Timeout between characters: 30ms
Custom protocol, send start address D200, sending length 8,
receive start address D300, receiving length 8,
Receive start address D300 Receive length 6
Send directly after trigger
Parameter Content
(s) The high byte stores the station number of slave station, and the low byte stores the function code of Modbus
(m) Slave address. The address provided by the slave station will read or write data from this address of the slave station
(d) Length, the length of Modbus read or write. The unit is determined by the function code.
(n) Start address for reading or writing data
9600 001000
0 19200 001001
7-bit 1-bit None None
off
38400 001010
b2, b1
57600 001011
(0,0): none
Content 115200 001100 Turn on STX, the Turn on ETX, the
(0,1): odd parity (ODD)
187500 001101 STX value is set in ETX value is set in
1 (1,1): even parity (EVEN)
8-bit 2-bit 230400 001110 the device of the the device of the
on
460800 001111 corresponding corresponding
communication communication
921600 010000
Example
When M1 is ON, the sending and receiving data of communication after executing instruction is stored as the following figure.
Some configuration and preparation of serial communication are needed for actual programming to communicate as expected, such
as setting the transceiver mode of serial port, baud rate, number of bits, parity, software protocol settings, timeout judgment
conditions, and data preparation for the transceiver buffer, send and receive flag processing, etc.,
A relatively complete RS communication setup program is shown as follows:
For detailed custom protocol instructions, please refer to "10.7.1 Custom protocol description"
(2) Modbus protocol
When the protocol is set to Modbus master protocol (whether it is RTU or ASCII). When the contact before RS2 instruction is turned
ON, the RS2 instruction will send the combined data frame according to the station number function code (s), slave station address
(m), length (d) and judge whether the data of (n) is needed according to the function code.
Parameter Content
(s) The high byte stores the station number of slave station, and the low byte stores function code of Modbus
(m) Slave address. The address provided by the slave station will read or write data from this address of the slave station
(d) Length. The length of Modbus read or write. The unit is determined by function code.
(n) The start address of the data to be read or written
(n1) Specify the communicatiom port
COM1 data reception error. There may be interference on the communication line, it is recommended to connect
3080H
the ground wire.
COM1 data reception timed out. "Check the wiring, check whether the serial port parameter settings are compatible
3081H with master and slave, check whether there is interference. Check whether the slave station is too late to respond.
For this reason, you can try to increase “the sending interval".
COM1 CRC check error. There may be interference on the communication line, it is recommended to connect the
3082H
ground wire.
COM1 LRC check error. There may be interference on the communication line, it is recommended to connect the
3083H
ground wire.
The COM1 station number is incorrectly configured. Check the slave station number setting, and check whether
3084H
there is any problem with the receiving and sending mechanism of slave station.
3085H COM1 send buffer overflow. Contact a technician if this error occurs
3086H COM1 function code is wrong. Check whether the set function code is a function code supported by PLC
3087H COM1 address is wrong. Check whether the slave station has this address (please refer to Modbus Abnormal 02)
3088H The length of COM1 is wrong. Check whether the communication length exceeds the length range specified by the
Modbus protocol, or whether it exceeds the specified length range of the custom protocol.
3089H COM1 data error. "Check whether there are errors in the parameters of the instruction. Check whether the slave
station supports the setting of this value. (Please refer to Modbus Abnormal 03)"
308AH COM1 slave station is busy. Slave station returns information: Slave station is busy (please refer to Modbus exception
06)
308BH COM1 slave station does not support function codes. Check whether the slave station supports this function code
(please refer to Modbus exception 01)
308CH COM1 slave station is faulty. Slave station returns information: Slave station is faulty, please check whether the slave
station is faulty (please refer to Modbus Abnormal 04)
308DH COM1 slave station confirmation. Slave station return information: slave station confirmation (please refer to
Modbus abnormal 05)
308EH COM1 current protocol does not support this instruction or function. The related conmunication instruction of
master station or the function of maste station cannot be used when it is set to slave station protocol, please change
Indicates that when X1 is ON, write the data in the PLC's D220 register to the buffer register (BFM) #24 in the #1 (second) special
module. When X1 is OFF, no operation is performed.
Currently LX5VPLC supports 16 special expansion modules at the same time.
The special devices used are as follows
Devices Content
SD2081 Total number of modules
SD2082 Number of IO expansion modules
SD2083 Number of special expansion modules
SD2084 The first missing expansion module. When the value is -1, it means not lost
When M1 is turned on
The values of D200 and D201 will be passed to BFM2 and BFM3 of module #0 (the first)
Indicates that when M1 is ON, write the data in the PLC's D200 and D201 registers to the buffer registers (BFM) #1 and #2 in the #0
(first) special module. When X1 is OFF, no operation is performed.
Currently LX5V PLC supports 16 special expansion modules at the same time.
The special devices used are as follows
Devices Content
When M1 is turned on
The values from D200 to D203 will be transferred to BFM1 to BFM4 of module #0 (first)
It means that when M1 is ON, the data in the buffer registers (BFM) #10 and #11 in the special module #0 (the first) will be written
into the D200 and D201 registers of the PLC. When M1 is OFF, no operation is performed.
Currently LX5V PLC supports 16 special expansion modules at the same time.
The special soft components used are as follows:
Devices Content
Error code
Error code Content
4085H (s1) (s2) (n) The read address exceeds the device range
4086H (d) The write address exceeds the device range
4084H (s1) (s2) is not in the range of 0 to 32767 or (n) is not in the range of 0 to 512
7080H Check error when communicating between PLC and module
7081H Expansion module communication message is abnormal
7082H FROM/TO instruction error
7083H The specified extension module was not found
Example
When M1 is turned on
The values of BFM3, BFM4, and BFM5 of the #0 (first) module will be transferred to D200, D201, D202
It means that when M1 is ON, the data in the buffer register (BFM) #10 to #13 in the special module #0 (the first) will be written to
the D200 to D203 registers of the PLC. When M1 is OFF, no operation is performed.
Currently LX5V PLC supports 16 special expansion modules at the same time.
The special soft components used are as follows:
Devices Content
4085H (s1) (s2) (n) The read address exceeds the device range
4086H (d) The write address exceeds the device range
4084H (s1) (s2) is not in the range of 0 to 32767 or (n) is not in the range of 0 to 256
7080H Check error when communicating between PLC and module
7081H Expansion module communication message is abnormal
7082H FROM/TO instruction error
7083H The specified extension module was not found
Example
When M1 is turned on
The value of BFM3 to BFM8 of module #0 (first) will be transferred to D200 to D205
(m) Is the length of the data to be sent (number of bytes) 0 to 528 Unsigned BIN 16 bit ANY16
(d) Start number of the device storing the written data - Unsigned BIN 16 bit ANY16
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●●●● ●●
Parameter 2 ●●●● ●●
RS
Parameter 3 ●●●● ●●
Parameter 4 ●●●● ●●
✎Note: Although the RS instruction currently allows all the parameters of the instruction to use constants such as K and H, there are
different restrictions according to the different protocol. When the protocol is a custom protocol, S and D cannot be constants,
otherwise it will report an error.
(2) Special device settings
Special address table
COM2 special D device (SD) COM2 special M Device (SM)
2590 Communication port setting 2590 Send control on
2591 Serial parameter modification identification 2591 Send control/send reminder
2592 Protocol settings 2592 Receive control on
2593 Protocol modification logo 2593 Accept control/receive prompt
2594 Station number setting 2594 8-bit mode (for custom protocol)
2595 Station number modification logo 2595
Sending interval (0.1ms) 0-32767
2596 2596
It is 10 (1ms) when set to 0
(1,1): Even parity (EVEN) 187500 1101 the ETX value the ETX value
1 on 8 bit 2 bit
230400 1110 is set in is set in
SD2600 SD2601
460800 1111
921600 10000
Set the serial port parameters to SD2590 according to the bit settings provided in the table above. The setting is roughly the same as
3V. It is mainly because the baud rate can be set to a higher baud rate, the bit used need backward two bits when STX and ETX start.
For example: To set the serial port parameters: baud rate 115200, stop bit 1, data bit 8, no parity bit, turn on STX, you need to set
the value H4C1 (K1217) on SD2590. The parameters directly set to SD2590 are only valid in the first cycle of PLC RUN.
If you need to modify it during RUN, you can use the PORTPARAM instruction to set it.
2) Protocol setting SD2592
Protocol settings Protocol settings
0H Wecon Modbus slave station 10 H Cunstom protocol
2H ModbusRTU slave station 20 H ModbusRTU master station
3H ModbusASCII slave station 30 H ModbusASCII master station
The corresponding protocol can be set by setting the corresponding value in SD2592.
The main function of communication timeout is: How long does it take to wait for no data to be received after the PLC sends retry or
occurs an error. When 0 is set, the default is 100ms.
The unit of communication timeout is 10ms, that is, the timeout judgment time is 10ms when the setting is 100.
When a receiving timeout occurs, it will determine whether there are retry times and the current retry times. If the retry times are
greater than or equal to SD2598, an error will be reported.
If SD2598 is set to 0, it will not try again.
If it is set to 1, send once again after sending a timeout.
5) Character interval timeout SD2599
Currently this setting is only available for custom protocols.
The main function of the character interval timeout is: after receiving at least one character before the communication timeout,
judge whether the interval time between the following two characters has exceeded. if it is, report an error and end the
communication.
This setting is mainly designed considering that some devices may send slow or have other specific sending requirements.
The character interval timeout will not retry.
(3) Serial port parameter setting instructions
1) Host computer interface settings
Through the PLC parameter setting in the upper computer interface, If protocol is set to none, it is a custom protocol.
The serial port parameter content mainly sets the serial port parameters such as baud rate and data bit.
After the start character is enabled, the start/end character can be sent. The start/end character will also be distinguished when
receiving. See the description in the sending and receiving process for details.
✎Note: The characters here are decimal values.
2) PORTPARA instruction
-[PORTPARA (s) (n)]
Content, range and data type
Data type
Parameter Content Range Data type
(label)
(s) Serial port parameters to be set 0 to 256 Unsigned BIN 16 bit ANY16
(n) Which communication port to set (0 means COM1, 1 means COM2) 0, 1 Unsigned BIN 16 bit ANY16
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ●●●● ● ●● ● ●
PROTPARA
Parameter 2 ● ● ● ●●●● ● ●● ● ●
Function: To set communication parameters when running.
Please refer to "PORTPARA instruction description" for details.
3) PROTOCOL instruction
-[PROTOCOL (s) (n)]
Content, range and data type
Data type
Parameter Content Range Data type
(label)
(s) Protocol number to be set 0 to 65535 Unsigned BIN 16 bit ANY16
Which communication port to set (0 means COM1, 1 means
(n) 1 Unsigned BIN 16 bit ANY16
COM2 *1)
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ●●●● ● ●● ●
PORTOCOL
Parameter 2 ● ● ● ●●●● ● ●● ●
The data sent in the case of the ladder program and the data above should be 70 E1 31 62 6C.
For example, the result of the above ladder program and the above data sending is FE 70 7D E1 00 31.
Sending FE 51 26 34 15 to the PLC at this time will receive the following data. And if you send FE 25 63 FE 51 26 34 15 you will also
receive the following data.
For example, the result of the above Circuit program and the above data transmission is 70 7D E1 00 31 FD.
If the above Circuit program sends 01 06 FD to him, the following data will be received. If the FD is sent directly, it will be judged as
the end directly.
4) Both the start character STX and the end character ETX are turned on
When both are opened, it is basically a combination of the above single opened states. But if only ETX data is received when both
start, it will not end immediately. It will judge the character interval time and does not start receiving data.
(2) Receiving after sending (similar to Modbus master station mechanism)
1) Send control switch (SM2590) and receive control switch (SM2592) OFF (default)
When the contact of RS instruction is on, turn SM2591 on and send it immediately. SM2591 will be automatically OFF immediately
after sending.
After sending, SM2593 is ON, it will always stop at this instruction, and wait for it to be OFF and then receive data. If it is OFF, it will
start to receive data.
After the first character timeout period (SD2597), if no character is received, it is judged as a timeout. If there are retry times, it will
retry. But after retrying, the communication still does not report an error, and SM2593 and SM2614 are turned on.
When the sending length is set to a value other than 0, and the receiving length is set to 0, it is send-only mode.
1) The sending control switch (SM2590) is OFF
When SM2591 is turned ON, the data will be sent without receiving.
When there are two or more instructions, the first RS instruction which is turned ON will be sent after SM2591 is turned ON. After
this RS instruction is completed, then turn ON SM2591 will switch to the next RS instruction in the ladder program.
2) The Sending control switch (SM2590) is ON
The RS instruction will be sent when triggered. Multiple instructions are triggered and sent in a loop. During the sending cycle, the
interval will be sent according to the set sending interval.
(4) Receive-only
When the sending length is 0 and the receiving length is not 0, it is only receiving.
1) SM2592 receiving control switch OFF
SM2593 will be turned ON when receiving, and the ladder program control must be turned OFF to continue receiving. SM2593 will
not turn ON without receiving data.
When multiple instructions are enabled to receive only at the same time, it will start to receive from the smallest number of steps in
the ladder diagram. Time out or received data will be forwarded to the second to continue receiving.
2) SM2592 receiving control switch ON
It can receive normally and will not be controlled by the flag bit. The SM2593 receiving identifier serves as the receiving prompt
identifier,and SM2593 will not turn ON without receiving data.
If multiple RS receive only instructions are turned on at the same time, the receiving position is uncertain due to the timeout
3 The instruction control of Mitsubishi is that the first instruction triggered is fixed to execute this instruction. It will not be
switched to other instructions midway, unless the contact of this instruction is closed.
Basic configuration
(1) Introduction
The RS instruction has the same usage as the previous RS instruction of 3V, and can use R device.
-[RS (s) (m) (d) (n)]
Content, range and data type
Parameter Content Range Data type Data type (label)
The high byte stores the station number of slave station, and
(s) - Unsigned BIN 16 bit ANY16
the low byte stores the Modbus function code.
Slave address. The address provided by slave station will read
(m) - Unsigned BIN 16 bit ANY16
or write data from this address of the slave station
Length. The length of Modbus read or write. The unit is
(d) - Unsigned BIN 16 bit ANY16
determined by function code.
(n) Start address for reading or writing data - Unsigned BIN 16 bit ANY16
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●●●● ●●
Parameter 2 ●●●● ●●
RS
Parameter 3 ●●●● ●●
Parameter 4 ●●●●
✎Note: Although the RS instruction currently allows all the parameters of the instruction to use constants such as K and H, there are
different restrictions according to the different protocols. When the protocol is Modbus master station protocol, n cannot be a
constant, otherwise an error will be reported.
(2) Special device setting
Special address table
COM 1 special D device (SD)
2540 Communication port settings
2541 Serial parameter modification identification
2542
2543
2544 Station number setting
2545 Station number modification logo
✎Note: COM1 does not support modifying the protocol.
COM2 special D device (SD) COM2 special M Device (SM)
2590 Communication port setting 2590 Send control start
2591 Serial parameter modification identifier 2591 Send control/send reminder
2592 Protocol setting 2592 Receive control start
2593 Protocol modification identifier 2593 Receive control/receive prompt
2594 Station number setting 2594 8-bit mode (for custom protocol)
2595 Station number modification identifier 2595
The main function of communication timeout is: How long does it take to wait for no data to be received and then retry or report an
error after the PLC sends. When it is set to 0, the default value is 100ms.
The unit of communication timeout is 10ms, that is, the timeout determine time is 100ms when set to 10.
When a receiving timeout occurs, it will determine whether there are retry times and the current retry times. If the retry times are
greater than or equal to SD2598, an error will be reported.
If SD2598 is set to 0, it will not retry.
If it is set to 1, send once and then send once again after timeout.
(3) Serial port parameter setting
1) PORTPARA instruction
-[PORTPARA (s) (n)]
Content, range and data type
Parameter Content Range Data type Data type (label)
The start number of the device that stores
(s1) - Signed BIN 16 bit ANY16_S_ARRAY
the number of digits of converted value
(s2) Converted BIN data -2147483648 to 2147483647 Signed BIN 32 bit ANY32_S
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ●●●● ● ●● ● ●
PORTPARA
Parameter 2 ● ● ● ●●●● ● ●● ● ●
Features
Set communication parameters when used for run. Please refer to "PORTPARA instruction description" for details.
2) PROTOCOL instruction
-[PROTOCOL (s) (n)]
Content, range and data type
Data type
Parameter Content Range Data type
(label)
(s) Protocol number to be set 0 to 65535 Unsigned BIN 16 bit ANY16
Which communication port to set (0 means COM1, 1 means
(n) 1 Unsigned BIN 16 bit ANY16
COM2 *1)
Bit address
Address type Occupy Address range Decimal address Total reserved address size
T0 to T511 512 bit 0x0000-0x01ff 1536
C0 to C255 256 bit 0x0600-0x06ff 1536 1024
LC0 to LC255 256 bit 0x0A00-0x0AFF 2560 1024
HSC0 to HSC15 16 bit 0x0E00-0x0E0F 3584 512
M0 to M8000 8000 bit 0x1000-0x2F3F 4096 16384
SM0 to SM4095 4096 bit 0x5000-0x5FFF 20480 12288
Reserved 0x8000-0xBFFF 16383
S0 to S4095 4096 bit 0xC000-0xCFFF 49152 8192
X0 to X1023 1024 bit 0xE000-0xE3FF 57344 4096
Y0 to Y1023 1024bit 0xF000-0xF3FF 61440 4096
Currently only one PLCLINK table can be created. Creating a new table after creating one is disallowed.
The devices of main station and slave station are selected by drop-down box.
The transfer direction are read and write, and also selected by drop-down box.
Click on PLCLINK in monitoring mode to re-write part of the table into PLC, but the start device could not be modified.
In monitoring mode, monitoring read and monitoring write could not be executed if the ladder program comparison is incorrect.
(3) Automatic check
Click “Check” in monitoring mode, the PLC that can communicate will be automatically searched and enabled. Stations that could not
communicate will be closed. The Stations without instructions will not be checked. The PLCLINK table will be updated after the
automatic check of the upper computer is finished.
Write 1 to in the table for addresses whose start address is offset 12 (for example, R200 is R212). The corresponding function is as
below.
0: No check; 1: Automatic check mode; 2: Automatic check in progress.
Auto check
When enabled, all the station numbers will send data to determine whether the station number exists.
S1+12 mode
The corresponding communication switch will be turned on if it exists. If not, the corresponding
(Reserved)
communication switch will be turned off.
No error will be reported during auto check after the auto check is enabled. After the check is complete, the corresponding station
number will be automatically enabled and disabled.
The switch control of station 1 to 15
Corresponding station Bit0: ON: Station number 0 (broadcast) normal communication
S1+13 number communication OFF: Station number 0 (broadcast) communication prohibited (broadcast prohibited)
switch 1 Bit1: ON: Station number 1 normal communication; OFF: Station 1 communication prohibited
Bit2: ON: Station number 2 normal communication; OFF: Station 2 communication prohibited
Corresponding station
S1+14 number communication The switch control of station 16 to 31
switch 2
Click [station number enable] to set the station enable according to the corresponding situations.
✎Note: When in the automatic check state, forcibly turn off the automatic check state (write 0 in S1+12), an error may occur.
(4) Main station parameter configuration
The protocol must be PLCLINK protocol, and the data bit can not be 7-bit data bit. Other parameters can be selected as required.
(5) Slave station configuration
For PLCLINK communication ports, select the dedicated protocol from the station protocol.
The settings of Baud rate, data bit, stop bit, parity bit must be consistent with main station. The parameters above are consistent if
not modified. The station number needs to be configured separately. The slave station number ranges from 1 to 31.
(6) Close PLCLINK
Open PLCLINK table, write the master station D10 to the slave station D10 device number 10, and read the slave station D10 to the
master station D20 device number 10.
Connect Com2 of master station PLC to COM1 of slave station, and set the slave station number to 1. After downloading, set the
value of main station D10 to 1 and D11 to 8192 . Then, D20 will change to 1 and and D21 will change to 8192.
11 Special instructions
PID/PID calculation
PID
This instruction is used to perform PID control that changes the output value according to the amount of input change.
-[PID (s1)(s2)(s3)(d)]
Content, range and data type
Parameter Content Range Data type Data type (label)
(s1) Device number for storing the target value (SV) -32767 to 32767 Signed BIN 16 bit ANY16
(s2) Device number for storing the measured value (PV) -32767 to 32767 Signed BIN 16 bit ANY16
(s3) Device number for storing parameters 1 to 32767 Signed BIN 16 bit ANY16
(d) Device number for storing output value (MV) -32767 to 32767 Signed BIN 16 bit ANY16
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●●●
Parameter 2 ●●●
PID
Parameter 3 ●●●
Parameter 4 ●●●
Features
This instruction is to complete the PID operation and is used to control the parameters of the closed-loop control system. PID control
has a wide range of applications in mechanical equipment, pneumatic equipment, constant pressure water supply and electronic
equipment, etc. among them:
is the target value of PID control;
is the measured feedback value;
The starting address of the buffer area for setting parameters required for PID operation and saving intermediate results,
occupies a total of 26 variable units in the subsequent addresses, the value range is D0 to D7974, it is best to specify the power
failure retention area, which will remain after the power is OFF Set the value, otherwise the buffer area needs to be assigned value
before starting the operation for the first time. The function and parameter description of each unit are described in this section;
is the storage unit of the PID calculation result. Please designate as a non-battery holding area, otherwise it needs to
be initialized and cleared before starting the calculation for the first time.
Programming example
+4 Integral gain (Ki) Setting range 0 to 32767, Ki=16384Ts/Ti, Ti is the integral time
+5 Differential gain (Kd) Setting range 0 to 32767, Kd≈Td/Ts, Td is the derivative time
+9 Reserved Reserved
︙ ︙ ︙
✎Note:
● When multiple instructions are used, the device number of (d) cannot be repeated.
● During the execution of auto-tuning, the (s3) parameter space cannot be modified.
● The instruction occupies 26 point devices from the device specified in (s3).
● PID instruction can be used multiple times in the program and can be executed at the same time, but the variable area used in each
PID instruction should not overlap; it can also be used in step instructions, jump instructions, timing interrupts, and subroutines, in
this case When executing the PID instruction, the (s3)+9 cache unit must be cleared in advance.
● The maximum error of the sampling time Ts is -(1 operation cycle +1ms) +(1 operation cycle). If the sampling time Ts ≤ 1 operation
cycle of the programmable controller, the following PID operation error (4D86H) will occur, and the PID operation will be executed
with TS = operation cycle. In this case, it is recommended to use constant scan mode or use PID instruction in timer interrupt.
When the device specified in the read application instructions (s1), (s2), (s3), (d) exceeds the range of the
4085H
corresponding device.
When the device specified in the write application instruction (s3) and (d) exceeds the range of the corresponding
4086H
device.
4D80H The sampling time is out of range. Ts 0
4D81H Input filter constant ( Co ) is out of range (. Co 0Or Co 1023 )
4D82H The maximum ascent rate ( T ) is out of range. T 0OrT 32000
4D83H The proportional gain (Kp) is out of range. Kp 0
4D84H The integral gain (Ki) is out of range. Ki 0
4D85H The differential gain (Kd) is out of range. Kd 0
4D86H The sampling time (Ts) is less than the operation cycle. Ts Scan cycle
Example
See manual.
d1 parameter setting
Parameter Offset address Name Format Instruction Range
d1
Parameter 1 em domain Floating point Temperature difference >0
d1+1
d1+2
Parameter 2 ecm domain Floating point Temperature difference >0
d1+3
d1+4
Parameter 3 kpm coefficient Floating point 0.5 (fixed) (not set) -
d1+5
d1+6
Parameter 4 kim coefficient Floating point 1 (fixed) (not set) -
d1+7
d1+8
Parameter 5 kdm coefficient Floating point 1 (fixed) (not set) -
d1+9
d2 parameter setting
Parameter Offset address Name Format Instruction Range
Parameter 1 d2 Current Temperature 16-bit integer Current test temperature -
Parameter 2 d2+1 set temperature 16-bit integer Set temperature -
Take an integer multiple of the pid
Parameter 3 d2+2 Calculation period 16-bit integer -
sampling time, usually the same
Parameter 4 d2+3 Kp 16-bit integer PID initial Kp value -
Parameter 5 d2+4 KI 16-bit integer PID initial Ki value -
Parameter 6 d2+5 KD 16-bit integer PID initial Kd value -
Parameter 7 d2+6 Sampling cycle 16-bit integer No need to enter -
Parameter 8 d2+7 Initialization flag 16-bit integer Reserved for internal use -
d2+8
Parameter 9 Last calculation time 32-bit integer View usage (not operable) -
d2+9
Parameter 10 d2+10 Last temperature 16-bit integer View usage (not operable) -
Parameter 11 d2+11 Reserved 16-bit integer Reserved
d3 parameter setting
Parameter Offset address Name format Instruction Range
Parameter 1 d3 Current Temperature 16-bit integer Current test temperature -
Parameter 2 d3+1 set temperature 16-bit integer Set temperature -
Take an integer multiple of the pid
Parameter 3 d3+2 Calculation period 16-bit integer -
sampling time, usually the same
Parameter 4 d3+3 Kp 16-bit integer Kp value of PID after adjustment -
Parameter 5 d3+4 KI 16-bit integer Ki value of PID after adjustment -
3. Invoke FPID
Name Features Bits (bits) Whether pulse type Instruction format Step count
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●● ●
Parameter 2 ●● ●
CCPID
Parameter 3 ●● ●
Parameter 4 ●● ●
Device used
is the target value (SV) of PID control;
is the measured feedback value (PV);
is the start address of the buffer area for setting parameters required for PID operation and saving intermediate results,
occupying a total of 52 variable units of subsequent addresses (recommended to reserve 100 continuous spaces).The value range is
D0 to D7,948, it is better to specify power failure retention, and the setting value remains after power supply is off. Otherwise,the
buffer needs to be assigned value before starting the calculation for the first time. The function and parameter description of each
unit are described in this section;
is the storage unit (MV) of the PID calculation result. Please specify it as a non-battery retentive area, otherwise it needs to be
initialized and cleared before the first start of calculation.
Programming example
The parameter description is as follows:
In D9, the target value of PID adjustment is stored, and D10 is the closed-loop feedback value. Note that D9 and D10 must be of the
same dimension, such as both 0.01MPa units, or 1℃ units, etc.;
A total of 52 units of D200 to D224 are used to store the set value and process value of PID operation. These values must be set item
by item before the first PID calculation;
D130 unit is used to store the calculated control output value to control the execution of the action.
The functions and setting methods of the parameter values of each unit used by are described in the following table:
to +14 is the parameter range that can be set (parameters set when CCPID is executed).
588 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
+15 to +21 is the space used internally by CCPID control.
+22 to +51 is the parameter space used in the auto-tuning process.
The first-order inertia filter of feedback When the value is greater than or equal to 100, it will be
+2 Filter coefficient
amount (0 to 100%) has a range of 0 to100 executed as 0, that is, no filtering will be executed;
Proportional
+3 Set range: 0 to 30,000[%] Overrun error 4D87H
gain(Kp)
Operating temperature setting enabled by It is recommended to be greater than 5°C, that is, 50
+6 Working interval PID (0 indicates no effect) The range is 0 to (precision 0.1°C). If it exceeds the range, the boundary
1,000 value will be taken.
1. Self-tuning initialization:
① Unidirection control: the lower limit is 0;
1. Self-tuning initialization:
① Unidirection control: If the upper limit is less than 0,
0: Overshoot allowed
0:Overshoot allowed (ukd = 100)
+9 Mode setting 1: Slight overshoot or no overshoot
1: Slight overshoot or no overshoot mode (ukd = 300)
2: Dynamic setting
+14 Filtering (C0) The range is 0 to 1,023, integral part filtering Overrun error 4D81H
+15
reserved for
┆ Internal control space occupation
internal control
+21
+22
used space for
┆ New self-tuning space for internal use
self-tuning
+51
1) The auto-tuning process occupies the space of S3+22 to S3+51. When the auto-tuning is successful, the adjusted
parameters will be written into the space of S3+2 to S3+21.
2) +2 filter coefficient α: Processing in first-order inertial filter
Formula: Tnow=(100-α)×Tα+α×Told
4) +9 working mode:
0: Working mode that allows overshoot
1: Slight overshoot or no overshoot working mode
2: Custom settings; to achieve by setting +10, +11, +12 three coefficients.
5) +1 bit2 self-tuning transition zone switch: (upper limit 1℃, low limit 0.5℃)
The transition zone description in forward control:
In the heating process, when PV≤SV+1℃, 100% power output; when PV>SV+1℃, no output.
In the cooling process, when PV<SV-0.5℃, 100% power output; When PV≥SV-0.5℃, no output.
The transition zone description in reverse control:
In the heating process, when PV≤SV+1℃, 100% power heating output; when PV>SV+1℃, 100% power cooling output.
In the cooling process, when PV<SV-0.5℃, 100% power heating output. When PV≥SV-0.5℃, 100% power cooling output
Programming case
CCPID application configuration
(1) Parameter setting
✎Note:
1. CCPID is a special instruction for operation control. CCPID operation will be executed only after the sample time is reached.
2. There is no limit to the number of times the CCPID instruction can be used, but+51 cannot be repeated.
3. Before CCPID instruction is executed, CCPID parameters need to be set.
Case analysis
(1) Control requirements
The control environment of this example is a kettle. The configuration is controlled by PLC-5V2416 host with 4PT module, and PI8070
screen is used for data storage and process curve viewing.
(2) Sample program
Figure 4 Process curve without different working interval parameters (heating process diagram)
It can be seen from the partially enlarged graph that the parameters of the working interval have a certain influence on the
overshoot and the stable time. In the case of allowing overshoot, setting the working interval parameters can make the overshoot
smaller. This is because the deviation E of PID starting to work is relatively small, and the integration accumulation will not quickly
saturate.
3) Result of filter coefficient setting
Sampling time (TS) Range: 1 to 32767 (ms). It must be longer than PLC program scan cycle.
12 String instructions
LEN/string length detection
LEN(P)
After detecting the length of the character string specified in (s), store it after the device number specified in (d).
The data from the device number designated in (s) to the device number of 00H is treated as a character string.
-[LEN (s) (d)]
Content, range and data type
Parameter Content Range Data type Data type (label)
(s) String or start number of the device storing the string - String ANYSTRING_SINGLE
(d) Store the device number of the detected character string length - Signed BIN 16 bit ANY16
Device used
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ● ●●●● ● ● ●
LEN
Parameter 2 ● ● ● ●●●● ● ● ●
Features
After detecting the length of the character string specified in (s), store it after the device number specified in (d).
The data from the device number specified in (s) to the stored device number of 00H is treated as a character string.
Error code
Error code Content
4085H (s) The read address exceeds the device range
408AH (s) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
408BH (s) When reading a character string, the maximum range of the device is read, but 00H is not found and the end
4086H (d) When using offset, the offset address exceeds the device range
Example
The character string specified in (s) is the data from the specified device to the position where "00H" is first detected in byte units.
(n)=7:
The final NULL code (00H) representing the character string will be automatically appended to the end of the character string data.
If the number of extracted characters is an odd number, "00H" is stored in the upper byte of the device storing the final character. If
the number of extracted characters is an even number, "0000H" is stored in the device after the device storing the final character.
605 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
When the number of characters specified in (n) is 0, the NULL code (00H) is stored in (d).
✎Note:
When handling character codes other than ASCII codes, pay attention to the following points.
✎The number of characters is handled in byte units (8 bits). Therefore, like the shifted JIS code, the character code of 1 character is
represented by 2 bytes, and the number of characters of 1 character is "2".
✎When extracting a character string from a character string containing a character code representing one character in 2 bytes, such
as the shift JIS code, the number of characters to be extracted should be considered in the unit of the character code of one character.
If only 1 byte of the 2-byte character code is extracted, it will not be the expected character code, so be careful.
Error code
Error code Content
4085H (s) The read address exceeds the device range
408AH (s) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
408BH (s) When reading a character string, the maximum range of the device is read, but 00H is not found and the end
4084H (n)<1 or (n)> string length
4086H (d) The write address exceeds the device range
Example
From the "a b c d e f" starting from D0, take out 5 characters from the left to the R0 type. The character string of R0 is "a b c d e".
Parameter 3 ● ● ● ●●● ● ● ●●
Features
For the string data stored after the device number specified in (s), the data of (n) characters starting from the right side of the string
(the end of the string) is stored in the device number specified in (d) after.
The character string specified in (s) is the data from the specified device to the position where "00H" is first detected in byte units.
(N)=5:
Get 3 characters “890” from the right in the string "1234567890" and store them in R0
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ● ● ● ● ●●●● ● ● ●
MIDR Parameter 2 ● ● ● ●●●● ● ● ●
Parameter 3 ● ● ● ● ●●●● ● ● ●
Features
For the character string data stored after the device number specified in (s1), the data of the character specified in (s2)+1 starting
from the specified position in (s2) is stored to the device number specified in (d) and later .
Get three characters "234" from the second character of the string "123456" into R0.
Even if the device range (s) to (s)+n storing the transferred character string data overlaps with the device range (d) to (d)+n storing
the transferred character string data, it will be normal To process. For example, when the character string stored in D10 to D13 is
transferred to D11 to D14, the situation is as follows.
MIDW Parameter 2 ● ● ● ●● ● ● ● ● ●
Parameter 3 ● ● ● ● ●● ● ● ● ● ●
Features
For the string data stored after the device number specified in (s1), the data of the character specified in (s2)+1 is stored in the string
data stored after the device number specified in (d) After the position specified in (s2).
The character string specified in (s1) or (d) is the data from the specified device to the position where "00H" is first detected in
byte units.
The final NULL code (00H) representing the character string will be automatically appended to the end of the character string
When the number of characters specified in (s2)+1 is -1, the data up to the final character data specified in (s1) is stored in the device
specified in (d) and later.
✎Note:
When handling character codes other than ASCII codes, pay attention to the following points.
Replace the three-character-length characters starting with the second character in the character string "q w e r y" stored in R0 with
the first three characters in D20.
The result of R0 is "q123y".
STR Parameter 2 ● ● ● ● ●● ● ● ● ● ● ● ●
Parameter 3 ●● ● ● ● ● ●
Features
The BIN 16-bit data specified in (s2) is converted into a character string after a decimal point is added to the position specified in (s1),
and stored in the device number specified in (d) or later.
After M8 is turned ON, according to the setting of all digits, 6 decimal places and 0 digits, it is converted into a character string
"12345" (with a space before 1)
xample
$+ Parameter 2 ● ● ● ● ●● ● ● ● ● ●
Parameter 3 ● ● ● ●● ● ● ● ● ●
Features
Connect the string data stored after the device number specified in (s2) to the string data stored after the device number specified in
(s1), and store it after the device number specified in (d).
The character strings of (s1) and (s2) start with the specified device number until the device number of 00H is stored.
When merging character strings, 00H indicating the end of the character string specified in (s1) is ignored, and the character string
specified in (s2) is connected at the final character of (s1).
If the character string is merged, 00H will be automatically appended at the end. If the number of characters after connection is an
odd number, 00H is stored in the upper byte of the device that stores the final character, and if the number of characters after
connection is an even number, the device after the device that stores the final character is stored 0000H will be stored.
Error code
Error code Content
Example
The result of combining the string "12345" and the string "abcde" is "12345abcde"
4085H (s1), (s2), (s3) The read address exceeds the device range
408AH (s1), (s2) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
408BH (s1), (s2) When reading a character string, the maximum range of the device is read, but 00H is not found.
4086H (d) The write address exceeds the device range
4084H (s3) <0 or (s3)>=string length
Example
Search for the string "ef" in the continuous string "abcdefg" from the first to the fifth position.
4085H The output result of reading application instruction(s) exceeds the device range
4086H (D) The output result exceeds the device range in writing application instructions
Example
1. Procedure
If the special register SM161 is set to ON, each ASCII character occupies a 16-bit variable after conversion, as shown in the figure
below, the high byte of each variable is filled with 0 (hexadecimal):
D• S
High 8 bits Low 8 bits String
00 41 A
+1 00 42 B
+2 00 43 C
+3 00 44 D
+4 00 45 E
+5 00 46 F
+6 00 47 G
+7 00 48 H
Each state has three functions of drive processing on the load, specifying the transition target, and specifying its transition conditions.
As shown below, execute the drive processing on the load first, and then execute the sequential execution of the transfer processing.
In the state without load, no drive processing is required
✎Note:The pointer P could be set to the first instruction in STL without contacts, so the first instruction is regarded as irrelevant to
the STL action below.
Device used
Device Name Content
SM240 Transfer prohibited If SM240 is set ON, all the transfers between the states are prohibited.
SM246 STL operation If SM247 and stepping relay ( device S ) are both ON, SM246 will be ON automatically.
If SM247 is set to ON, the number of stepping relay in operating in stepping relay
SM247 STL valid monitoring
would be stored in SD240 to SD247 from least to most.
The number of the stepping relay to be ON is stored in SD240 to SD247 (up to 8)from
SD240 to SD247 ON stepping relay number
least to most.
✎Note:
Stepping relay(S) without setting lock is cleared by turning the power ON to OFF and RUN to STOP. If the power is turned ON to OFF
and RUN to STOP while the status is valid, the process cannot be restarted from the middle.
Error code
No errors.
Program
Open M2, state relay S1is set to ON, the programs in STL S1
are executed normally.
All the output ON condition When not executing all the output resets (user program)
SM245
reset prohibited OFF condition When executing all the output resets (user program)
ON condition When STL monitoring valid is ON and any of the stepping relay(device S) is ON
SM246 STL state ON When STL monitoring valid is OFF, or when STL monitoring valid is ON and all the
OFF condition
stepping relays(device S) are ON
Occupied as initialization state When the step relay (S device) is selected as the initialization
ON condition
state.
✎S0 to S2 are used for individual
S0 to S9
run, origin reset and automatic run.
OFF condition When the step relay (S device) is not selected
✎S3 to S9 could be used freely.
ON condition When the step relay (S device) is selected as the origin reset.
S10 to S19 Occupied as origin reset
OFF condition When the step relay (S device) is not selected
8) When origin reset completion(SM243) is not ON, if switching between individual run(X20), origin reset(X21) and automatic
run(X22,X23,X24), then all the output would be OFF. Automatic operation could be restarted after origin reset completion.
✎Note:
1 Mode selection switches don’t need to be all used. Unused switches should be set to empty (cannot be used for other
purposes). It is necessary to write the program of the IST instruction before a series of STL loops such as states S0 to S2.
2 S10 to S19 should be used for the state of the origin reset operation. In the final state of the origin reset operation,
self-reset should be performed after SM243 is set
3 Only one IST instruction can be written in the program.
(2) IST instruction equivalent loop
1) The details of the special relay (SM) and initialization state (S0 to S9) that are automatically controlled by the IST instruction are
shown in the following equivalent circuit. (Please read it as a reference.) This equivalent circuit could not be
programmed.
2) If the mode is switched between each, origin reset and automatic, when the machine is outside the origin position, all the
outputs (output (Y) not driven by state and output (Y) driven by status by OUT and SET instructions) and the old state are reset
633 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
in batches. The SM245 drive does not reset all outputs
Stepping Each time the start button is pressed, it advances one process.
If the start button is pressed at the origin, it will stop at the origin after executing one cycle of automatic
operation.
Cycle once
Automatic If the stop button is pressed in the middle, the process will be stopped, and if the start button is pressed
again, the operation will continue from there, and then automatically stop at the origin.
If the start button is pressed at the origin position, continuous repeated run starts. If the stop button is
Continuous run
pressed, the run will stop after reaching the origin.
1) To use IST instructions, mode inputs need to be assigned consecutive number inputs as shown below. When the numbers are
not consecutive or a part of the mode is omitted, use the auxiliary relay to change the arrangement as shown in the figure
below, and use it as the start input for mode specification.
Input device X20 X21 X22 X23 X24 X25 X26 X27
Assignment Individual run Origin reset Stepping Cycle run once Continuous run Origin reset start Automatic start Stop
2) The special relay (SM) used in the IST instruction has different classifications. One is that the instruction itself is automatically
controlled according to the situation and the other needs to be controlled by the program according to the preparation for
operation and the purpose of control.
Special relay Content Remark
Once the special relay is in operation, all the state transfers are prohibited.
Individual: SM240 continues operating.
Origin reset and cycle once: After pressing the stop button, the operation is held until the
start button is pressed.
SM240
Stepping: SM240 continues operating, but only when the start button is pressed, it does
(Transfer prohibited)
not operate and the transfer is executed.
When switching STOP to RUN, the operation of programmable controller is held, and
unlocked when the start button is pressed. Even when the transfer state is prohibited, the
IST
output in the state continues the origin operation.
instructions
An auxiliary relay as a transition condition from the initialization state S2 to the next state.
execute
Individual and origin reset: No operation.
SM241 automatic
Stepping and cycle once: Only operates when the start button is pressed.
(Start transfer) control
Continuous: The operation is held when the start button is pressed, and unlocked after
pressing the stop button.
SM242(Start pulse) Only operates at the moment of pressing the start button.
After using the IST instruction, set SM247 to ON.When SM247 turns ON, the STL
monitoring becomes valid, and the status numbers (S0 to S899) in operation are stored in
SM247
the special registers SD240 to SD247 in ascending order.
(STL monitoring valid)
Therefore, a maximum of eight operation states number can be monitored
Besides, if any of there states is in operation, special relay SM246 also operates.
SM243 In origin reset mode, when the machine returns to the origin, operates the special relay
(Origin reset completion) (SM) with the user program.
Driven by
SM244 The special relay should be driven after detecting the origin condition of the machine. It is
sequential
(Origin condition) valid signal in all the modes.
control
SM245 If switching between individual run, origin reset and automatic mode, when the machine
program
(All the output reset is not in the origin, reset all the outputs and operation states. But if SM245 is driven first,
prohibited) then only the operation state is reset.
Program
3) When the machine is running, it could switch freely in "Automatic" mode (stepping/cycle once/continuous). In this case, to be
safe, the switched mode becomes effective only after all outputs are reset once.(When SM245 (all the output reset prohibited)
is set to ON, it will not be reset)
5) No programming is required if there is no origin reset mode. But before automatic run, You need to reset the origin first to
complete the SM243 set once
Error code
Error code Content
When the device number specified by (d1) and (d2) is in the following case. (d1)>(d2)
4085H
When the device specified in (s) couldn’t reserve eight points.
14 Ethernet communication
14.1 Ethernet overview
IP address
IP address consists of network address and host address, and distinguished by subnet mask. If programming device (such as PC) use
network card to connect to LAN, the programming device and PLC must be in the same subnet. You can specify the subnet of a device
by combining an IP address with a subnet mask.
The network address could be calculated by performing logic and operation between IP address and subnet mask. If the addresses
are in the same network, it means that communication is possible.
Network device 1 Network device 2 Network
Number
IP Subnet mask Network address IP Subnet mask Network address connection
2) Input “ping 192.168.8.8 ”, and enter. If it display ”0% loss”, it means that it could be connected to PLC.
3) The command “ping network device IP” could only be use four times. To ping network devices continuously, run “ping network
device ip-t” command, it is shown as below.
(1) The search interface is as below. Click search to display the PLC devices in the LAN, and select the corresponding device and
click OK to communicate.
When LX5V-N series PLC is powered on, ModbusTCP server monitor is automatically enabled by default. 2 to 8 ModbusTCP clients
are supported, and the port number is 502. (PLC host computer upload and download, monitor and HMI communication protocol are
supported by the ModbusTCP server.)
The number of configurable links is 6. The free configurations of TCP server free protocol, TCP client free protocol, ModbusTCP server
and ModbusTCP client are supported.
Communicaition protocol Maximum links supported
ModbusTCP server 8
ModbusTCP client 6
Free TCP server 6
Free TCP client 6
IP address settings
(1) Set by programming software.
Project manager → Parameter → PLC parameters → Ethernet configuration. Download selected parameters through PLC after
modification. The download takes effect after STOP->RUN is complete.
✎Note: The maximum link supported of ModbusTCP servers is used to set the maximum number of external ModbusTCP clients that
could connect to PLC simultaneously. The range is from 2 to 8.
TCP protocol
TCP protocol, short for Transport Control Protocol, is Is a connection-oriented and reliable transport layer protocol.
Connection-oriented means that a normal TCP transmission need to be completed by establishing a specific virtual circuit connection
between TCP client and TCP server. To transfer data over TCP, a connection must be established between hosts at both ends.
UDP protocol
UDP protocol, short for User Datagram Protocol, is a connectionless transport layer protocol. There is no guarantee of data order, a
risk of data loss. It provides a simple and unreliable information transfer service for transactions and is Mainly used in data
broadcasting.
Socket
When the application layer communicates data over the transport layer, TCP encounters the problem of providing concurrent
services to multiple application processes at the same time. Multiple TCP connections or multiple application processes may require
data to be transmitted over the same TCP protocol port. To distinguish between different application processes and connections,
many computer operating systems provide interfaces called sockets for applications to interact with the TCP/IP protocol.
To generate a socket, there are three main parameters: the IP address of the destination of the communication, the transport layer
protocol used (TCP or UDP) used, and the port number used. By combining these three parameters and binding to a socket, the
application layer and the transport layer can distinguish communication from different application processes or network connections
through the socket interface, realizing concurrent services for data transmission.
In order to simplify the complexity of ladder programming, sockets have been partially simplified:
For TCP clients, merge socket() and connect() into SOCOOPEN instructions. After this function is enabled, automatically connect to
the TCP server.
For TCP server, merge socket(), bind(), listen(), and accept() into SOCOOPEN instructions. After this function is enabled, automatically
listen to server connection. If the server is successfully connected, the corresponding position is marked and the IP address and port
information of the server are displayed.
For UDP, there is no concept of client and server. Creating a UDP socket only requires local address information and remote address
information, without connection operations. Communication could be made when the address information of the local socket and
the remote socket could be matched, that is, the remote address of the local socket is the same as the local address of the remote
socket, and the local address of the local socket is the same as the remote address of the remote socket. For UDP connections, the
connection could be established immediately by calling the SOCOPEN instruction.
Socket ID: The number of the socket ranges from K0 to K5, and a total of six are supported. The socket is used to specify links, and
each ID could be used for one link and could not be defined repeatedly.
Communication protocol: TCP protocol and UDP protocol are supported.
5086H The specified (d) is not configured socket or the socket is not enabled.
5089H 502 port could not be used on the TCP server because the 502 port is enabled by default.
Offset Pulse
Devices
Instruction Parameter modification extension
X Y M S SM T(bit) C(bit) LC(bit) HSC(bit) D.b KnX KnY KnM KnS T C D R SD LC HSC K H E [D] XXP
Parameter 1 ●●
Parameter 2 ●●●● ● ●●
SOCMTCP Parameter 3 ●●●● ● ●●
Parameter 4 ●●●● ● ●●
Parameter 5 ●●●● ●
Features
✎(s1) specify the socket link. The other parameters are compatible with RS instruction Modbus master protocol.
✎(s2) high byte is station number. For ModbusTCP, the station number could be set at will.
✎(s2) low byte is function code. For details, refer to 10.7.2 Modbus protocol description.
✎(s3) Modbus communication address, ModbusTCP server address that needs to be read or written.
✎(s4): the length read or written by Modbus.
✎(s5): the start device that Modbus receive read data or or store written data.
✎It must be used with the SOCOPEN instruction, and data can only be sent after a full link has been established.
✎This instruction can only be used when a TCP client socket link is established.
✎The communication completion information and the number of received and transmitted could be viewed in the soft devices
specified in the SOCOPEN instruction.
Error codes
Error code Content
5081H The socket specified by is not connected, and could not communicate.
5082H The data specified in (s1) exceeds the range of 0 to 5.
5086H The socket specified by (s1) is not configured in the host computer or enabled.
5088H The SOCMTCP instruction only supports TCP client mode.
Ladder diagram logic: Automatically connect socket 0 after power on 1s. Read the 0 address length 20 of PLC No.2 to D100 to D119
after the link is successful, and set the value of D100 to D119 to address 100 of PLC No.2 after the communication is successful.
Close the link when communicate successfully again, and wait 1s to re-connect after closing successfully. Repeat the actions above.
The ladder diagram of PLC No.1
As a ModbusTCP server, PLC No. 2 does not need to write instructions. (Open two links by default, and could be modified in [PLC
parameters]→[Ethernet settings]. A maximum of eight links are supported.)
Ladder diagram logic: Automatically open the monitor server link of socket one after power on. The data sent by the client is
continuously read after connecting successfully. After receiving "hello word", PLC No.2 would reply “abcdefghijklmnopqrstuvwxyz”.
Power down
SM number Name Content R/W
retentive
Refresh current IP gateway subnet mask after ON.
SM2681 Display current network information R/W ×
Turn OFF after the fresh is complete.
Refresh current MAC after ON.
SM2682 Display current MAC information R/W ×
Turn OFF after the fresh is complete.
ON: Modifiable
The modification flag of IP, subnet mask and OFF: Unmodifiable
SM2683 R/W √
gateway (After setting to ON, modify when stop->run, and
turn OFF automatically after the modification)
ON: The network is connected
SM2684 The connecting status of NIC OFF: The network is not connected. Please check R √
whether the network cable is connected.
ON: Modifiable
OFF: Unmodifiable
SM2692 MAC address modification flag R/W √
(After setting to ON, modify when stop->run, and
automatically turn OFF after the modification)
ON: open
SM2700 ModbusTCP keep-alive mechanism R/W √
OFF: close (default)
ON: open
OFF: close (default)
SM2701 ModbusTCP server force close R/W ×
(After enabling, automatically changes to OFF After
it is successfully turned OFF)
ON: Ethernet error. Please check SD2710 and
SM2710 Ethernet error flag SD2711 R ×
OFF: No Ethernet error.
ON: The client is connected
SM2740 ModbusTCP server connection status 1 R ×
OFF: The client is not connected
ON: The client is connected
SM2760 ModbusTCP server connection status 2 R ×
OFF: The client is not connected
ON: The client is connected
SM2780 ModbusTCP server connection status 3 R ×
OFF: The client is not connected
ON: The client is connected
SM2800 ModbusTCP server connection status 4 R ×
OFF: The client is not connected
ON: The client is connected
SM2820 ModbusTCP server connection status 5 R ×
OFF: The client is not connected
ON: The client is connected
SM2840 ModbusTCP server connection status 6 R ×
OFF: The client is not connected
SM2860 ModbusTCP server connection status 7 ON: The client is connected R ×
Power down
SD number Name Content R/W
retentive
SD2680 The 1st byte of IP address R/W √
SD2681 The 2nd byte of IP address R/W √
Local IP address
SD2682 The 3rd byte of IP address R/W √
SD2683 The 4th byte of IP address R/W √
SD2684 The 1st byte of subnet mask R/W √
SD2685 The 2nd byte of subnet mask R/W √
Local subnet mask
SD2686 The 3rd byte of subnet mask R/W √
SD2687 The 4th byte of subnet mask R/W √
SD2688 The 1st byte of default gateway R/W √
SD2689 The 2nd byte of default gateway R/W √
Local default gateway
SD2690 The 3rd byte of default gateway R/W √
SD2691 The 4th byte of default gateway R/W √
SD2692 The 1st byte of MAC R/W √
SD2693 The 2nd byte of MAC R/W √
SD2694 The 3rd byte of MAC R/W √
Local MAC address
SD2695 The 4th byte of MAC R/W √
SD2696 The 5th byte of MAC R/W √
SD2697 The 6th byte of MAC R/W √
0: 100Mbps/Half-duplex
1: 100Mbps/Full-duplex
SD2700 Communication speed display R ×
2: 10Mbps/Half-duplex
3: 10Mbps/Full-duplex
Maximum link number supported by Maximum link number of simultaneous client links
SD2702 R/W ×
ModbusTCP server supported by local ModbusTCP server
SD2703 The number of links of ModbusTCP The number of links of local ModbusTCP R ×
SD2710 Error code Ehternet error code R ×
-1: default ModbusTCP server
SD2711 The socket ID of current error R ×
0 to 5: Custom socket error
SD2720 Input low bit of number of ping request R ×
The number of external input ping command
SD2721 Input high bit of number of ping request R ×
SD2722 Input low bit of number of ping response The number of replies after receiving external R ×
SD2723 Input high bit of number of ping response ping command R ×
SD2724 Input low bit of number of ping request R ×
The number of sending ping command
SD2725 Input high bit of number of ping request R ×
SD2726 Input low bit of number of ping response The number of replies after receiving external R ×
Error
Description Action Processing scheme Test time
code
Continue When the instruction
3680 Ethernet data reception error Check the environment for interference.
to run is executed
Check whether the network cable is loose.
Check whether the network opposite end is faulty
and cannot send data.
Continue When the instruction
3681 Ethernet data reception timeout Check whether the network opposite end is not
to run is executed
responding in time and the data is too late.
For this reason, try increasing the receive timeout in
the socket configuration.
Check the setting of slave station number.
ModbusTCP station number Continue Check whether there is a problem with the When the instruction
3684
configuration error to run receiving and sending mechanism of the slave is executed
station.
Continue Check whether the function code set is supported When the instruction
3686 ModbusTCP function code error
to run by the PLC. is executed
Continue Check whether the slave station has the address. When the instruction
3687 ModbusTCP address error
to run (Please refer to Modbus abnormality 02) is executed
Continue Check whether the communication length exceeds When the instruction
3688 ModbusTCP length error
to run the range of Modbus. is executed
Check whether the parameter of instruction is
Continue incorrect. When the instruction
3689 ModbusTCP data error
to run Check whether the value set is supported by slave. is executed
(Please refer to Modbus abnormality 03)
Continue Slave returns message: Slave is busy. When the instruction
368A ModbusTCP slave station is busy
to run (Please refer to Modbus abnormality 06) is executed
ModbusTCP slave station does not Continue Check whether the function code is supported by When the instruction
368B
support function code to run slave. (Please refer to Modbus abnormality 01) is executed
Continue Slave returns message: Slave is faulty. When the instruction
368C ModbusTCP slave station fault
to run (Please refer to Modbus abnormality 04) is executed
Continue Slave returns message: Slave confirmation. When the instruction
368D ModbusTCP slave station confirmation
to run (Please refer to Modbus abnormality 05) is executed
RS instruction could not be used when set to slave
ModbusTCP protocol currently does not Continue When the instruction
368E protocol. Please change protocol or close the
support this instruction to run is executed
contact before the RS instruction.
Appendix
Attachment 1 Special Relay (SM)
Error message
Power-down data
SM label Name Content R/W
preservation
OFF: No error
SM0 Latest error message R ×
ON: There is an error
SM1 Reserved
OFF→ON: Clear wrong request
SM2 Error resolution R/W ×
ON→OFF: Error clearing completed
OFF: Normal
SM3 Battery voltage is too low R ×
ON: Battery voltage is too low
OFF: Normal
SM4 Low battery voltage latch R ×
ON: Battery voltage is too low
SM5 Reserved R ×
OFF: No error
SM6 PLC Hardware Error R ×
ON: There is an error
OFF: No error
SM7 PLC communication error R ×
ON: There is an error
OFF: No error
SM10 Parameters error R ×
ON: There is an error
OFF: No error
SM11 Operation Error R ×
ON: There is an error
OFF: No error
SM14 Operation error latch R ×
ON: There is an error
System message
Power-down data
SM label Name Content R/W
preservation
OFF: turn off (default)
SM30 Low battery warning shield R/W ×
ON: open
OFF→ON: Clear request
SM31 Clear all non-retentive registers R/W ×
ON→OFF: Clear completed
OFF→ON: Clear request
SM32 Clear all holding registers R/W ×
ON→OFF: Clear completed
OFF: turn off (default)
SM33 All device remain unchanged in stop state R/W ×
ON: open
OFF: turn off
SM34 All PLC outputs are OFF R/W ×
ON: open
OFF: BAT light is invalid
SM35 Low battery BAT light status R/W ×
ON: Low battery BAT light is on
SM36 to SM49 Reserved
SM53 to SM99 Reserved
Clock information
Power-down
SM label Name Content R/W
data preservation
SM100 Always ON after RUN R ×
SM101 Always OFF after RUN R ×
SM102 The 1st cycle after RUN is ON R ×
Power-down data
SM label Name Content R/W
preservation
OFF: not turned on (default)
SM120 Constant scan period R/W ×
ON: open
OFF:STOP
SM121 RUN, STOP control R/W ×
ON: RUN
OFF: not open
SM122 Circuit program Watchdog function switch R/W ×
ON: open (default)
Instruction related
SM Power-down data
Name Content R/W
label preservation
OFF: Operation does not carry
SM151 Carry sign R ×
ON: Operation carries
OFF: Operation does not abdicate
SM152 Abdication sign R ×
ON: Operation abdicates
OFF: Result is not zero
SM153 Zero sign R ×
ON: Result is zero
OFF: Parameter 1 is exchanged with parameter 2
SM160 XCH exchange mode ON: high 8-bit is exchanged with eighth bits for R/W ×
parameter itself.
Bit processing mode (ASC, ASCI, BCC, OFF: 16 bit processing mode
SM161 R/W ×
CCD,CRC) ON: 8 bit processing mode
SORT/SORT2 instruction ascending and OFF: Ascending
SM165 R/W ×
descending order selection ON: Descending
OFF: Number key + Function key
SM167 HKY instruction HEX data processing R/W ×
ON : Hex key
OFF: Perform BIN→BCD conversion
SM168 SMOV instruction hexadecimal processing R/W ×
ON: BIN→BCD conversion is not performed
BINDA output character number switching OFF: Output00H
SM191 R/W ×
signal ON: There is no change
OFF: Forward transmission
SM224 BMOV instruction direction R/W ×
ON: Reverse transmission
OFF: looping execution mode
SM226 RAMP instruction mode R/W ×
ON: Hold after completion
OFF: Void
ON: The STL monitoring becomes effective, and the
SM247 STL monitoring is valid state numbers in the action (S0 to S4095) are saved in R/W ×
the special auxiliary relays SD240 to SD247 in the
order from small to large.
OFF: Alarm not working
SM248 ANS command signal alarm action R/W ×
ON: Alarm working
OFF: Alarm void
SM249 ANS command signal alarm is effective R/W ×
ON: Alarm effective
SM340 DUTY timing clock output 1 R ×
SM341 DUTY timing clock output 2 R ×
SM342 DUTY timing clock output 3 CLKOUT for DUTY instruction R ×
SM343 DUTY timing clock output 4 R ×
SM344 DUTY timing clock output 5 R ×
Power-down data
SM label Name Content R/W
preservation
Power-down data
SM label Name Content R/W
preservation
OFF:Calculated value does not reach the set value
SM400 HSC0 contact status R ×
ON: Calculated value reaches the set value
OFF: forward and reverse
SM401 Moving direction of HSC0 R ×
ON: reverse direction
OFF: count up
SM405 HSC0 counting direction R/W ×
ON: count down
SM406 to SM429 Reserved
OFF:Calculated value does not reach the set value
SM430 HSC1 contact status R ×
ON: Calculated value reaches the set value
OFF: forward direction
SM431 Moving direction of HSC1 R ×
ON: reverse direction
OFF: count up
SM435 HSC1 counting direction R/W ×
ON: count down
SM436 to SM459 Reserved
OFF:Calculated value does not reach the set value
SM460 HSC2 contact status R ×
ON: Calculated value reaches the set value
674 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
OFF: forward direction
SM461 Moving direction of HSC2 R ×
ON: reverse direction
OFF: count up
SM465 HSC2 counting direction R/W ×
ON: count down
SM466 to SM489 Reserved
OFF:Calculated value does not reach the set value
SM490 HSC3 contact status R ×
ON: Calculated value reaches the set value
OFF: forward and reverse
SM491 Moving direction of HSC3 R ×
ON: reverse direction
OFF: count up
SM495 HSC3 counting direction R/W ×
ON: count down
SM496 to SM519 Reserved
OFF:Calculated value does not reach the set value
SM520 HSC4 contact status R ×
ON: Calculated value reaches the set value
OFF: forward and reverse
SM521 Moving direction of HSC4 R ×
ON: reverse direction
OFF: count up
SM525 HSC4 counting direction R/W ×
ON: count down
SM526 to SM549 Reserved
OFF:Calculated value does not reach the set value
SM550 HSC5 contact status R ×
ON: Calculated value reaches the set value
OFF: forward direction
SM551 Moving direction of HSC5 R ×
ON: reverse direction
OFF: count up
SM555 HSC5 counting direction R/W ×
ON: count down
SM556 to SM579 Reserved
OFF:Calculated value does not reach the set value
SM580 HSC6 contact status R ×
ON: Calculated value reaches the set value
OFF: forward direction
SM581 Moving direction of HSC6 R ×
ON: reverse direction
OFF: count up
SM585 HSC6 counting direction R/W ×
ON: count down
SM586 to SM609 Reserved
OFF:Calculated value does not reach the set value
SM610 HSC7 contact status R ×
ON: Calculated value reaches the set value
OFF: forward direction
SM611 Moving direction of HSC7 R ×
ON: reverse direction
OFF: count up
SM615 HSC7 counting direction R/W ×
ON: count down
SM616 to SM639 Reserved
Power-down data
SM label Name Content R/W
preservation
OFF: Pulse transmission has not started or completed
SM880 CH1 Pulse sending R/W ×
ON: Pulse being sent
OFF: Normal
SM881 CH1 Pulse sending error R/W ×
ON: Error
OFF: Indicates that the pulse is being sent or started
SM882 CH1 Pulse sending stopped R/W ×
ON: Pulse transmission is complete
OFF: Inactive
SM883 CH1 Forward limit R/W ×
ON: After the function is enabled, forward pulse sending stops
OFF: Inactive
SM884 CH1 Reversal limit R/W ×
ON: After the function is enabled, reverse pulse sending stops
OFF: Pulse meter value increases during forward rotation
SM885 CH1 Rotation direction setting R/W ×
ON: Pulse meter value increases when reversed
OFF: Disables the origin regression function. That is, the origin
regression command is disabled and cannot be used.
SM886 CH1 Origin return start ON: Enable the origin regression function, that is, the origin R/W ×
regression command is enabled and can be used normally
(default).
SM887 CH1 Origin regression direction Reserved R/W ×
SM888 Reserved R/W ×
SM889 Reserved R/W ×
SM890 Reserved R/W ×
SM891 Reserved R/W ×
OFF: Receiving external signals when inactive
SM892 CH1 External signal start R/W ×
ON: Receiving external signals when activated
OFF: No external signal is received
SM893 CH1 External signal logic R/W ×
ON: Receives external signals
OFF: Turns OFF the interrupt signal and cannot use the DVIT
SM894 CH1 Interrupt signal start command R/W ×
ON: Turn ON interrupt signal (default)
OFF: No interrupt signal is received
SM895 CH1 Interrupt signal logic R/W ×
ON: Interrupt signal is received
SM896 CH1 External limit signal open CH1 Limit signal on R/W
OFF: 16-bit pulse output mode
SM897 CH1 PWM mode R/W ×
ON: 1000 ratio mode
OFF: No action is performed
SM898 CH1 Immediately stop ON: Stop pulse output immediately without acceleration or R/W ×
deceleration
CH1 scan period is not OFF: Common mode, stop after sending (default)
SM899 R/W ×
processed ON: Stop or slow down immediately
OFF: Use self-contained acceleration and deceleration
SM900 CH1 start speed setting R/W ×
ON: Use set acceleration and deceleration
OFF: Pulse transmission has not started or completed
SM940 CH2 Pulse sending R/W ×
ON: Pulse being sent
OFF: Normal
SM941 CH2 Pulse sending error R/W ×
ON: Error
OFF: Indicates that the pulse is being sent or started
SM942 CH2 Pulse sending stopped R/W ×
ON: Pulse transmission is complete
OFF: Inactive
SM943 CH2 Forward limit R/W ×
ON: After the function is enabled, forward pulse sending stops
OFF: Inactive
SM944 CH2 Reversal limit R/W ×
ON: After the function is enabled, reverse pulse sending stops
OFF: Pulse meter value increases during forward rotation
SM945 CH2 Rotation direction setting R/W ×
ON: Pulse meter value increases when reversed
OFF: Disables the origin regression function. That is, the origin
SM946 CH2 Origin return start R/W ×
regression command is disabled and cannot be used.
Power-down data
SM label Name Content R/W
preservation
BD module 1
SM2011 BD1 second way switch The BD module has different models and functions. For details, see R/W ×
SM2012 BD1 third way switch the corresponding BD module description R/W ×
BD module 2
SM2031 BD2 second way switch The BD module has different models and functions. For details, see R/W ×
SM2032 BD2 third way switch the corresponding BD module description R/W ×
Power-down data
SM label Name Content R/W
preservation
Communication COM1
COM1 Sending- control function is enabled
SM2540 COM1 Sending- control/sent & reminding function R/W ×
COM1 Receive - control is enabled
COM1 Sending- control function is enabled
SM2541 COM1 Sending- control/sent & reminding function R/W ×
COM1 Receive - control is enabled
COM1 Sending- control function is enabled
SM2542 COM1 Sending- control/sent & reminding function R/W ×
COM1 Receive - control is enabled
Power-down
SM number Name Content R/W
save
Display the current network Refresh the current IP, subnet mask, default gateway
SM2681 R/W ×
information after ON, and then OFF after the refresh is complete
Refresh the current MAC, and then OFF after the
SM2682 Display the current MAC information R/W ×
refresh is complete
ON: changeable
IP, subnet mask, gateway modification OFF: unchangeable
SM2683 R/W √
flag (When is set to ON, modify when stop->run, and then
turn OFF after modification is complete)
ON: Network is connecting
SM2684 Network card connection status OFF: Network is not connecting, please check whether R √
the wire is connected
ON: changeable
OFF: unchangeable
SM2692 MAC address modification flag R/W √
(When is set to ON, modify when stop->run, and then
turn OFF after modification is complete)
ON: enable
SM2700 ModbusTCP keep alive mechanism R/W √
OFF: disable (default)
ON: enable
ModbusTCP server is forced to shut OFF: disable (default)
SM2701 R/W ×
down (After successfully close the enable, it automatically
changes to OFF)
ON: Ethernet error, please check SD2710 and SD2711
SM2710 Ethernet error flag R ×
OFF: No Ethernet error
ON: The client is connected
SM2740 ModbusTCP server connection status 1 R ×
OFF: The client is not connected
ON: The client is connected
SM2760 ModbusTCP server connection status 2 R ×
OFF: The client is not connected
ON: The client is connected
SM2780 ModbusTCP server connection status 3 R ×
OFF: The client is not connected
ON: The client is connected
SM2800 ModbusTCP server connection status 4 R ×
OFF: The client is not connected
ON: The client is connected
SM2820 ModbusTCP server connection status 5 R ×
OFF: The client is not connected
Power-down
SD label Name Content R/W
data preservation
SD0 Latest error message Error code Latest self-diagnosed error code will be stored R X
SD1 Reserved
Default value: 26 (2.6V)
SD2 Set minimum battery voltage R/W X
Unit: 0.1 V
Default value: 26 (2.6V)
SD3 Current battery voltage R X
Unit: 0.1 V
Battery voltage value, in unit of 0.1V, when the battery
SD4 Battery voltage latch value R X
voltage is too low and the latching error occurs
Record the number of times the current power supply fails
SD5 AC/DC power down times R X
and restarts automatically
SD6 Error code of PLC hardware error Hardware error code will be stored R X
SD7 PLC communication Error code Communication error code will be stored R X
PLC communication error step Circuit program step numbers for communication error will
SD8 R X
number low word be stored, double - word
PLC communication error step
SD9 Parameter error codes will be stored R X
number high word
SD10 Parameter Error code Error codes for operation errors are stored R X
Circuit program step number of the operation error will be
SD11 Operation Error code R X
stored, double word
Operation error program step Error code for operation error is stored and cannot be
SD12 R X
number low word cleared by the error lifting function
Circuit program step number of the operation error will be
Operation error program step
SD13 stored, double word, cannot be cleared by error lifting R X
number high word
function, double word
SD14 Operation Error code latch An unexpected error occurred in the PLC R X
Operation error program step Recovered time after AC220V power failure will be stored,
SD15 R X
number latch low word unit: ms
Operation error program step
SD16 R X
number latch high word
SD17 Program error Error code The latest self-diagnosing error code will be stored R X
AC220V power down recovery
SD18 R X
time
SD19 to SD29 Reserved Default value: 26 (2.6V)
Power-down
SD label Name Content R/W
data preservation
SD30 Model ID PLC model ID is stored and cannot be modified R X
Software version
SD31 PLC software version number is stored and cannot be modified R X
number
Hardware version
SD32 PLC hardware version number is stored and cannot be modified R X
number
SD33 Input points PLC input points are stored and cannot be modified R X
SD34 Output points Output points of PLC are stored and cannot be modified R X
Number of high-speed
SD35 Number of high speed input shafts is stored, cannot be modified R X
input shafts
Number of high-speed Number of PLC high speed output shafts is stored and cannot be
SD36 R X
output shafts modified
Identify how many output points are of relay type,Using mask method,
SD37、SD38 Relay identification R X
each bit identifies an output point, 1 code stands for relay type
Product unique ID (16
SD40 to SD47 Unique ID code of the product is stored and cannot be modified R X
bytes)
Compile the link
SD48 PLC compiler linked module version is stored, and cannot be modified R X
version
Production
SD49 Production information is stored, and ASCII code is saved X
information string
SD50 to SD99 Model ID PLC model ID is stored and cannot be modified R X
Clock information
Power-down
SD label Name Content R/W data preservatio
n
SD100 Real time clock seconds (0 to 59) R X
SD101 Real-time clock minutes (0 to 59) R X
SD102 Real-time clock hour (0 to 23) R X
SD103 Real-time clock day (1 to 31) PLC built-in RTC clock R X
SD104 Real-time clock month (1 to 12) R X
Real-time clock Gregorian calendar
SD105 R X
year (2000 to 2099)
SD106 Real time clock week R X
SD107 to SD113 Reserved
SD114 n value of nms oscillation clock Set SM114 clock oscillator n to 500ms by default R/W X
SD115 n value of ns oscillation clock Set SM115 clock oscillator n to 2s by default R/W X
SD116 to SD119 Reserved
Power-down
SM label Name Content R/W
data preservation
SD120 Constant scan cycle time setting (ms) Default: 10ms R/W X
SD122 Watchdog timer time setting value Unit ms, default 200 R/W X
• The current scan time will be stored in SD128 and SD129.
(Measured in 1μs)
Ms part of current scan cycle value SD128: store ms bits (storage range: 0 to 65535)
SD128 R X
(ms part) SD129: store μs bits (storage range: 0 to 999)
(Example) When the current scan time is 23.6ms, Store as
follows:
SD128=23
SD129 Scan period current value (us part) SD129=600 R X
• STOP→RUN zero clearing will be performed once
SD130 Ms part of the maximum scan period Maximum scan time excluding the scan time of the initial R X
execution program will be stored in SD130 and SD131.
(Measured in 1μs)
SD131 Maximum scan period us part SD130: Store ms bits (storage range: 0 to 65535) R X
SD131: Store μs bits (storage range: 0 to 999)
• STOP→RUN zero clearing will be performed once
SD132 Scan period minimum ms part The minimum scan time excluding the scan time of the R X
initial execution program will be stored in SD133 and
SD134. (Measured in 1μs)
SD133 Scan period minimum us part SD130: Store ms bits (storage range: 0 to 65535) R X
SD131: Store μs bits (storage range: 0 to 999)
• STOP→RUN zero clearing will be performed once
SD134 Ms part of initial scan time • The initial scan time will be stored in SD134 and SD135. R X
(Measured in 1μs)
SD134: store ms bits (storage range: 0 to 65535)
SD135 Initial scan time us part SD135: store μs bits (storage range: 0 to 999) R X
• STOP→RUN zero clearing will be performed once
SD136 END processing time ms part • After the scan, the time until the start of the next scan R X
will be stored in SD136 and SD137. (Measured in 1μs)
SD136: store ms bits (storage range: 0 to 65535)
SD137 END processing time us part R X
SD137: store μs bits (storage range: 0 to 999)
• STOP→RUN zero clearing will be performed once
SD138 Ms part of program execution time Constant scan wait time (in ms) R X
• Wait times for constant scan Settings are stored in SD138
and SD139. (measuring in units of 1μs)
SD139 Program execution time us part SD138: Store ms bits (storage range: 0 to 65535) R X
SD149: Store μs bits (storage range: 0 to 999)
• STOP→RUN zero clearing will be performed once
SD140 Constant scan cycle waiting time ms • Execution time of a scan is stored in SD140 and SD141. R X
(Measured in 1μs)
SD140: store ms bits (storage range: 0 to 65535)
SD141 Constant scan cycle waiting time us SD141: store μs bits (storage range: 0 to 999) R X
• STOP→RUN zero clearing will be performed once
During the execution of the interrupt program, the priority
of interrupts is stored.
SD150 Current interrupt priority R X
0 to 2: Priority of interrupt pointer for an executing
interrupt program
According to interrupt prohibition instruction (DI
instruction),interrupt prohibition instruction (DI
instruction), interrupt permit instruction (EI instruction)
below the specified priority, and the priority in interrupt
Priority of interrupts currently prohibition will be stored.
SD151 R X
prohibited 0: interrupt prohibition with all priority (default)
1: interrupt prohibition with priority level 1 and priority
level 2.
2: interrupt prohibition with priority level 2.
3: interrupt enable with all priority.
Power-down
SD label Name Content R/W
data preservation
During the execution of the interrupt program, the priority of
the interrupt will be stored.
SD150 Current interrupt priority 1 to 3: The interrupt pointer priority of the interrupt program R X
being executed
0: No interrupt is executed (default)
According to the interrupt prohibition instruction (DI
instruction), the interrupt prohibition instruction (DI
instruction) below the designated priority, and the interrupt
Currently interrupt prohibition enable instruction (EI instruction), the priority of the
SD151 R X
priority interrupt prohibition will be stored. 0: All priority interrupts
are disabled (default) 1: Priority 1 and 2 interrupts are
disabled 2: Priority 2 interrupts are disabled 3: All priority
interrupts are enabled
SD240 For STL: ON status number 1 R X
SD241 For STL: ON status number 2 R X
SD242 For STL: ON status number 3 R X
SD243 For STL: ON status number 4 The S soft element number of the ON status in STL will be sav R X
ed, up to 8, exceeding the first 8 with smaller storage numbe
SD244 For STL: ON status number 5 rs. R X
SD245 For STL: ON status number 6 R X
SD246 For STL: ON status number 7 R X
SD247 For STL: ON status number 8 R X
Signal alarm ON state minimum
SD249 Store signal alarm ON state minimum number R/W X
number
Timing clock output 1 of DUTY instruction is counted by scan
SD340 DUTY timing clock count value 1 R/W X
numbers
Timing clock output 2 of DUTY instruction is counted by scan
SD341 DUTY timing clock count value 2 R/W X
numbers
Timing clock output 3 of DUTY instruction is counted by scan
SD342 DUTY timing clock count value 3 R/W X
numbers
Timing clock output 4 of DUTY instruction is counted by scan
SD343 DUTY timing clock count value 4 R/W X
numbers
Timing clock output 5 of DUTY instruction is counted by scan
SD344 DUTY timing clock count value 5 R/W X
numbers
Interrupt prohibited
Power-down
SD label Name Content R/W
data preservation
SIMASK instruction interrupt mask. Each bit represents an
SD350 to SD381 Timer interrupt disable mask R/W X
interrupt. For details, see SIMAK instruction
High-speed counter interrupt SIMASK instruction interrupt mask. Each bit represents an
SD382 to SD388 R/W X
disable mask interrupt. For details, see SIMAK instruction
Power-down
SD label Name Content R/W
data preservation
SD400 HSC0 current count value low Current value of the memory channel high-speed R/W √
counter, updated every 100 μ s
SD401 HSC0 current count value high R/W √
SD402 HSC0 current frequency low Current frequency of the memory channel R/W ×
high-speed counter, updated every 100 µ s
SD403 HSC0 current frequency high R/W ×
SD432 HSC1 current frequency low Current frequency of the memory channel R/W ×
SD433 HSC1 current frequency high high-speed counter, updated every 100 µ s R/W ×
SD522 HSC4 current frequency low Current frequency of the memory channel R/W ×
SD523 HSC4 current high frequency high-speed counter, updated every 100 µ s R/W ×
SD524 Reserved R/W ×
SD552 HSC5 current frequency low Current frequency of the memory channel R/W ×
SD553 HSC5 current frequency high high-speed counter, updated every 100 µ s R/W ×
SD554 Reserved R/W ×
SD582 HSC6 current frequency low Current frequency of the memory channel R/W ×
SD583 HSC6 current frequency high high-speed counter, updated every 100 µ s R/W ×
SD584 Reserved R/W ×
DHSCS, DHSCR, DHSZ instructions use The value ranges from 0 to 2. The highest priority is
SD603 R/W ×
the priority setting of the HSC6 channel 0. The default value is 0
SD612 HSC7 current frequency low Current frequency of the memory channel R/W ×
SD613 HSC7 current frequency high high-speed counter, updated every 100 µ s R/W ×
Power-down data
SD label Name Content R/W
preservation
SD880 CH1 positioning axis output low bit R/W √
Count value of current high speed pulse output
SD881 CH1 positioning axis output upper bit R/W √
SD882 Reserved R/W ×
SD883 Reserved R/W ×
SD884 CH1 current speed lower bit R/W ×
Current high speed pulse output frequency
SD885 CH1 current speed upper bit R/W ×
SD886 Reserved R/W ×
SD887 Reserved R/W ×
SD888 Reserved R/W ×
SD889 Reserved R/W ×
SD890 Reserved R/W ×
SD891 Reserved R/W ×
SD892 Reserved R/W ×
SD893 Reserved R/W ×
SD894 Reserved R/W ×
SD895 Reserved R/W ×
SD896 Reserved R/W ×
SD897 Reserved R/W ×
SD898 CH1 maximum speed (32 bits) R/W ×
Default: 100000Hz
SD899 CH1 maximum speed (32 bits) R/W ×
SD900 CH1 offset speed (32 bits) R/W ×
Default: 1Hz
SD901 CH1 offset speed (32 bits) R/W ×
SD902 CH1acceleration time (16 bits) Default: 100ms R/W ×
SD903 CH1 deceleration time (16 bits) Default: 100ms R/W ×
0: slows down and stops
SD904 CH1 stop mode R/W ×
1: Stop immediately
BD module
Power-down
SD label Name Content R/W
data preservation
BD module 1
SD2000 BD1 Type Stores the type of the BD module currently connected) R ×
Stores the version number of the BD module currently
SD2001 BD1 version R ×
connected
Stores the last time Error code of the the currently connected
SD2002 BD1 last error R ×
BD module
store the current error code of the BD module currently
SD2003 BD1 current error R ×
connected
Stores the number of errors recorded in BD module currently
SD2004 BD1 error times R ×
connected
SD2010 BD1 first value R ×
SD2011 BD1 second value Values stored on different BD modules have different meanings. R ×
SD2012 BD1 third value For details, see the corresponding BD module description R ×
SD2013 BD1 fourth value R ×
BD module 2
SD2020 BD2 type Stores the type of the BD module currently connected) R ×
Stores the version number of the BD module currently
SD2021 BD2 version R ×
connected
Last time Error code of the the currently connected BD
SD2022 BD2 last error R ×
module
store the current error code of the BD module currently
SD2023 BD2 current error R ×
connected
Stores the number of errors recorded in BD module currently
SD2024 BD2 error times R ×
connected
SD2030 BD2 first value R ×
SD2031 BD2 second value Values stored on different BD modules have different meanings. R ×
SD2032 BD2 third value For details, see the corresponding BD module description R ×
SD2033 BD2 fourth value R ×
Power-down
SD label Name Content R/W
data preservation
Total number of currently connected right expansion
SD2081 Total number of modules connected R ×
modules
SD2082 Number of IO modules Number of connected I/O expansion modules R ×
Number of special extension modules currently
SD2083 Number of special expansion modules R ×
connected
-1: No module is offline
SD2084 Which module started to go offline 0: The first module is offline R ×
1: The second module is offline, and so on
Input filtering
Power-down
SD label Name Content R/W
data preservation
SD2280 Input filter point setting, default 10ms Low byte X0 to X3, high byte X4 to X7 R/W ×
SD2281 Input filter point setting, default 10ms Low byte X10 to X13, high byte X14 to X17 R/W ×
SD2282 Input filter point setting, default 10ms Low byte X20 to X23, high byte X24 to X27 R/W ×
SD2283 Input filter point setting, default 10ms Low byte X30 to X33, high byte X34 to X37 R/W ×
SD2284 Input filter point setting, default 10ms Low byte X40 to X43, high byte X44 to X47 R/W ×
SD2285 Input filter point setting, default 10ms Low byte X50 to X53, high byte X54 to X57 R/W ×
SD2286 to SD2287 Input filter point setting, default 10ms ...... R/W ×
Communication
Power-down
SD label Name Content R/W
data preservation
Communication com1
Default: Baud rate 115200, Stop bit 1, data bit 8, setting
SD2540 COM1 Communication port settings method for parity bit is not specified, but you may refer R/W √
to the Description of the PROTPARA Instruction
If you need to modify serial port parameters in RUN, you
must operate the modification identifier and write a
COM1 Serial port parameter correct identifier to make the modification successful.
SD2541 R/W √
modification identifier After the modification is successful, the value is
automatically cleared. For details about the operation
method, see Description of the PROTPARA Instruction.
0H : Wecon Modbus slave station
2H : ModbusRTU slave station
3H : ModbusASCII slave station
SD2542 COM1 Protocol settings R/W √
10H : User-defined protocol
20H : ModbusRTU Master station
30H : ModbusASCII Master station
If the communication PROTOCOL needs to be modified in
RUN, it must calculate the modification identifier and
write the correct identifier to make the modification
SD2543 COM1 Protocol modification logo R/W √
successful. After the modification is successful, the value
is automatically cleared. For details, see the PROTOCOL
instruction.
SD2544 COM1 Station number setting Value range: 0~255 Default value: 0 R/W √
If the communication STATION number needs to be
modified in RUN, it must calculate the modification
SD2545 COM1 Station number modification logo identifier and write the correct identifier to make the R/W √
modification successful. After the modification is
successful, the value will be cleared automatically. For
699 WECON technology Co., Ltd.
PLC LX5V Series Programming Manual (V2.3)
the specific calculation method, see the STATION
instruction.
SD2546 Sending interval 0.1ms R/W √
SD2547 Communication timeout setting 10ms R/W √
SD2548 COM1 Timeout retries R/W √
COM1 Character interval timeout setting
SD2549 R/W √
0.1ms
SD2550 COM1 STX value R/W √
SD2551 COM1 ETX value R/W √
In case of PLC upload and download
timeout, the upload and download will
SD2555 Unit: 100ms, default: 300 (30s) √
be interrupted if the transmission does
not continue after the timeout.
SD2560 The amount of data received by COM1 R √
SD2561 COM1 last error R √
SD2562 COM1 Current error R √
SD2563 COM1 Error steps R √
SD2564 COM1 Error station number R √
SD2565 COM1 Cumulative number of errors R √
SD2566 COM1 Number of error steps (double R √
SD2567 world) R √
SD2568 Reserved R √
SD2569 Reserved R √
SD2570 Reserved R √
SD2571 Reserved R √
Communication com2
Default: Baud rate 115200, Stop bit 1, data bit 8, parity
bit None
SD2590 COM2 Communication port settings R/W √
For details, see the description of the PROTPARA
instruction.
If you need to modify serial port parameters in RUN, you
must calculate the modification identifier and write a
COM2 Serial port parameter correct identifier to make the modification successful.
SD2591 R/W √
modification identifier After the modification is successful, the value is
automatically cleared. For details about the calculation
method, see the PROTPARA instruction description.
0H: Wecon Modbus slave station
2H: ModbusRTU slave station
3H: ModbusASCII slave station
SD2592 COM2 Protocol settings R/W √
10H: User-defined protocol
20H: ModbusRTU master station
30H: ModbusASCII master station
If the communication PROTOCOL needs to be modified in
RUN, it must calculate the modification identifier and
write the correct identifier to make the modification
SD2593 COM2 Protocol modification logo R/W √
successful. After the modification is successful, the value
is automatically cleared. For details, see the PROTOCOL
instruction.
SD2594 COM2 Station number setting Value range: 0 to 255 Default value: 0 R/W √
If the communication STATION number needs to be
modified in RUN, it must calculate the modification
identifier and write the correct identifier to make the
SD2595 Station number modification logo R/W √
modification successful. After the modification is
successful, the value will be cleared automatically. For
the specific calculation method, see the STATION
Power-off
SD number Name Content R/W
save
SD2680 The 1st byte of IP address R/W √
SD2681 The 2nd byte of IP address R/W √
Local IP address
SD2682 The 3rd byte of IP address R/W √
SD2683 The 4th byte of IP address R/W √
SD2684 The 1st byte of subnet mask R/W √
SD2685 The 2nd byte of subnet mask R/W √
Local subnet mask
SD2686 The 3rd byte of subnet mask R/W √
SD2687 The 4th byte of subnet mask R/W √
SD2688 The 1st byte of default gateway R/W √
SD2689 The 2nd byte of default gateway R/W √
Local default gateway
SD2690 The 3rd byte of default gateway R/W √
SD2691 The 4th byte of default gateway R/W √
SD2692 The 1st byte of MAC address R/W √
SD2693 The 2nd byte of MAC address R/W √
SD2694 The 3rd byte of MAC address R/W √
Local MAC address
SD2695 The 4th byte of MAC address R/W √
SD2696 The 5th byte of MAC address R/W √
SD2697 The 6th byte of MAC address R/W √
0: 100Mbps/half-duplex
1: 100Mbps/full duplex
SD2700 Communication speed R ×
2: 10Mbps/half-duplex
3: 10Mbps/full duplex
Power-down
SD label Name Content R/W
data preservation
SD4000 Lower bit of ladder diagram writing number Total download times of storage ladder R √
SD4001 Higher bit of ladder diagram writing number diagram, power off preservation R √
SD4002 Lower bit of PLC parameter writing number Total download times of storage R √
SD4003 Higher bit of PLC parameter writing number parameters, power off preservation R √
SD4004 Lower bit of password writing number Store the total times of writing password, R √
SD4005 Higher bit of password writing number power off preservation R √
SD4006 Lower bit of comment writing number Store the total times of downloading R √
SD4007 Lower bit of comment writing number comment, power off preservation R √
SD4008 Lower bit of total startup times Store the total number of PLC startup times, R √
SD4009 Higher bit of total startup times power off preservation R √
SD4010 Lower bit of total startup time Store the total startup time of PLC, power R √
SD4011 Higher bit of total startup time off preservation, unit s R √
SD4012 Lower bit of total startup RUN time Store the total number of PLC startup times, R √
SD4013 Higher bit of total startup RUN time power off preservation R √
SD4014 Lower bit of this startup RUN time Store the total startup time of PLC, power R ×
SD4015 Lower bit of this startup RUN time off preservation, unit s R ×
The communication port does not support keep When the instruction
31C1 Upgrade firmware
PLCLINK for the function running or function is applied
The station number in the PLCLINK form is o keep When the instruction
31C4 Check the site number in the form
ut of range running or function is applied
The PLCLINK form is outside the scope of the keep Check the range of software components c When the instruction
31C5
software component running orresponding to the table or function is applied
The PLCLINK form command uses software c keep Check the software components used for e When the instruction
31C6
omponents that are out of range running ach command in the table or function is applied
0000 1010 12 10 0x0A LF (NL line feed, new line) Line feed
0000 1100 14 12 0x0C FF (NP form feed, new page) Form feed
0001 0000 20 16 0x10 DLE (data link escape) data link escape
0001 0111 27 23 0x17 ETB (end of trans. block) Ends the transfer block
Reference
Classification Instruction Function LX5V
page
LD Normally open contact operation start instruction ○ 26
LDI Normally closed contact operation start instruction ○ 26
AND Normally open contact series connection instruction ○ 26
Program flow
ANI Normally closed contact series connection instruction ○ 26
instruction
OR one normally open contact parallel connection instruction ○ 26
ORI one normally closed contact parallel connection instruction ○ 26
LDP Rising edge pulse operation start instruction ○ 30
错误!未定义
BREAK Break cycle ○
书签。
错误!未定义
MAX BIN16 bit The maximum value of 16-bit data ○
书签。
错误!未定义
DMAX BIN32 bit The maximum value of 32-bit data ○
书签。
错误!未定义
MIN BIN16 bit The minimum value of 16-bit data ○
书签。
错误!未定义
DMIN BIN32 bit The minimum value of 32-bit data ○
书签。
Matrix input
MTR Matrix input ○ 186
instruction
ABSD BIN 16-bit data absolute method ○ 188
DABSD BIN 32-bit data absolute method ○ 190
SER 16-bit data search ○ 192
DSER 32-bit data search ○ 193
ALT Bit device output inversion ○ 195
Convenient
INCD BIN 16-bit data relative method ○ 197
instruction
RAMP Rotary table proximity control ○ 199
ROTC Rotary table proximity control ○ 201
STMR Special function timer ○ 204
TTMR Teaching timer ○ 206
TRH Conversion of wet and dry bulb temperature and humidity ○ 208
ARWS Arrow switch ○ 216
DSW Numeric key input ○ 219
错误!未定义
HKY Hexadecimal numeric key input ○
书签。
DSTOH 33-bit data conversion of time data(second → hour, minute, second) ○ 326
TCMP Clock data comparison ○ 327
TZCP Clock data bandwidth comparison ○ 329
BAND BIN 16-bit data dead zone control ○ 339
DBAND BIN 32-bit data dead zone control ○ 340
BINDA BIN 16-bit data → Decimal ASCII conversion ○ 342
DBINDA BIN 32-bit data → Decimal ASCII conversion ○ 343
DABIN Decimal ASCII → BIN conversion ○ 344
DDABIN Decimal ASCII → BIN32-bit data conversion ○ 345
Data control
LIMIT BIN 16-bit data high and low limit control ○ 347
instruction
DLIMIT BIN 32-bit data high and low limit control ○ 348
SCL BIN 16-bit unit scale (coordinate data of each point) ○ 349
DSCL BIN 32-bit unit scale (coordinate data of each point) ○ 352
DSCL2 BIN 32-bit unit scale (X/Y coordinate data) ○ 358
ZONE BIN 16-bit data zone control ○ 361
DZONE BIN 32-bit data zone control ○ 362
BK+ BIN 16-bit block data addition operation ○ 363
Data block instruction
DBK+ BIN 32-bit block data addition operation ○ 365
FROM Read single word data from the module (16-bit specification) ○ 544
Reference
Classification Instruction Function LX5V
page
LD Normally open contact operation start instruction ○ 26
ABSD BIN 16-bit data absolute method ○ 188
ADD 16-bit addition operation ○ 26
ALT Bit device output inversion ○ 195
ANB Ladder diagram block series connection instruction ○ 33
A AND Normally open contact series connection instruction ○ 26
AND< Number less than comparison ○ 304
AND<= Number less than or equal to comparison ○ 304
AND<> Number unequal comparison ○ 304
AND= Number equal comparison ○ 304
AND> Number greater than comparison ○ 304
错误!未定
DMAX BIN32 bit The maximum value of 32-bit data ○
义书签。
错误!未定
DMEAN 32-bit data mean value ○
义书签。
错误!未定
DMIN BIN32 bit The minimum value of 32-bit data ○
义书签。
DMOV 32-bit transmission ○ 77
DMUL 32-bit multiplication operation ○ 116
DNEG 32-bit complement ○ 124
DOR 32-bit data logic OR ○ 126
DPLSR Pulse output with acceleration and deceleration ○ 417
DPLSV Variable speed operation ○ 425
DPLSY Pulse output ○ 427
DPRUN Octal digit transmission (32-bit data) ○ 258
DRAD Single precision real number conversion angle → radian conversion ○ 272
DRCL 32-bit cycle shift left with carry ○ 100
DRCR 32-bit cycle shift right with carry ○ 96
DROL 32-bit cycle shift left ○ 98
DROR 32-bit cycle shift right ○ 93
DRVA Absolute positioning ○ 415
DRVI Relative positioning ○ 413
DSCL BIN 32-bit unit scale (coordinate data of each point) ○ 352
DSCL2 BIN 32-bit unit scale (X/Y coordinate data) ○ 358
DSER 32-bit data search ○ 193
DSFL one word shift left of the n-bit data ○ 108
DSFR one word shift right of the n-bit data ○ 106
DSIN Single precision real number SIN operation ○ 267