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
| Setting | Choose |
|---|---|
| Protocol | «XGT dedicated (LS FEnet)» (from 0.10.0) |
| Transport | TCP server or UDP — whichever your program uses |
| Port | TCP 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 address | 127.0.0.1 (default) — only programs on this PC can connect |
| Check header BCC | On 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
- Connect to 127.0.0.1, port 2004 (TCP).
- 20-byte header: company ID «LSIS-XGT» + 00 00, PLC info 00 00, CPU info (ignored in requests — A0 in the example below), source of frame h33, invoke ID (echoed in the reply), length (bytes after the header), FEnet position, BCC (sum of the first 19 bytes).
- Numbers go low byte first (little-endian) — instruction h0054 is 54 00, length 16 is 10 00.
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».
- No program yet? Send the bytes above as HEX with the client in PortDock TCP and watch the reply.
- To see whether the bytes your program sends are right, paste them into the web tool «LS XGT Dedicated Protocol Frame Decoder». It decodes the header, variables and values and shows which error code the simulator would return.
Variable names and number units
| Variable | Meaning (in the simulator) |
|---|---|
| %MW100 | M word 100 |
| %MX1603 | bit 3 of M word 100 — bit number = word × 16 + bit (decimal). Manual p. 8-12: %MX2764, not %MX172C |
| %MB200 · %MB201 | low · high byte of M word 100 — byte number = word × 2 (XBL-EMTA manual 5.2.4: %DW1234 = %DB2468) |
| %MD50 · %ML25 | M words 100–101 · 100–103 (low word first) — the simulator's choice, following the same rule |
| %DB0, continuous 6 | Continuous read/write takes a byte variable only, up to 1,400 bytes — %DW0–%DW2 |
Common mistakes
| Symptom | Check |
|---|---|
| Cannot connect | Is 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 reply | An 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 h77 | The 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 h76 | The header length field differs from the bytes that follow, or there are fewer variables than the block count |
| Error h75 | The company ID is not «LSIS-XGT» + 00 00 (or «LGIS-GLOFA») |
| Error 2 | The 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 3 | The device letter is not P/M/K/F/T/C/D/L/N, or the number is not decimal (as in «%MX100.3») |
| Error 4 | A number beyond the device size. Increase «Size» in the simulator (bits are word × 16, so they grow quickly) |
| Error h78 | An instruction other than read h0054 and write h0058 (status read h00B0 is not there yet) |
| Values land in the wrong place | Check that %MX bits are not written as hex «word.bit», and byte numbers are not used as word numbers |
Test the error handling too
- «Response delay (ms)» exercises your timeout; «Do not respond» your retry handling.
- Pick an XGT error code (1–6, h75–h78) in «Reply with end code» to get a NAK (error status FFFF) with that code. Writes are not applied then.
- Narrow the target with 0054/0058 in Commands and names such as %DW in Devices.
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
- LS ELECTRIC XGT FEnet I/F Module User's Manual V2.30 — chapter 8 dedicated communication (pp. 8-1–8-14: ports 2004/2005, header, instructions h0054/h0058, data types, individual and continuous read/write), 10.4 error codes (p. 10-12)
- LS ELECTRIC XGB FEnet I/F Module XBL-EMTA User's Manual V1.8 — 5.2 XGT dedicated protocol (pp. 5-3–5-7): header table, two company IDs, byte address = word × 2, request/response frame examples (tables 5-6–5-9)
Published 2026-10-31