Mitsubishi FX5U PLC Modbus TCP/IP Configuration Guide for Inverters & Power Meters
1. Modbus TCP/IP Protocol & MBAP Frame Architecture
The Mitsubishi MELSEC iQ-F (FX5U) series features an onboard 100Mbps Ethernet interface natively supporting standard Modbus/TCP. This enables high-speed data acquisition from third-party equipment—such as digital power meters, multi-loop temperature controllers, and variable frequency drives—without relying on auxiliary communication modules like the FX5-ENET. Under Modbus TCP, traditional RTU frames are wrapped in a 7-byte MBAP (Modbus Application Protocol) Header: - Transaction Identifier (2 Bytes): Tracks request/response transaction pairing - Protocol Identifier (2 Bytes): Always `0x0000` for Modbus - Length Field (2 Bytes): Remaining byte count in the frame - Unit Identifier / Slave ID (1 Byte): Target device address All transactions route over standard TCP Port 502.
2. Systematic GX Works3 Parameter Configuration
- Open Module Parameters: In GX Works3 Navigation tree, double-click `Parameter > FX5UCPU > Module Parameter > Ethernet Port`
- Assign PLC Node IP: Under `Basic Settings > Own Node Settings`, specify a static IP address (e.g. `192.168.3.250`) and Subnet Mask `255.255.255.0`
- Launch Network Topology: Under `Application Settings > External Device Configuration`, click `Detailed Setting`
- Deploy Modbus Module: From the right-hand palette, drag `Ethernet Device > Modbus/TCP Connection Module` into the connection table
- Define Communication Role: Select Master (Client) or Slave (Server). To query external meters, set communication method to `Master`
- Configure Target Destination: Input target slave IP address (e.g. `192.168.3.50`) and destination TCP port `502`
- Validate & Download: Click `Check` to verify configuration syntax, click `Apply`, and execute `Write to PLC`
3. Modbus Function Codes vs GX Works3 Instructions
| Function Code | Modbus Operation | FX5U Dedicated Instruction | Register Address Offset Range |
|---|---|---|---|
| 01 (0x01) | Read Coils | SP.MBDATAR (Mode 1) | 00001 - 09999 (Discrete Bit Output) |
| 02 (0x02) | Read Discrete Inputs | SP.MBDATAR (Mode 2) | 10001 - 19999 (Discrete Bit Input) |
| 03 (0x03) | Read Holding Registers | SP.MBDATAR (Mode 3) | 40001 - 49999 (Word Read/Write) |
| 04 (0x04) | Read Input Registers | SP.MBDATAR (Mode 4) | 30001 - 39999 (Word Read-Only) |
| 05 / 06 | Write Single Coil / Register | SP.MBDATAW (Mode 5/6) | Single bit or single word write |
| 16 (0x10) | Write Multiple Registers | SP.MBDATAW (Mode 16) | Contiguous multi-word block write |
4. Ladder Logic Architecture: Read Holding Registers (FC03)
To poll power meter metrics, engineers populate an 11-word control array in PLC data registers (e.g. `D1000` to `D1010`) before executing the dedicated `SP.MBDATAR` command:
// --- Control Data Table Structure (D1000) ---
D1000 = H0001 (Channel Selector: Connection Ch1)
D1001 = K1 (Target Station / Slave ID: Meter 1)
D1002 = K3 (Function Code 03: Read Holding Registers)
D1003 = H0100 (Starting Register Offset: 0x0100 = Phase-A Voltage)
D1004 = K2 (Requested Word Count: 2 Words for 32-bit Float)
D1005 = K3000 (Communication Timeout: 3000 ms)
// --- Ladder Execution Instruction ---
[SP.MBDATAR "U0\G0" D1000 D2000 M100]
// D2000 = Destination buffer for raw polled register data
// M100 = Execution Completion Flag (Pulses ON for 1 scan)
// M101 = Fault Flag (Turns ON if communication fails)5. Error Handling & Socket Starvation Prevention
A frequent pitfall in industrial Modbus TCP networks is Socket Starvation. When a field device drops offline, looping unconditioned execution requests rapidly consumes all available TCP sockets (FX5U supports up to 8 simultaneous connections). Robust architecture mandates: 1. Interlocking execution with the completion bit `M100` and error bit `M101`, enforcing an idle delay timer of 50 to 100 milliseconds between successive queries. 2. Monitoring diagnostic register `SD8500` (for Channel 1). When error codes such as `0x7140` (Connection Timeout) or `0x7141` (Invalid Frame) trigger, the PLC initiates a socket close sequence to prevent system lockups.