LX5V-2RS485-BD

Last modified by Jim on 2023/05/29 16:00

1 Features

  1. LX5V-2RS485-BD is used for serial communication connection and installed on the top of PLC host.
  2. LX5V-2RS485-BD supports Modbus RTU, Modbus ASCII, user-defined protocol and dedicated protocol (Wecon Modbus slave station protocol, that is, PLC local protocol).
  3. Data transfer using user-defined protocol, through RS485 converter, data communication between various devices with RS232C unit, such as personal computers, barcode readers and printers. In this application, data is sent and received through the data register specified by RS2 instruction.
  4. Using dedicated protocol for data transfer, connect PLC Editor2 PC with LX5V-2RS485-BD to complete the uploading and downloading of the program.

✎Note: This manual is only applicable when LX5V-2RS485-BD is used together with 5V series PLC.Please refer to the LX3V-RS485-BD Manual for the use of LX5V-2RS485-BD with 3V Series PLC.

2 Appearance and terminal

image-20220913154323-19.png

Indicator lightColorDescription
PWRWhitePower light: It is always ON when the power supply connection is normal.
TX1YellowSerial port 3/serial port 5 sends.
RX1GreenSerial port 3/serial port 5 receives.
TX2YellowSerial port 4/serial port 6 sends.
RX2GreenSerial port 4/serial port 6 receives.

PLC with small points has a card slot, and the installation position is shown in the following figure, where (A1+, B1-) is COM3 and (A2+, B2-) is COM4.

image-20220913154410-20.jpeg

PLC with large points has two card slots. (A1+, B1-) of BD module on the left side is COM3, and (A2+, B2-) is COM4. (A1+, B1-) of BD module on the right is COM5, [A2+, B2-] is COM6.

image-20220913154442-21.jpeg

image-20220913154452-22.jpeg

image-20220913154459-23.jpeg

3 Serial communication function

Serial portCommunication protocolCommunication instructionCommunication interface
COM3

Modbus RTU protocol;

Modbus ASCII protocol;

User-defined protocol

Dedicated protocol (supports program upload and download and HMI monitoring).

RS2 instructionRS485
COM4
COM5
COM6

4 Parameter configuration

  • Open the host computer and create a new project, double-click “Project Manager” → “Extended Function” → "BD Module Configuration" Note to enter “BD settings” interface;
  • Select "LX5V-2RS485" in the device bar on the right side of the BD module configuration interface and double-click to add it to the corresponding slot position of PLC (slot 1 or 2, the software will select slot 1 by default. You could right-click it to move to slot 2);
  • After adding BD module to the machine slot, double-click or right-click to select configuration parameters to enter LX5V-2RS485-BD configuration parameters interface, as shown in the following figure. Parameters such as baud rate, data bit, stop bit, check bit and station number are configured in this interface.

image-20220913154722-26.jpeg

✎Note: This function is only supported in the following host computer and slave computer versions:

Supported host computer versions: Wecon PLC Editor 2 2.1.204 and above, as shown in the following figure:

image-20220913154229-2.jpeg

Supported slave computer versions: 2.061 and above, as shown in the following figure:

image-20220913154229-3.jpeg

The parameter configuration interface is as follows:

image-20220913154229-4.jpeg

Functional description of each configuration item:

  • Whether to set: Indicates whether the configuration is effective. True is effective, and False is not.
  • Communication settings:
    • Baud rate: Indicates the baud rate of serial communication and the number of bits transmitted per second. The maximum baud rate supported is 115200bps.
    • Data bit: Indicates the number of data bits of serial communication, and the value range is 7 to 8 digits.
    • Stop bit: Indicates the number of stop bits in serial communication, and the value range is 1 to 2 digits.
    • Parity bit: Indicates whether to add check bits during serial communication, and check types. Odd check and even check are commonly used.
    • Timeout (10ms): Configuration for the master station, indicating the maximum waiting time between the request and the reply. The unit is 10ms, and the configuration here is 10, which means 10*10ms=100ms.
    • Sending interval (0.1 ms): Configuration for the master station, indicating the time when the communication is completed and the next request is sent.
    • Agreement: Currently supported protocols are: user-defined protocol, dedicated protocol, Modbus RTU, Modbus ASCII.
      • User-defined protocol: Users need to organize request frames by themselves, and process response frames after receiving response data.
      • Dedicated protocol: WECON Modbus protocol (PLC local protocol) is used for program upload and download, HMI monitoring protocol.
  • Agreement related:
    • Station NO. (0 is the main station): The value range is 0 to 255. Non-0 indicates the slave station number, and 0 indicates the master station.
    • Whether to enable the starter: Effective under user-defined protocol. When enabled, a user-defined starter of one-byte is sent first before sending user data.
    • Whether to enable the terminator: Effective under user-defined protocol. When enabled, a user-defined terminator of one-byte is sent again after the user data is sent.
  • Terminator: Effective under user-defined protocol.
  • Inter-character timeout (0.1 ms): Mainly used to judge whether a complete response frame is received. After receiving a byte, if there is no new byte is received beyond the time-out interval between characters, it indicates that the data of the previous frame has been received.
  • Bit mode: It is divided into 8-bit and 16-bit modes, which are mainly used to define the storage mode of data received by user-defined protocol. Assume that the user-defined protocol receives two bytes of data, 0x12 and 0x13, and stores them in the device starting with D100.

The storage mode of 16-bit mode is as follows:

 (High 8 bits)(Low 8 bits)
D1000x130x12
D101No dataNo data

The storage mode of 8-bit mode is as follows:

 (High 8 bits)(Low 8 bits)
D1000x000x12
D1010x000x13

5 RS2 instruction

In the case of user-defined protocol: The instruction is a communication receiving and sending instruction. The starting data of the specified (S) is taken out (M) and sent, and the data received by the serial port is stored in (D), and store (N), sent by the communication port specified by (N1).

In the case of Modbus master protocol: The instruction is a setting interface for sending protocol frames by the master station. According to the station number function code (S), slave station address (M), and length (D) set by the instruction, and the function code to determine whether N data is needed to automatically combine to send and receive protocol frames. If it is a read type function code, the data will be written to (N) and sent by the communication port specified by (N1).

-[RS2 (S) (M) (D) (N) (N1)]

Content, range and data type

In the case of user-defined protocol

ParameterContentRangeData typeData type (label)
(S)The starting address of the register area where the data to be sent is stored-Unsigned BIN16 bitsANY16
(M)The length (in bytes) of the data to be sent0 to 528Unsigned BIN16 bitsANY16
(D)The start number of device that stores written data-Unsigned BIN16 bitsANY16
(N)Number of data written in bytes0 to 528Unsigned BIN16 bitsANY16
(N1)Specify communication port-Unsigned BIN16 bitsANY16

Modbus protocol

ParameterContentRangeData typeData type (label)
(S)The high byte stores the station number of the slave station, and the low byte stores Modbus function codes.-Unsigned BIN16 bitsANY16
(M)The slave address provided by the slave, reads or writes data from this address of the slave.-Unsigned BIN16 bitsANY16
(D)Length. The length read or written by Modbus, and the unit is determined by the function code.-Unsigned BIN16 bitsANY16
(N)Start address for reading or writing data-Unsigned BIN16 bitsANY16
(N1)Specify communication port-Unsigned BIN16 bitsANY16

Device used

InstructionParameterDevices

Offset

modification

Pulse

extension

TCDRKH[D]XXP
RS2(S)  
(M)  
(D)  
(N)  
(N1)      

Function

The parameter (N1) is the specified serial port, K2 for COM3 (BD1), K3 for COM4 (BD1), K4 for COM5 (BD2), and K5 for COM6 (BD2).

User-defined protocol

When the communication protocol is set to user-defined protocol, in the case of the contact before the RS2 instruction is set on, the “sending control on" is also set ON, and the sending length (M) is not 0, the data of (S) will be sent out by (M) bytes, and then enter the wait receiving mode. When the data is received, (N) bytes of data will be stored in (D). After receiving (N) pieces of data, the "Accept control/Receive prompt" will be set on.

In addition, when the sending length (M) is 0, it will be in the receive-only mode. When the receiving length (N) is 0, it will be in the send-only mode.

Example:

image-20220913154229-5.png

When M1 is ON, the sending and receiving data of communication after instruction execution are stored as follows:

image-20220913154229-6.jpeg

Modbus protocol

When the protocol is set to Modbus master station protocol (whether RTU or ASCII), and the contact point before the RS2 instruction is set ON, the RS2 instruction will judge whether the data of (N) is needed to send the combined data frame according to station number function code (S), slave station address (M), the length (D) and function code.

Example:

image-20220913154229-7.png

(S)The high byte stores the station number of the slave station, and the low byte stores the Modbus function code.
(M)Slave station address The address provided by the slave station will read or write data from the address of slave station.
(D)Length. The length read or written by Modbus, and the unit is determined by the function code.
(N)The starting address for reading or writing data.
(N1)Specify communication port.

✎Note:

  • The RS2 instruction allows parameters to be represented by K and H constants, but with different restrictions on different protocols.
  • When the protocol is user-defined protocol, S and D cannot be constants, otherwise an error (3X89H) will be reported.
  • When the protocol is Modbus protocol, N cannot be a constant, otherwise an error (3X89H) will be reported.
  • When the protocol is RTU protocol, only 8 bits of data can be selected.
  • If the serial port parameters are set differently, it may be in normal communication. However, it is recommended that to set consistent serial port parameters to avoid other failures.
  • At present, RS2 instructions cannot be used in interrupts and events.

Error code

Error codeContent
4085H(S), (M), (D) and (N) read address out of range of the device.
4084HParameter value is out of the specified range.
COM3
3280HCOM3 data reception error. There may be interference on the communication cable, it is recommended to connect GND.
3281HCOM3 data reception timed out. Check the wiring, whether the serial port parameter settings correspond to master and slave, and whether there is interference. Check whether the response from the station is too late. It is recommended to increase the “sending interval".
3282HCOM3 CRC validation error. There may be interference on the communication cable, it is recommended to connect GND.
3283HCOM3 LRC validation error. There may be interference on the communication cable, it is recommended to connect GND.
3284HCOM3 station number is incorrectly configured. Check the slave station number setting, and check whether there is any problem with the receiving and sending mechanism from slave.
3285HCOM3 send buffer overflow. If this error appears, please contact your technician.
3286HCOM3 function code error. Check whether the set function code is supported by PLC.
3287HCOM3 address error. Check whether the slave station has this address. (Please refer to Modbus exception 02).
3288HCOM3 length error. Check whether the communication length exceeds the length range specified by Modbus protocol or user-defined protocol.
3289HCOM3 data error. Check the parameters of the instruction for errors. Check whether the set value is supported by the slave station. (Please refer to Modbus exception 03).
328AHCOM3 slave station is busy. Message returned from slave station: Slave station is busy. (Please refer to Modbus exception 06).
328BHCOM3 slave does not support function codes. Check whether this function code is supported by the slave station. (Please refer to Modbus exception 01).
328CHCOM3 slave failure. Message returned from slave station: Slave station failed, please check whether slave station failed (Please refer to Modbus exception 04).
328DHCOM3 slave confirmation. Message returned from slave station: slave station confirmation. (Please refer to Modbus exception 05).
328EHCOM 3 does not currently support this instruction or function. When set to slave protocol, the communication instructions related to master station or master station functions cannot be used. Please change the protocol or close the contact before the corresponding instruction or close the corresponding communication function.
328FHCOM3 sending timed out. If this error appears, please contact your technician.
32A0HCOM3 unavailable gateway Message returned from the station: unavailable gateway. (Please refer to Modbus exception 0A).
32A1HCOM3 indicates that no response was obtained from the target device. Message returned from the station: The device is not in the network. (Please refer to Modbus Exception 0B).
COM4
3380HCOM4 data reception error. There may be interference on the communication cable, it is recommended to connect GND.
3381HCOM4 data reception timed out. Check the wiring, whether the serial port parameter settings correspond to master and slave, and whether there is interference. Check whether the response from the station is too late. It is recommended to increase the “sending interval".
3382HCOM4 CRC validation error. There may be interference on the communication cable, it is recommended to connect GND.
3383HCOM4 LRC validation error. There may be interference on the communication cable, it is recommended to connect GND.
3384HCOM4 station number is incorrectly configured. Check the slave station number setting, and check whether there is any problem with the receiving and sending mechanism from slave.
3385HCOM4 send buffer overflow. If this error appears, please contact your technician.
3386HCOM4 function code error. Check whether the set function code is supported by PLC.
3387HCOM4 address error. Check whether the slave station has this address. (Please refer to Modbus exception 02).
3388HCOM4 length error. Check whether the communication length exceeds the length range specified by Modbus protocol or user-defined protocol.
3389HCOM4 data error. Check the parameters of the instruction for errors. Check whether the set value is supported by the slave station. (Please refer to Modbus exception 03).
338AHCOM4 slave station is busy. Message returned from slave station: Slave station is busy. (Please refer to Modbus exception 06).
338BHCOM4 slave does not support function codes. Check whether this function code is supported by the slave station. (Please refer to Modbus exception 01).
338CHCOM4 slave failure. Message returned from slave station: Slave station failed, please check whether slave station failed. (Please refer to Modbus exception 04).
338DHCOM4 slave confirmation Message returned from slave station: slave station confirmation. (Please refer to Modbus exception 05).
338EHCOM4 does not currently support this instruction or function. When set to slave protocol, the communication instructions related to master station or master station functions cannot be used. Please change the protocol or close the contact before the corresponding instruction or close the corresponding communication function.
338FHCOM4 send timed out. If this error appears, please contact your technician.
33A0HCOM4 unavailable gateway Message returned from the station: unavailable gateway. (Please refer to Modbus exception 0A).
33A1HCOM4 indicates that no response was obtained from the target device. Message returned from the station: The device is not in the network. (Please refer to Modbus Exception 0B).
COM5
3480HCOM5 data reception error. There may be interference on the communication cable, it is recommended to connect GND.
3481HCOM5 data reception timed out. Check the wiring, whether the serial port parameter settings correspond to master and slave, and whether there is interference. Check whether the response from the station is too late. It is recommended to increase the “sending interval".
3482HCOM5 CRC validation error. There may be interference on the communication cable, it is recommended to connect GND.
3483HCOM5 LRC validation error. There may be interference on the communication cable, it is recommended to connect GND.
3484HCOM5 station number is incorrectly configured. Check the slave station number setting, and check whether there is any problem with the receiving and sending mechanism from slave.
3485HCOM5 send buffer overflow. If this error appears, please contact your technician.
3486HCOM5 function code error. Check whether the set function code is supported by PLC.
3487HCOM5 address error. Check whether the slave station has this address. (Please refer to Modbus exception 02).
3488HCOM5 length error. Check whether the communication length exceeds the length range specified by Modbus protocol or user-defined protocol.
3489HCOM5 data error. Check the parameters of the instruction for errors. Check whether the set value is supported by the slave station. (Please refer to Modbus exception 03).
348AHCOM5 slave station is busy. Message returned from slave station: Slave station is busy. (Please refer to Modbus exception 06).
348BHCOM5 slave does not support function codes. Check whether this function code is supported by the slave station. (Please refer to Modbus exception 01).
348CHCOM5 slave failure. Message returned from slave station: Slave station failed, please check whether slave station failed. (Please refer to Modbus exception 04).
348DHCOM5 slave station confirmation Message returned from slave station: slave station confirmation. (Please refer to Modbus exception 05).
348EHCOM5 does not currently support this instruction or function. When set to slave protocol, the communication instructions related to master station or master station functions cannot be used. Please change the protocol or close the contact before the corresponding instruction or close the corresponding communication function.
348FHCOM5 send timed out. If this error appears, please contact your technician.
34A0HCOM5 unavailable gateway Message returned from the station: unavailable gateway. (Please refer to Modbus exception 0A).
34A1HCOM5 indicates that no response was obtained from the target device. Message returned from the station: The device is not in the network. (Please refer to Modbus Exception 0B).
COM6
3580HCOM6 data reception error. There may be interference on the communication cable, it is recommended to connect GND.
3581HCOM6 data reception timed out. Check the wiring, whether the serial port parameter settings correspond to master and slave, and whether there is interference. Check whether the response from the station is too late. It is recommended to increase the “sending interval".
3582HCOM6 CRC validation error. There may be interference on the communication cable, it is recommended to connect GND.
3583HCOM6 LRC validation error. There may be interference on the communication cable, it is recommended to connect GND.
3584HCOM6 station number is incorrectly configured. Check the slave station number setting, and check whether there is any problem with the receiving and sending mechanism from slave.
3585HCOM6 send buffer overflow. If this error appears, please contact your technician.
3586HCOM6 function code error. Check whether the set function code is supported by PLC.
3587HCOM6 address error. Check whether the slave station has this address. (Please refer to Modbus exception 02).
3588HCOM6 length error. Check whether the communication length exceeds the length range specified by Modbus protocol or user-defined protocol.
3589HCOM6 data error. Check the parameters of the instruction for errors. Check whether the set value is supported by the slave station. (Please refer to Modbus exception 03).
358AHCOM6 slave station is busy. Message returned from slave station: Slave station is busy. (Please refer to Modbus exception 06).
358BHCOM6 slave does not support function codes. Check whether this function code is supported by the slave station. (Please refer to Modbus exception 01).
358CHCOM6 slave failure. Message returned from slave station: Slave station failed, please check whether slave station failed. (Please refer to Modbus exception 04).
358DHCOM6 slave station acknowledges. Message returned from slave station: slave station confirmation. (Please refer to Modbus exception 05).
358EHCOM6 does not currently support this instruction or function. When set to slave protocol, the communication instructions related to master station or master station functions cannot be used. Please change the protocol or close the contact before the corresponding instruction or close the corresponding communication function.
358FHCOM6 send timed out. If this error appears, please contact your technician.
35A0HCOM6 unavailable gateway Message returned from the station: unavailable gateway. (Please refer to Modbus exception 0A).
35A1HCOM6 indicates that no response was obtained from the target device. Message returned from the station: The device is not in the network. (Please refer to Modbus Exception 0B).

6 Address mapping

When the BD module configures the serial port protocol as Modbus slave station protocol, the address mapping relationship accessed by the master station is as follows:

Word address
Address typeOccupationAddress rangeDecimal addressTotal reserved address size
T0 to T511512 WORD0x0000 to 0x01ff01536
C0 to C255256 WORD0x0600 to 0x06ff15361024
LC0 to LC255512 WORD0x0A000 to 0x0BFF25601024
HSC0 to HSC15128 WORD0x0E00 to 0x0E1F3584512
D0 to D79998000 WORD0x1000 to 0x2F3F409616384
SD0 to SD40954096 WORD0x5000 to 0x5FFF2048012288
R0 to R3000030000 WORD0x8000 to 0xF52F3276830000
Bit address
Address typeOccupationAddress rangeDecimal addressTotal reserved address size
T0 to T511512 bits0x0000 to 0x01ff01536
C0 to C255256 bits0x0600 to 0x06ff15361024
LC0 to LC255256 bits0x0A00 to 0x0AFF25601024
HSC0 to HSC1564 bits0x0E00 to 0x0E0F3584512
M0 to M80008192 bits0x1000 to 0x2F3F409616384
SM0 to SM40954096 bits0x5000 to 0x5FFF2048012288
Reserved 0x8000 to 0xBFFF 16383
S0 to S40954096 bits0xC000 to 0xCFFF491528192
X0 to X10231024 bits0xE000 to 0xE3FF573444096
Y0 to Y10231024 bits0xF000 to 0xF3FF614404096

When using the Modbus master station to access the slave station, the RS2 instruction specifies the following address:

Example 1: Read 10 registers starting from slave station (station NO.1) D0 and store them in 10 devices starting from local D0:

image-20220913154229-8.png

The function code of this instruction is 3, which indicates reading register, and the address H1000 in it is the starting address of "D0 to D7999" by inquiring the "word address table", which corresponds to the address of D0.

Example 2: Read 10 bit devices starting from slave station (station NO.1) M0 and store them in local D0 device (because D0 can store the value of 16 bit devices, zero padding will be performed):

image-20220913154229-9.png

The function code of the instruction is 1, which indicates read coil, and the address H1000 in it is the starting address of “M0 to M8000" by inquiring the "bit address table", which corresponds to the address of M0. If slave stations M0 and M1 are 1, and the rest are 0, the value in D0 is H0300 (not H0003).

7 Special devices for BD module

BD1:

SD labelContentSD labelContent
SM2000COM3 sending control onSD2000Display 0x1062 after 485 BD is recognized after power-on.
SM2001COM3 send control/send promptSD2001Display 485BD version information after 485 BD is recognized after power-on.
SM 2002COM3 reception control onSD 2002BD1 last error
SM 2003COM3 accept control/receive promptSD 2003BD1 current error
SM2004COM3 communication complete flagSD2004BD1 error times
SM 2005COM4 sending control onSD 2005BD1 error communication port.
SM 2006COM4 send control/send promptSD2006BD1 communication timeout (1ms).
SM 2007COM4 reception control on  
SM2008COM4 accept control/receive prompt  
SM2009COM4 communication complete flag  

BD2:

SD labelContentSD labelContent
SM2020COM5 sending control onSD2020Display 0x1062 after 485 BD is recognized after power-on.
SM2021COM5 send control/send promptSD2021Display 485 BD version information after 485 BD is recognized after power-on.
SM 2022COM5 reception control onSD2022BD2 last error
SM2023COM5 accept control/receive promptSD2023BD2 current error
SM2024COM5 communication complete flagSD2024BD2 error times
SM2025COM6 sending control onSD2025BD2 error communication port.
SM2026COM6 send control/send promptSD2026BD2 communication timeout (1ms).
SM2027COM6 reception control on  
SM2028COM6 accept control/receive prompt  
SM2029COM6 communication complete flag  

8 Examples

Modbus RTU slave station

Configure COM3 port as Modbus RTU slave. COM3 parameters are configured as follows:

image-20220913154229-10.jpeg

Configure the station number to 1 and click OK, and the download program will take effect. (Ensure that the baud rate, data bit, stop bit and parity bit configuration are consistent with the master station)

Modbus RTU master station

Configure COM4 port as the Modbus RTU master station, and read the 125 word devices starting from the station address once every 100ms.

COM4 parameters are configured as follows:

image-20220913154229-11.jpeg

The station number is configured as 0 to indicate the master station protocol.

The ladder diagram is configured as follows:

image-20220913154229-12.jpeg

Dedicated protocol

Configure COM3 port as a dedicated protocol, and use this serial port to upload and download programs.

COM3 parameters are configured as follows:

image-20220913154229-13.jpeg

PLC Editor2 uses this serial port communication: PC uses USB to RS485 converter to connect with BD module at this time.

image-20220913154229-14.jpeg

image-20220913154229-15.jpeg

User-defined protocol

Configure COM3 port as user-defined protocol, and simulate Modbus RTU instruction. A read instruction is sent to the slave station every 100ms, to read 125 word devices starting from slave station address 0, and store the response data in D100 device, and judge whether the value of the word device at address 0 is 100. If yes, set M10 and reset M20; If not, set M20 and reset M10.

COM3 parameters are configured as follows:

image-20220913154229-16.jpeg

The ladder diagram is configured as follows:

image-20220913154229-17.jpeg

image-20220913154229-18.jpeg