IMDHMIControls LibraryShop main store

Troubleshooting

Why a Modicon M221 bit stays fixed in Kepware over Modbus TCP

SCADA and data logging Published 6 min read

Short answer

A Modbus TCP tag at 00001 that never changes usually reads the wrong Modbus object, not a broken link. The M221 does not expose its %I inputs to a read request, so match the controller's documented coil mapping, then correct Kepware's zero-based addressing option before blaming the network.

On this page
  1. Confirm the link is not the problem first
  2. Match the Modbus object type to the signal
  3. Align Kepware's zero-based addressing option
  4. Worked example: tag 00001 reading a %Q0 output with zero-based off
  5. Run a single-tag read test
  6. Diagnose by observed result
  7. Lock the working configuration
  8. Questions asked

If a digital bit on your Modicon M221 sits at the same value in Kepware no matter what you switch on the machine, the Modbus TCP link is usually fine: Kepware is returning good-quality data from the wrong Modbus object. Address 00001 names the first coil in the Modbus coil space. It does not automatically name the first physical digital input or output, and Schneider Electric documents that the M221 does not support a read %I request at all, over Modbus RTU or Modbus TCP. Fix the tag by matching three things: the Modbus object type, the controller's documented mapping, and Kepware's zero-based addressing option. The related case of a Click PLC whose tags read shifted through Ignition shows the same pattern from the client side.

Before touching addresses, prove the connection carries real Modbus traffic. Check that the Kepware channel targets the controller's IP address as configured in SoMachine Basic, and that the driver reports valid quality on the tags rather than timeouts or connection errors.

Reachability is not the whole check, though. A successful ping or an open socket says the Ethernet path works; it does not say the Modbus service accepts the request you are sending. Only move on to address testing once Kepware shows a live subscription with good quality and a value that stays constant.

If quality is bad and the driver logs communications failures, fix the endpoint, routing or filtering first — no address change will help. The M221's IO Scanner configuration, when the controller acts as a client itself, is a separate feature and does not change what a server read returns.

Match the Modbus object type to the signal #

The core mistake in most stuck-tag cases is treating 00001 as "the first digital point on the PLC". Modbus has separate object spaces, and a reference in one space never falls through to another:

  • Coils (references 00001 to 09999): read-write bits. On the M221 these carry the externally mapped %Q outputs and %M memory bits.
  • Discrete inputs (references 10001 to 19999): read-only bits. Check whether the signal you want is exposed here at all.
  • Holding registers (40001 to 49999): read-write words. A packed status word can hold bits, but you must know the mapped word and bit position first.
  • Input registers (30001 to 39999): read-only words, the same caution applies.

Identify the exact variable you are watching in SoMachine Basic online mode, toggle it, and confirm it changes in the controller. Then look up its externally readable representation: Schneider's FAQ FA295250 states the M221 does not support a read %I request, valid for both Modbus RTU and Modbus TCP, so a physical %I input is never directly readable. Copy the %I into a %M bit in the program and expose that bit at a documented coil reference, then read the coil.

This object-type problem is the same one behind Ignition Modbus TCP tags reading a Click PLC wrong: the client and the controller disagree about what sits behind the reference number.

Align Kepware's zero-based addressing option #

Once the object type is right, align the address base. Modbus requests carry a protocol offset that starts at zero for the first object in each space, while the five-digit reference notation (00001) starts at one. Kepware's Modbus Ethernet driver has a zero-based addressing setting that controls this translation: with it enabled, the driver subtracts one from the address you enter to build the protocol offset; with it disabled, it treats your entry differently. The driver help describes exactly how your entry maps to the wire.

The failure mode is an off-by-one: you enter 00001, the request actually reads protocol offset 1 — the second coil — and it succeeds, because the second coil exists. Kepware then shows good-quality data from a signal you never asked for, and toggling your input changes nothing.

  • Pick one convention: enter one-based references from the controller's mapping with the option off, or enter raw protocol offsets with the option on.
  • Never compensate twice, once in the option and again by shifting the address by hand.
  • Verify the result against a signal you can change on purpose, not a bit that happens to sit at a plausible value.

Worked example: tag 00001 reading a %Q0 output with zero-based off #

Take the exact case from commissioning: an M221 digital output %Q0, and a Kepware Boolean tag entered as 00001.

Inputs, with their sources:

  • Signal to read: %Q0, the first physical digital output, configured in SoMachine Basic (from the commissioning case).
  • Target object: the coil space, because %Q outputs are read-write bits (documented Modbus object model).
  • Entered reference: 00001, the first coil in one-based notation (from the commissioning case).
  • Zero-based addressing option: off (the default state to test first).

The rule: the protocol offset on the wire is the entered reference minus the first reference of the space (00001 for coils), minus 1 when zero-based addressing is on.

Arithmetic, with the option off:

  • entered reference 00001 − space base 00001 = protocol offset 0. That is the first coil, which is what you want.

Arithmetic, with the option on:

  • protocol offset = 00001 − 00001 − 1 = −1 in reference terms, so the driver effectively reads offset 1 in the way it resolves entries: the second coil, not %Q0.

The result: with zero-based addressing off, 00001 reaches coil offset 0 and tracks %Q0. With it on, the same entry reaches the adjacent coil and the tag reads a different signal at good quality — the value appears stuck even though the switch toggles.

The decision: enter one-based references like 00001 with the option off, and reserve the option for raw offsets. If the tag still does not move at offset 0, the bit behind coil 1 is not your %Q output, and the fix is in the PLC's mapping, not in Kepware.

Run a single-tag read test #

Test one tag at a time with a signal you can operate safely:

  • Pick a test bit that cannot command hazardous equipment — an internal %M bit, or an output that is safe to toggle.
  • Create one Boolean Kepware tag at the chosen coil reference and leave the device configuration alone while you test addresses.
  • Confirm the OPC client subscription is active and showing live quality, not a cached value.
  • Toggle the PLC bit and hold each state long enough for the poll cycle and the client update to observe it. A short pulse can vanish between polls; latch the bit if you need to catch it.

Change one thing at a time. Shifting the address, the data type and the zero-based option together can produce a moving display without proving it reads the right signal.

Diagnose by observed result #

  • Bad quality with communication errors: endpoint or service problem. Fix the IP path and driver diagnostics before anything else.
  • Request rejected or unsupported: the offset or object type does not exist on the controller. Compare against the documented Modbus mapping.
  • Good quality, fixed value: wrong object, inactive polling, or a bit the program overwrites every scan. Verify the PLC variable online while the program runs.
  • A different signal moves the tag: mapping or address-base mismatch. Trace that signal's offset and recheck the translation.
  • Brief changes disappear: sampling limit. Compare the pulse duration with the poll and update intervals, or latch the event in the PLC.

Lock the working configuration #

When the tag follows the signal both ways, record it: PLC variable, Modbus object type, protocol offset, Kepware tag address and the zero-based option state. Confirm the inactive state, the active state, and one adjacent independent signal — changing that neighbor must not move your tag, which catches a readable but shifted address. Then extend the same convention to the rest of the tags instead of discovering them one by one.

Questions asked

Why can't I read the M221's %I inputs directly over Modbus TCP?

Schneider Electric's own FAQ for the M221 states the controller does not support a read %I request, and this applies to both Modbus RTU and Modbus TCP. So a %I bit is never directly readable by an external client. Copy the %I value into a %M memory bit in the program and expose that bit at a documented coil reference instead.

Should Kepware's zero-based addressing option be on or off for an M221?

It must match the convention of the reference you enter. Modbus protocol offsets start at zero, while five-digit references like 00001 start at one. If you enter one-based references from the controller's mapping, leave the option off so the driver subtracts the one; if you enter raw protocol offsets, turn it on. Never compensate twice, once in the option and again in the address.

The Kepware tag shows good quality but the value never moves. What else causes that?

Three causes besides a mapping error: the PLC program overwrites the bit every scan, so a forced value disappears; the OPC client is showing a cached value because its subscription is not active; or the change is too short for the poll and client update intervals to catch. Latch the bit in the PLC and confirm the client subscription is polling before changing addresses again.

Can I write to the M221's %Q outputs from Kepware over Modbus TCP?

Yes, the %Q outputs are exposed as coil objects, which are read-write, so a write to the mapped coil reference changes the output. Start with reads during commissioning anyway, and confirm with a single test tag that the address reaches the output you intend before letting any client command real equipment.

Keep reading

  • Troubleshooting

    Connecting InTouch to a CLICK PLC over Modbus RTU

    Set the Modbus I/O Server to RTU, not ASCII: the CLICK PLC is an RTU-only slave and silently discards ASCII frames. Wire to an RS-232 port, copy the PLC port's baud and framing — 38400 only if the port is set to it — and keep the 584/984PLC topic only after one known register reads back exact.

    SCADA and data logging

  • Explainer

    Reading SunSpec Modbus devices into SCADA over Modbus TCP

    A standard Modbus TCP driver reads SunSpec devices. SunSpec only defines the register layout: a chain of model blocks starting at the device's documented base address, each block carrying a model identifier, a length, and int16 values you decode with per-block scale factors. The engineering work is block location and scaling, not a new transport.

    SCADA and data logging

  • Troubleshooting

    Show a forced M580 input in Citect SCADA

    A forced %I bit on an M580 never reaches Citect over Modbus, because the Quantum %S79 force-to-Modbus synchronization is not implemented on M580 or M340 and no setting restores it. For the FAT, mirror each input into a %M coil and read it at 000100-style addresses — 400100 is the holding-register area and the common addressing mistake — or serve the tags through OFS.

    SCADA and data logging