BLOG / FIELDBUS

Modbus RTU on S7-1200: Integrating the Cheap and Cheerful Devices Properly

25 Şubat 2021 Modbus RTUS7-1200SerialIntegration

Energy meters, temperature controllers, small drives, water treatment skids — the world’s cheap-and-useful devices speak Modbus RTU. The S7 side is easy; the discipline is in the details.

The S7 mechanics

A CM1241 (RS-422/485) module plus two instructions: Modbus_Comm_Load configures the port (once, and again after port errors — put it in the error path, not just startup), Modbus_Master runs the transactions. One master instance per port, transactions strictly sequential — the architecture that works is a polling table: an array of jobs (slave, function, address, length, target) walked by a small state machine, with per-job error counters and a health bit per device. Resist the fifteen-parallel-requests style; serial Modbus is one conversation at a time.

Where the hours actually go

  • Register map archaeology: manuals lie by off-by-one (40001 vs address 0 conventions), by type (two registers as float vs long), and by byte order. Verify one known value (a voltage you can read on the meter’s display) before trusting fifty.
  • Word/byte order: Modbus is big-endian words, vendors freestyle the rest — SWAP as needed at one documented place, not sprinkled.
  • Timing: inter-frame gaps and slave response times set the real poll rate. Twenty devices at ten registers each poll comfortably in the seconds class — promise dashboards accordingly.

FAQ

How many slaves per CM1241? Electrically up to spec limits (with proper RS-485 practice); practically, poll-cycle time is the constraint before electronics.

RTU or jump straight to Modbus TCP? If the device offers TCP, take it — no port modules, faster, parallel. RTU remains for the devices and distances where serial is what exists.


Zone Otomasyon integrates meter parks and OEM skids into S7 systems weekly. Integration without folklore.