With the theory this far, Ms. Wang's gateway is "yours to assemble". Open the Lab page—it is not a simulator but a real message encoder/decoder: you pick the parameters and it generates standard bytes; you paste hex and it takes it apart byte by byte. Every action you practise here is exactly the action you will perform later when debugging real devices with Modbus tools.
A frame you assembled yourself is the only knowledge you truly own. Being unable to read a capture, or not knowing which parameters to fill in a tool, is usually because you never "put your hands on it" in the Lab.
Two easily forgotten points to review: big-endian order—the high byte of a 16-bit value comes first (100 = 00 64); bit packing—coil responses are stored by bit, least significant bit first within a byte (0x0B = coils 0, 1 and 3 on).
Task: write the humidity target 60 (0x003C) into holding register 0x0001 of slave 1 (RTU). After the five steps, the complete frame the Lab produces is:
01
06
00 01
00 3C
D8 1B
| Byte | Value | Meaning |
|---|---|---|
| 0 | 01 | Slave 1 |
| 1 | 06 | Function code: Write Single Register |
| 2–3 | 00 01 | Register address |
| 4–5 | 00 3C | Value written = 60 |
| 6–7 | D8 1B | CRC-16 |
The response should echo this frame verbatim—when you see a matching echo, the write succeeded.
01 03 00 00 00 02 C4 0B;01 06 00 01 00 3C D8 1B;Use FC 01 to read 10 coils from 0x0000: expected request 01 01 00 00 00 0A BC 0D. Map the bits in the response to the states of "exhaust fan, water pump, shade curtain" (bit 0 = exhaust fan, bit 1 = water pump, bit 2 = shade curtain, and so on).
Then try FC 05 to write coil 0x0000 to ON: expected request 01 05 00 00 FF 00 8C 3A—remember that ON for a coil write is FF 00, not 00 01.
(All the exercises above stay within FC 01/03/05/06, which the Lab supports; FC 02/04/15/16 are not required hands-on in this course.)
This chapter is the Lab itself. After finishing the three task cards, you can also:
In this chapter you assembled four kinds of requests by hand—read a temperature, write a setpoint, read status, switch a device on—and verified every byte with the decoder. You now have the most critical link between "framing on paper" and "commissioning on real hardware".
In the next chapter (Chapter 9), we pull the camera back to Ms. Wang's greenhouse—connecting to a real TCP slave and turning theory into data moving on your screen.