MODBUS
MODBUS
MODBUS RTU Master
Supported Series: MODBUS RTU CONTROLLER
HMI works as MODBUS SLAVE connecting with MASTER
HMI Settings
Items | Settings | Note |
Protocol | MODBUS RTU Master | |
Connection | RS485/RS232 | |
Baud rate | 2400~187500 | |
Data bit | 8 | |
Parity | Even/ Odd/ None | |
Stop bit | 1/2 | |
Station No. | 0~255 |
Address List
Type | HMI address | MODBUS code | Range |
Bit | HDX3000.0~HDX3499.15 | 0 | 0~7999 |
Word | HDW3500~HDW7999 | 4 | 0~4499 |
Cable Wiring
- RS485
- RS232
✎Note: COM3 only available in PI8000/PI9000 series.
MODBUS RTU Slave (All function)/(All function OneBaseAddress)
Supported Series: MODBUS RTU CONTROLLER
HMI works as MODBUS MASTER connecting with SLAVE.
The addresses in [All function] start from 0, while the addresses in [All function OneBaseAddress] start from 1 (offset 1).
HMI Settings
Items | Settings | Note |
Protocol | MODBUS RTU Slave (All function)/( All function OneBaseAddress) | |
Connection | RS485/RS232 | |
Baud rate | 2400~187500 | |
Data bit | 8 | |
Parity | Even/ Odd/ None | |
Stop bit | 1/2 | |
PLC station No. | 0~255 |
Address List
Type | Address Type | Function code & Description |
Word | 3 | 04 (read input register: read current binary value in one or more input registers) |
06 (write single register: write a binary value to a holding register) | ||
10 (write values to multiple addresses ) | ||
4 | 03 (read holding register: read current binary value in one or more holding registers) | |
06 (write single register: write a binary value to a holding register) | ||
10 (write values to multiple addresses ) | ||
W6 | 03 (read holding register: read current binary value in one or more holding registers) | |
06 (write single register: write a binary value to a holding register) | ||
10 (write values to multiple addresses ) | ||
W16 | 03 (read holding register: read current binary value in one or more holding registers) | |
10 (write values to multiple addresses ) | ||
Bit | 0 | 01 (Read coil state) |
05 (Force a single coil to force the on/off state of a logic coil) | ||
0F (Write multiple bits, ie write continuously) | ||
1 | 02 (Read the input state) | |
05 (Force a single coil to force the on/off state of a logic coil) | ||
0F (Write multiple bits) | ||
W5 | 01 (Read coil state to obtain the current state of a set of logic coils) | |
05 (Force a single coil to force the on/off state of a logic coil) | ||
0F (Write multiple bits) | ||
W15 | 01 (Read coil state to obtain the current state of a set of logic coils) | |
0F (Write multiple bits) |
✎Note:
- Modbus can also support getting bit from the word, which could access the address such as 100.1 and other formats.
- The function codes sent out are the same as those that read and write words.
Station number for more than one slaves
If there are more than one slaves connected to HMI, please set slave station number during editing address, as below shows.
Cable Wiring
- RS485
- RS232
✎Note: COM3 only available in PI8000/PI9000 series.
Modbus ASCII Slave
Supported Series: MODBUS ASCII CONTROLLER
HMI works as MODBUS MASTER connecting with SLAVE.
The addresses in [All function] start from 0
HMI Settings
Items | Settings | Note |
Protocol | MODBUS (ASCII) Slave | |
Connection | RS485/RS232 | |
Baud rate | 2400~187500 | |
Data bit | 8 | |
Parity | Even/ Odd/ None | |
Stop bit | 1/2 | |
PLC station No. | 0~255 |
Address List
Type | Address Type | Function code & Description |
Word | 3 | 04 (readinput register:read current binary valenone ormore input reisters) |
06 (write single register: write abinary value to a holding register) | ||
10 (write values to multiple addresses | ||
4 | 03(readoldingegister:readcurrent binaryvaluinnermreolingregistes) | |
06 wite sinleregisterwrite abinary valetaholding register) | ||
10 (write values to multiple addresses ) | ||
Bit | 0 | 01 (Read coil state) |
05 (Force a single coil to force the on/off state of a logic coil) | ||
0F (Write multiple bits, ie write continuously) | ||
1 | 02 (Read the input state) | |
05(Force a single coil to force the on/ofstate ofalogic coil | ||
0F (Write multiple bits) | ||
3 | Get bit from word address | |
4 | Get bit from word address |
Message
The communication message of this protocol is sent in ASCII format instead of HEX, but its overall message format is similar to HEX.
Cable Wiring
- RS485
- RS232
Modbus Meter
The following example is using the Linfee meter LNF96EY to demonstrate how to set up the Modbus communication.
1. Wiring the RS485 cable first. Because the pin 58 is A, the pin 59 is B for meter. Here we use the COM1 to connect. So the diagram like follows:
2. Check the specific Modbus parameter in the communication menu from LED display.
So from the following pictures, we can know the Meter Address is 85, Baud rate is 9600, CRC None.
✎Note: Meter address usually corresponding to the Device No. in the PIStudio Communication settings.
3. Create new project and change the Communication settings.
Set the protocol as MODBUS RTU Slave (All Function), set Device No. as 85. And COM port setting as 9600, 1, 8, NONE.
4. Drag the numeric input into screen, and fill in the Modbus Address we want to read according to manual
The following table is intercept part of the manual for Linfee Modbus manual.
0x03/0x04 command data register address:
Address | Description | Data Format | Data Length(Word) | Remark | |
---|---|---|---|---|---|
HEX | DEC | ||||
0x00 | 0 | Reserved | |||
0x02 | 2 | Reserved | |||
0x04 | 4 | Reserved | |||
0x06 | 6 | Ua | float | 2 | Phase Voltage data, Unit V |
0x08 | 8 | Ub | float | 2 | Phase Voltage data, Unit V |
0x0A | 10 | Uc | float | 2 | Phase Voltage data, Unit V |
0x0C | 12 | Uab | float | 2 | Line Voltage data, Unit V |
0x0E | 14 | Ubc | float | 2 | Line Voltage data, Unit V |
0x10 | 16 | Uca | float | 2 | Line Voltage data, Unit V |
0x12 | 18 | Ia | float | 2 | Phase Current data, Unit A |
0x14 | 20 | Ib | float | 2 | Phase Current data, Unit A |
0x16 | 22 | Ic | float | 2 | Phase Current data, Unit A |
✎Note: We usually use the Address Type 4 for read the Modbus registers(Function Code 03)
For example, here we want to read the Phase Voltage Ua (Modbus offset 0006), the Address No. requires input decimal number, and check whether the actual address has one address offset, so the address set like the following screenshot:
Set the Read-Write type for address, because meter only to measuring the data, so set it as read-only, and floating data format.
Then download into HMI, if the HMI COM led is blinking and no timeout message show, which means the communication is setup successfully.
MODBUS TCP Slave (All function)
Supported series: MODBUS TCP controller
Note: Although the protocol selected for the HMI is MODBUS TCP Slave, the HMI is working as a MODBUS TCP Master connected to TCP SLAVE.
HMI Setting
Items | Settings | Note |
Protocol | MODBUS TCP Slave (All function) | |
Connection | Ethernet | |
Port No. | 502 | |
PLC station No. | 1 |
Address List
Type | Register | Function code & Description |
Word | 3 | 04 (read input register: read current binary value in one or more input registers) |
06 (write single register: write a binary value to a holding register) | ||
10 (write values to multiple addresses ) | ||
4 | 03 (read holding register: read current binary value in one or more holding registers) | |
06 (write single register: write a binary value to a holding register) | ||
10 (write values to multiple addresses ) | ||
W6 | 03 (read holding register: read current binary value in one or more holding registers) | |
06 (write single register: write a binary value to a holding register) | ||
10 (write values to multiple addresses ) | ||
W16 | 03 (read holding register: read current binary value in one or more holding registers) | |
10 (write values to multiple addresses ) | ||
Bit | 0 | 01 (Read coil state) |
05 (Force a single coil to force the on/off state of a logic coil) | ||
0F (Write multiple bits, ie write continuously) | ||
1 | 02 (Read the input state) | |
05 (Force a single coil to force the on/off state of a logic coil) | ||
0F (Write multiple bits) | ||
W5 | 01 (Read coil state to obtain the current state of a set of logic coils) | |
05 (Force a single coil to force the on/off state of a logic coil) | ||
0F (Write multiple bits) | ||
W15 | 01 (Read coil state to obtain the current state of a set of logic coils) | |
0F (Write multiple bits) |
Communication Settings
Enable HMI Ethernet in [Project Settings];
Set PLC IP in [Device IP] settings;
Cable Wiring