PortDock

Testing LS XGT dedicated protocol communication without a PLC — FEnet 2004, variable names, common mistakes

Test a PC program that talks to an LS XGT PLC over FEnet (TCP 2004) without the PLC, using PLC Simulator (from 0.10.0). %MW/%MX numbering, BCC, error codes.

Tools for this guidePLC Simulator Windows program · freeTCP Windows program · freeLS XGT Dedicated Protocol (FEnet) Frame Decoder web · no installIP Subnet Calculator web · no install

PC programs (C#/C++ host software, data collection, HMIs) often read and write LS ELECTRIC XGT PLC values through the FEnet module's XGT dedicated protocol. From 0.10.0 PortDock PLC Simulator answers this protocol too. This guide connects your program and the simulator on one PC through 127.0.0.1 and lists where people usually get stuck at first.

1. Set up the simulator

SettingChoose
Protocol«XGT dedicated (LS FEnet)» (from 0.10.0)
TransportTCP server or UDP — whichever your program uses
PortTCP 2004 · UDP 2005 — the dedicated service ports in manual 8.1.1. Switching the protocol sets them if the port is still a default
Bind address127.0.0.1 (default) — only programs on this PC can connect
Check header BCCOn by default — a request with a wrong BCC gets error h77

Pick device %DW at the top, put 0x1234 (4660) in %DW100 and press «Start» (F4). Devices P, M, K, F, T, C, D, L and N are all word tables (%PW, %MW …); bits, bytes and double words read the same table in other units.

2. Set up your program

3. First request — read one word %DW100

4C 53 49 53 2D 58 47 54 00 00 00 00 A0 33 01 00 10 00 00 3F 54 00 02 00 00 00 01 00 06 00 25 44 57 31 30 30

The first 20 bytes are the header; the rest is an individual read (instruction 54 00, data type WORD 02 00, reserved 00 00, 1 block 01 00, variable length 06 00, «%DW100»). If %DW100 holds 0x1234 in the simulator, the reply is:

4C 53 49 53 2D 58 47 54 00 00 00 01 A0 11 01 00 0E 00 00 1C 55 00 02 00 00 00 00 00 01 00 02 00 34 12

Source of frame is h11, invoke ID 01 00 is the request's, and the PLC info high byte 01 means RUN. The body is instruction 55 00 (read response), error status 00 00 (normal), 1 block, data size 2 and the value 34 12. The simulator's traffic log decodes it as «0054 Read (individual) WORD %DW100 · #0001» and «0055 ACK · blocks 1 · #0001».

Variable names and number units

VariableMeaning (in the simulator)
%MW100M word 100
%MX1603bit 3 of M word 100 — bit number = word × 16 + bit (decimal). Manual p. 8-12: %MX2764, not %MX172C
%MB200 · %MB201low · high byte of M word 100 — byte number = word × 2 (XBL-EMTA manual 5.2.4: %DW1234 = %DB2468)
%MD50 · %ML25M words 100–101 · 100–103 (low word first) — the simulator's choice, following the same rule
%DB0, continuous 6Continuous read/write takes a byte variable only, up to 1,400 bytes — %DW0–%DW2

Common mistakes

SymptomCheck
Cannot connectIs the simulator started and the port 2004? 127.0.0.1 accepts this PC only. For another PC, turn on «Allow other PCs to connect (0.0.0.0)» and allow the program in Windows Firewall
Requests arrive (RX) but no replyAn EV «IGNORED» line means the frame is shorter than the 20-byte header or the source of frame is not h33. Also check that the simulator is not started in «MC protocol»
Error h77The header BCC differs from the sum of the first 19 bytes. If your program leaves the BCC empty, test with «Check header BCC» off (the XBL-EMTA manual's table 5-6 example also differs from the header sum)
Error h76The header length field differs from the bytes that follow, or there are fewer variables than the block count
Error h75The company ID is not «LSIS-XGT» + 00 00 (or «LGIS-GLOFA»)
Error 2The data type field and the variable's type letter (X/B/W/D/L) differ, or the write data size differs from the type. Continuous (h14) takes %MB-style names only
Error 3The device letter is not P/M/K/F/T/C/D/L/N, or the number is not decimal (as in «%MX100.3»)
Error 4A number beyond the device size. Increase «Size» in the simulator (bits are word × 16, so they grow quickly)
Error h78An instruction other than read h0054 and write h0058 (status read h00B0 is not there yet)
Values land in the wrong placeCheck that %MX bits are not written as hex «word.bit», and byte numbers are not used as word numbers

Test the error handling too

What a simulator cannot tell you

PortDock PLC Simulator follows only the frame formats in LS ELECTRIC's public manuals and has not been compared with real hardware. No ladder program runs, timer/counter contacts and current values are not kept apart, and type/device combinations a real CPU refuses are accepted. Which error code is used for which condition, and the PLC info and CPU info values in the reply header, may differ from a real PLC. Use it to get the communication side ready and do the final test on the real PLC. Never run it on a plant network with the same IP and port as a real PLC.

This guide is based on LS ELECTRIC's public user's manuals (XGT FEnet and XGB FEnet); it is not affiliated with LS ELECTRIC.

Sources

Published 2026-10-31