Explainer
How a PLC-5 block transfer feeds Modbus data to a master
Short answer
A Modbus module in a PLC-5 rack answers a master from its own database only: the function code and start address select a location in the module's configured map, and the module returns whatever sits there. Your ladder fills that database with block-transfer writes and empties it with block-transfer reads, so prove the map, then the transfer logic, then the master's request, in that order.
On this page
The module never looks at your I/O image. A Modbus module in a PLC-5 rack answers a master from one place only: its own internal database. The request's function code and start address select a location in the module's configured map, the module returns whatever sits in that database location, and your ladder keeps the database current through block-transfer writes and reads. So the reply chain has three links — the request, the map, the transfer — and you verify them in that order, from the master inward, before you touch a single address.
The function code picks a data class, not a PLC address #
Function 2 reads discrete inputs; function 4 reads input registers. That is all the code means. The Modbus application protocol specification fixes four data classes — discrete inputs and input registers are read-only, coils and holding registers are read-write — and the function code tells the slave which class to serve from. The start address and the quantity then say where in that class and how much; the same specification caps a function 2 read at 2000 bits and a function 4 read at 125 registers.
Neither function means "read a PLC input". A discrete input is whatever the module's map points at: an input bit, an output bit or a software flag — the class is a property of the map, not of the field device. And the address in the request is zero-based, while most clients display a one-based reference with a class prefix; the gap between those two conventions is the classic fault behind Modbus discrete inputs off by one at the PLC.
The module answers from its own database #
The MCM module in the rack is a self-contained Modbus slave. Its configuration — a set of blocks your processor downloads to it — sets the slave address, the line settings on the port the master uses, and, decisively, the map: which database words answer which function code over which address range. When a request arrives, the module parses the function code and start address, looks that pair up in its map, and copies the mapped words out of its database into the reply.
It has no path to the processor's input or output image. Nothing about your input card or output card is visible on the wire by itself; a value reaches the master only by first sitting in the mapped database location. That is why the MCM user manual puts the block-transfer write first: data moves to the module from the processor through that function, and everything the master will ever read is placed by it.
Block transfers are the only door to the processor #
Two instructions move data through that door. A block-transfer write (BTW) carries words from the processor into the module: the configuration blocks first, then the runtime data your ladder wants the master to see. A block-transfer read (BTR) carries words back out: data the master has written, plus module status. A PLC-5 block transfer moves at most 64 words per block, so a full configuration takes several writes, and the runtime exchange runs as a continuous cycle — when a transfer completes, the ladder re-triggers it, alternating reads and writes.
The vendor's sample ladder already handles the sequencing of read and write block situations; you adopt its order and its buffer layout instead of inventing offsets. What the sample cannot decide for you is which processor words go into which buffer positions. That cross-reference is yours to write and keep, one line per point: source address, buffer position, database word, Modbus class, master address.
One read, traced end to end #
Take the rack as installed: the MCM in slot 0, a 1771-IBD (16 inputs) in slot 2, a 1771-OBD (16 outputs) in slot 3. Suppose the map exposes database word 0 as discrete inputs 1 to 16 and word 1 as discrete inputs 17 to 32, and your ladder copies the input image word into buffer position 0 and the output image word into position 1 of every BTW.
Citect asks for function 2, start address 1, quantity 16. The module resolves addresses 1 to 16 to word 0, bits 0 to 15. If input points 1 and 9 are on, the image word holds bit 0 and bit 8: 2^0 + 2^8 = 1 + 256 = 257. The reply packs those 16 bits into two bytes, and Citect shows exactly points 1 and 9 on. Output status sits one word over: output point 9 is bit 8 of word 1, so its wire address is 1 + 16 × 1 + 8 = 25. That formula — address = 1 + 16 × word + bit — is the whole mapping for bit data.
A function 4 read works the same way with whole words. Say the ladder scales one channel of the analog input module 0 to 10000 for 0 to 10 volts and drops it into database word 2, mapped as input register address 0. At 7.3 volts the transferred word is 7.3 ÷ 10 × 10000 = 7300, and the client's scaling divides by 1000 to display 7.3 volts. Change the field value, watch the buffer word, watch the reply: all three must move together.
Output status and the write path #
Modbus defines discrete inputs and input registers as read-only, so output status the master only monitors is served as read-only data: your ladder copies the output image into the database, and the map exposes those words through function 2 or function 4. Either class works; the choice is made once, in the map, not per screen.
If the master must also control outputs, that is a second path, not an extension of the first. The client's write lands in the module's write area; a BTR brings those words into the processor, and your ladder decides which written bits may drive real outputs. One safety rule covers it: a word the master wrote is a command your interlocks can veto, never the output coil itself — the rung that energizes the output still references the machine's permissives, not the communications buffer.
Which link is broken #
Work from the inside out, and change one thing at a time.
- No reply at all, or an exception response: the request link. Wrong slave address, wrong line settings, or a function and address range the map does not cover. The module is telling you the request names something it was never mapped to serve.
- Reply arrives, but the value never moves even when the field point does: the transfer link. Check the done and error status of the block transfers, then the buffer position — the database is stale because nothing is filling it. The same inside-out order closes out Modbus TCP FC02 discrete inputs returning no data when the master sits on Ethernet.
- Value moves in the database but is wrong or stale on the screen: the map or the client convention. Confirm the function code, the zero-based start address and the quantity against the map, and confirm what the client actually sends against what it displays — the master-side wiring of that conversation is the one covered for connecting Citect SCADA to a Modbus RTU gateway over MODNET.
- Right word, wrong bit: the packing. Bit order or word offset in the BTW buffer disagrees with what the client decodes; fix the cross-reference line, not the field wiring.
In every case the client address is the last thing you touch. Changing it before the map and the transfers are proven does not fix the chain; it only moves the mismatch to a point you are not watching.
Questions asked
Can the PLC-5 answer Modbus without the module?
No. The processor's built-in channels speak DF1 and DH+, and neither is a Modbus slave, so a Modbus master needs the communication module in the rack or an external protocol converter in front of the processor. The module in the first slot is the slave the master talks to; the processor behind it is only the device that fills the database.
The client shows register 30001, so what address goes on the wire?
Protocol addresses are zero-based while the conventional display adds a one-based offset and a class prefix, so a request for the reference 30001 carries address 0 in its data unit. Map address 0 to the register you want shown first and let the client add its prefix; subtracting an offset again on the module side is how every value lands one register low.
Can the master control outputs through the same module?
Yes, with function 5 for a single coil or function 16 for multiple registers, but the write lands in the module's write area first. A block-transfer read brings those words into the processor, and your ladder decides which written bits may reach an output. A master-written word is a command your interlocks can veto, never the output itself.
Does function 4 mean the data is analog?
No. Function 4 is any 16-bit input register: an analog value, a packed status word or a counter all qualify. The map decides the meaning, not the origin of the number. If a register carries 16 packed statuses, decode the bits in the client or unpack them in the PLC before the transfer, and record the choice in the same cross-reference as everything else.
How do I prove the block transfers are running?
Each block-transfer instruction reports enable, done and error in its control block, and the sample ladder re-triggers the transfers continuously. If done never sets or error stays set, the processor is not reaching the module: confirm the rack, group and module fields in the instruction against the slot the module occupies before you change anything on the Modbus side.