Functional description
You can change the value of D8400/D8420 to select MODBUS-RTU protocol, RS free port protocol (RS485-1), RS2 free port protocol (RS485-2), and select the corresponding communication parameters. (When the PLC stops running, switch to the programming port protocol)
RS485-1/RS485-2 communication port default programming port protocol, communication parameters: 19200, 7, E, 1.
RS485 Communication Parameter Setting Table
You can calculate it yourself through the following table, or automatically calculate it through auxiliary software
LK Assist Tool

D8400 (RS485-1) / D8420 (RS485-2) Parameter Settings Table
| Bit Position | Description | 0 (bit=0FF) | 1 (bit=ON) | Notes |
|---|---|---|---|---|
| bit0 | Data Length | 7 bits | 8 bits | |
| bit1 | Parity Mode | No parity | Parity enabled | 0 – No parity, 1 – Parity |
| bit2 | Parity Type | Odd (ODD) | Even (EVEN) | 0 – Odd, 1 – Even |
| bit3 | Stop Bits | 1 stop bit | 2 stop bits | |
| bit4 | Baud Rate (low bits) | 300 | 9600 | |
| bit5 | Baud Rate (middle bits) | 600 | 19200 | |
| bit6 | Baud Rate (high bits) | 1200 | 38400 | |
| bit7 | Baud Rate (highest bits) | 2400 | 57600 | |
| bit8~bit11 | Disabled | Set to 0 | ||
| bit12 | FX Programming Port Protocol | Disabled | FX Protocol | 0 – No protocol, 1 – Protocol |
| bit13 | RS Communication (RS485-1 specific) | Disabled | Enabled RS485-1 | |
| bit14 | MODBUS-RTU Protocol | Disabled | Enabled | |
| bit15 | Disabled | Set to 0 |
Additional Notes:
- When the data length is set to 7 bits, parity cannot be set to “No parity”, otherwise error code 6304 will occur.
- For Programming Port Protocol, the fixed parameters are: data length is 7 bits, 1 stop bit, and even parity. Baud rate can be configured.
- For MODBUS-RTU protocol, RS free port protocol, and RS2 free port protocol, all parameters (data length, stop bits, parity, baud rate) can be configured.
- If D8400 or D8420 does not have MODBUS-RTU master functionality enabled and the ADPRW instruction is used, error code 6706 will occur.
- D8401/D8421 set to H0 selects the MODBUS master protocol.
- D8401/D8421 set to H10 selects the MODBUS slave protocol.
RS485 MODBUS RTU Commands Special M and D Register Function Description
MODBUS-RTU Master/Slave Protocol Supported Function Codes
| Function | Command | Supported Soft Element Types | Bit Elements | Word Elements |
|---|---|---|---|---|
| Bit Read Command | 1 (H1), 2 (H2) | X, Y, M, S, T, C, Special M | X, Y, M, S, T, C, Special M | |
| Bit Write Command | 5 (H5) | Y, M, S, T, C, Special M | Y, M, S, T, C, Special M | |
| Register Read Command | 3 (H3), 4 (H4) | X, Y, M, S, T, C, Special M | X, Y, M, S, T, C, Special M | D, T, C, Special D |
| Register Write Command | 6 (H6) | Y, M, S, T, C, Special M | Y, M, S, T, C, Special M | D, T, C, Special D |
| Register Batch Write Command | 16 (H10) | Y, M, S, T, C, Special M | Y, M, S, T, C, Special M | D, T, C, Special D |
RS485-1 / RS485-2 ADPRW Instruction (MODBUS-RTU Protocol) Special M Relay Function Description
| RS485-1 | RS485-2 | Name | Active Station | Detailed Description | Attribute |
|---|---|---|---|---|---|
| M8410 | RS485-1/2 ADPRW Instruction Switching | Master Station | OFF: RS485-1 uses the ADPRW instruction. ON: RS485-2 uses the ADPRW instruction. | R/W | |
| M8029 | Instruction Execution Complete | Master Station | OFF: The instruction is not being executed or is not yet completed. ON: The instruction has been completed. | R | |
| M8401 | M8421 | MODBUS Communication Active | Master Station | ON: MODBUS communication is active. | R |
| M8402 | M8422 | MODBUS Communication Error Occurred | Master/Slave | ON: MODBUS communication error occurred. | R |
| M8403 | M8423 | MODBUS Communication Error Latched | Master/Slave | ON: MODBUS communication error latched when an error occurs. | R |
| M8408 | M8428 | Retry Occurred | Master Station | ON: Set when the slave station does not respond in time and the master station sends a retry. | R |
| M8409 | M8429 | Timeout Occurred | Master Station | ON: Set when a response timeout occurs. | R |
RS485-1 / RS485-2 ADPRW Instruction (MODBUS-RTU Protocol) Special D Register Functions
| RS485-1 | RS485-2 | Name | Active Station | Detailed Description | Attribute |
|---|---|---|---|---|---|
| D8400 | D8420 | Protocol Selection and Communication Parameters | Master/Slave | Sets the communication format. R/W: Value H0 selects MODBUS master protocol. | R/W |
| D8401 | D8421 | MODBUS Protocol Selection | Master/Slave | R/W: Value H10 (K16) selects MODBUS slave protocol. | R/W |
| D8402 | D8422 | Communication Error Code | Master/Slave | Stores the latest error code encountered during MODBUS communication. | R |
| D8403 | D8423 | Error Details | Master/Slave | Stores detailed information about the most recent error. | R |
| D8404 | D8424 | Step Number of Communication Error | Master Station | Stores the step number of the first ADPRW instruction where an error occurred. | R |
| D8407 | D8427 | Step Number during Communication | Master Station | Stores the step number of the ADPRW instruction during communication. If not executed, stores 0. | R |
| D8408 | D8428 | Current Retry Count | Master Station | Stores the current retry count when communication retries are triggered due to slave response timeout. | R |
| D8409 | D8429 | Slave Response Timeout | Master Station | If the slave does not respond within the set time, it retries the request or considers it a timeout. | R/W |
| Setting range: 0–32767, 1=10ms. Timeout is 3 seconds if set to 0. | |||||
| D8410 | D8431 | Send Delay | Master/Slave | Delay before sending data back after receiving it. Setting range: 0–16382, 1=1ms. Default: 10ms. | R/W |
| D8412 | D8432 | Retry Count | Master Station | Number of retries if the slave fails to respond in the specified timeout period. Range: 0–20 times. | R/W |
| D8414 | D8434 | Slave Station Number | Slave Station | Stores the slave station number. Range: 1–247. | R/W |
| D8063 | D8438 | Serial Communication Error Code | Master/Slave | Stores the error code corresponding to the serial communication error that occurred. | R |
| D8419 | D8439 | Operation Mode Display | Master/Slave | 0: FX programming port communication 4: RS command 5: RS2 command 19: MODBUS master 29: MODBUS slave | R |
MODSBU RTU Description (Master)
MODBUS RTU Master Program Download
Preparation
- Prepare the equipment:
- A USB-to-RS485 communication cable to connect the computer to the slave device.
- A serial debugging tool (such as a serial assistant or any similar software).
- Install drivers:
- Connect the USB-to-RS485 cable to the computer and install the corresponding USB driver to ensure the communication port (COM port) is recognized by the computer in the device manager.
- Check hardware connections:
- Ensure that the wiring of the USB-to-RS485 cable is correct, with the A and B terminals properly connected to the RS485 interface of the slave device.
Procedure
Open the serial assistant:
Open the serial assistant software on the computer and select the COM port corresponding to the USB-to-RS485 cable.
Set the communication parameters (baud rate, data bits, stop bits, parity, etc.) to match the slave device. Common MODBUS RTU parameters are:
Baud rate: 9600 or 19200
Data bits: 8 bits
Stop bits: 1 stop bit
Parity: None or Even
Send MODBUS RTU messages:
Use the serial assistant to send the required MODBUS RTU messages to the slave device. You can start by sending a simple query (like reading a register) to test the communication.
Ensure the format of the message is correct. For example, to read a register, the function code is 0x03, and the message structure should include the slave address, function code, data length, CRC checksum, etc.
Monitor the returned messages:
After sending the message, the serial assistant should display the response message from the slave device. This allows you to verify whether the returned data matches your expectations (e.g., whether the slave has successfully responded or if the message format is correct).
If there is no response or an error message is returned, the issue may be with the communication parameters or wiring.
Verify communication parameters and wiring:
If no expected response is received, use the serial assistant to send simple messages step by step to monitor the communication on the RS485 bus and troubleshoot issues with communication parameters or wiring.
Connect to PLC:
Use the USB-to-RS485 cable to connect the PC to the PLC. If an additional 232 port is required, prepare a USB-to-RS232 cable.
Download the appropriate PLC test program (e.g., 485-1 master or 485-2 master case) and load the corresponding PLC program based on the required communication port.
Modify PLC communication parameters:
Set the communication parameters in the PLC program to match those of the slave device.
Use the PLC’s read/write instruction (e.g., ADPRW) to communicate with the slave device by sending read and write commands.
Monitor the messages from the PLC:
After downloading the PLC program to the PLC, power off, and power it back on to ensure the PLC has fully initialized.
When you enable the M0 bit in the PLC, the serial assistant should show the MODBUS RTU messages sent from the PLC, allowing you to verify whether the messages are as expected.

Adjust and confirm successful communication:
If the communication messages between the PLC and the slave device are correct, and the data can be successfully read and written, the communication parameters and wiring are confirmed to be correct.
If the messages are not as expected, continue monitoring with the serial assistant and adjust the communication parameters until successful communication is achieved.

MODSBU RTU Description (Slave)
3U Series MODBUS RTU Slave Case Download
Selecting the Appropriate Communication Port
- Using Port 2 as the PLC Slave:
- Choose the 485-2 MODBUS RTU slave program.
- Download the sample program directly without modifications.
- Using Port 1 as the PLC Slave:
- Choose the 485-1 MODBUS RTU slave program.
- Similarly, download the sample program directly without modifications.
Debugging Process
1. Check Communication Parameters and Wiring:
- If no response is received in the receive area after sending a message, first check whether the communication parameters (baud rate, data bits, stop bits, parity, etc.) between the master and slave are consistent.
- Ensure that the wiring is correct, particularly the A and B lines of the RS485 connection.
2. Download the PLC Program:
- After downloading the PLC program to the PLC, power off the PLC and wait for all indicator lights to turn off completely. Then power it back on to ensure the PLC has been reset properly.
3. Check the PLC’s Running Status:
- When the PLC’s RUN light starts flashing, it indicates the PLC is in RUN mode. If the Y0 light is illuminated, this indicates communication has been successful. You can reset the PLC, and if the Y0 light turns off, it confirms that the MODBUS RTU slave configuration is successful.
4. Use the LK Auxiliary Tool for Communication Testing:
- If no response is received after sending a message, use the serial assistant to debug and ensure the message format is correct, and the communication parameters match.

5. Example Communication Messages:
- Reading Data from the PLC:
- Serial send:
01 03 00 00 00 01 84 0A - PLC response:
01 03 81 80 42 6E F0
- Serial send:
- Writing Data to the PLC (Write 8 to D0 register):
- Serial send:
01 06 00 00 00 08 88 0C - PLC response:
01 06 00 00 00 08 88 0C
- Serial send:
- Setting Y0 to 1:
- Serial send:
01 05 33 00 FF 00 83 7E - PLC response:
01 05 33 00 FF 00 83 7E
- Serial send:
Debugging the PLC Slave Communication Using a Serial Assistant
Configure the Serial Assistant:
Open the serial assistant and select the COM port that corresponds to the communication port used by the PLC.
Set the communication parameters (baud rate, data bits, stop bits, parity, etc.) to match those of the PLC slave.

Send MODBUS RTU Messages:
Use the serial assistant to send messages formatted according to the MODBUS RTU protocol. For example, you can send a read or write message to test the response from the PLC slave.
Check the Returned Messages:
If the PLC correctly receives the message from the master, it will return a corresponding response message. You can then debug and confirm whether the response is as expected based on the data returned.
MODBUS RTU (slave address correspondence table)
- Address Representation:
- In PLCs, addresses are often represented in hexadecimal, while SCADA systems (such as Kingview) or HMIs typically display addresses in decimal.
- Example:
- Y0 in PLC has a hexadecimal address of
0x3300, which equals13056in decimal.
- Y0 in PLC has a hexadecimal address of
- Address Offset (+1 Adjustment):
- In some communication protocols (e.g., MODBUS), the starting address is 1-based, meaning the first register starts from 1, not 0.
- As a result, when configuring the upper-level system (SCADA/HMI), you need to add 1 to the PLC’s internal address.
- Example:
- Y0 in PLC:
13056(decimal). - In SCADA: the address would be
13057(after adding 1).
- Y0 in PLC:
Bit vs. Word Elements and Address Mapping
- Bit Elements (M Area):
- Bit elements are stored individually, with each address representing 1 bit.
- Example:
- M0-M7679 corresponds to hexadecimal addresses
0x0000-0x1DFF. - A total of 7,679 bits are stored, with each address occupying 1 bit.
- M0-M7679 corresponds to hexadecimal addresses
- Word Elements (D Area):
- Word elements are stored as 16-bit registers. Each address in the word element refers to a block of 16 bits (or 2 bytes).
- Example:
- D0 has an address of
0x0000(decimal0). - D10 has an address of
0x000A(decimal10).
- D0 has an address of
- Address Overlap:
- Bit and word elements may appear to overlap in address ranges, but they are stored differently:
- Bit elements are accessed individually by bit.
- Word elements are accessed in blocks of 16 bits.
- Different function codes are used for reading and writing bit elements versus word elements, even if their addresses seem similar.
- Bit and word elements may appear to overlap in address ranges, but they are stored differently:
Register Address Calculation
- Example Address Range:
- If the register address range is from
0xA478to0xA657, there are 481 registers in total. - Since each register holds 16 bits, the total number of bits is:
481 * 16 = 7679bits, which corresponds to theM0-M7679bit elements range.
- If the register address range is from
RS485-1/RS485-2 MODBUS-RTU slave protocol soft component addresses:
| Component Type | PLC Component Address | MODBUS-RTU Address (Hex) | Address Range | Read/Write |
|---|---|---|---|---|
| Bit Components | M0~M7679 | 0x0000~0x1DFF | 0~7679 | Read-Only |
| M8000~M8511 | 0x1E00~0x1FFF | 8000~8511 | Read/Write | |
| S0~S4095 | 0x2000~0x2FFF | 0~4095 | Read/Write | |
| TS0~TS511 | 0x3000~0x31FF | 0~511 | Read/Write | |
| CS0~CS255 | 0x3200~0x32FF | 0~255 | Read/Write | |
| Y0~Y377 | 0x3300~0x33FF | 0~377 | Read/Write | |
| X0~X377 | 0x3400~0x34FF | 0~377 | Read/Write | |
| Word Components | D0~D7999 | 0x0000~0x1F3F | 0~7999 | Read-Only |
| D8000~D8511 | 0x1F40~0x213F | 8000~8511 | Read/Write | |
| TN0~TN511 | 0xA140~0xA33F | 0~511 | Read/Write | |
| CN0~CN199 | 0xA340~0xA407 | 0~199 | Read/Write | |
| CN200~CN255 (32-bit) | 0xA408~0xA477 | 200~255 | Read/Write | |
| M0~M7679 | 0xA478~0xA657 | 0~7679 | Read/Write | |
| M8000~M8511 | 0xA658~0xA677 | 8000~8511 | Read/Write | |
| S0~S4095 | 0xA678~0xA777 | 0~4095 | Read/Write | |
| TS0~TS511 | 0xA778~0xA797 | 0~511 | Read/Write | |
| CS0~CS255 | 0xA798~0xA7A7 | 0~255 | Read/Write | |
| Y0~Y377 | 0xA7A8~0xA7B7 | 0~377 | Read/Write | |
| X0~X377 | 0xA7B8~0xA7C7 | 0~377 | Read/Write |
RS program
Program includes 485-1RS 485-2RS
RS Freeport Program Download
RS485-1 (RS Command) Special M Relays and D Registers
| Relay/Register | Function |
|---|---|
| M8401 | RS command sending in progress indicator |
| M8402 | RS command sending request indicator |
| M8403 | RS command receiving completion indicator |
| M8409 | Communication timeout indicator |
| M8161 | 8/16-bit processing mode (ON = 8-bit, OFF = 16-bit) |
| D8400 | Protocol selection and communication parameter setting |
| D8402 | RS command sent data remainder |
| D8403 | Number of RS command received data |
| D8409 | RS command reception timeout setting (1 = 10ms) |
| D8419 | Indicator of protocol currently executing on port |
RS485-2 (RS2 Command) Special M Relays and D Registers
| Relay/Register | Function |
|---|---|
| M8421 | RS2 command sending in progress indicator |
| M8422 | RS2 command sending request indicator |
| M8423 | RS2 command receiving completion indicator |
| M8429 | Communication timeout indicator |
| D8420 | Protocol selection and communication parameter setting |
| D8422 | RS2 command sent data remainder |
| D8423 | Number of RS2 command received data |
| D8429 | RS2 command reception timeout setting (1 = 10ms) |
| D8439 | Indicator of protocol currently executing on port |