Troubleshooting
Why a TM200 READ_VAR reads Modbus data only once
Short answer
READ_VAR runs one Modbus transaction per rising edge of Execute, so a held Execute never refreshes the data. Drop Execute false for at least one scan, keep Abort off the request rung, and gate each relaunch on Done, Aborted or Error — that sequence turns a single read into continuous polling.
On this page
- Why does READ_VAR read the Modbus slave only once?
- How do I retrigger READ_VAR for the next read?
- Why does every read after the first come back Aborted?
- What do Done, Aborted and Error each tell me?
- How do I turn one read into a continuous polling sequence?
- How fast should the TM200 poll the slave?
- How do I confirm the fix online?
- Questions asked
READ_VAR on a Modicon TM200 runs one Modbus transaction per rising edge of Execute, so an Execute input that stays high never launches a second read. Drop Execute false for at least one scan of the calling task, take Abort off the same rung as Execute, and relaunch only after Done, Aborted or Error reports the previous transaction finished. The port and slave setup is not the fault: the first Done proves the addresses and the cable work. The fix is entirely in how the block is retriggered. If the slave is a drive, the wiring and register setup in controlling an ATV12 drive from a TM200 over Modbus RTU still stands; this article covers the polling sequence that keeps it running.
Why does READ_VAR read the Modbus slave only once? #
READ_VAR starts one Modbus transaction per rising edge of Execute. Once that edge has been consumed, an input that stays true issues nothing further, so the destination register keeps the value from the first read no matter how the slave changes.
A rising edge is the false-to-true transition the block observes between scans, not the state of the input. READ_VAR is a transaction block, not a subscription: a Modbus slave never pushes data, so the master has to ask again for every refresh. Done belongs to that single exchange and says nothing about later slave values. On a TM200C40T programmed in EcoStruxure Machine Expert-Basic, this is the documented behavior of the communication blocks, which Schneider's FAQ for this software confirms are supported from version 1.3 onward.
The pattern is not a quirk of this block. You meet the same discipline in motion code, where MC_MoveAbsolute holds its Done with a kept Execute rather than a pulse — one Execute edge, one transaction, one completion report.
How do I retrigger READ_VAR for the next read? #
Drop Execute to false for at least one scan of the task that calls the block, then set it true again: the block has to observe the false state before the next transition, or no new edge exists.
Keep the block in the normal scan path while Execute is false. A false rung still executes the block; skipping over the block, or clearing and setting the bit within one scan, can leave the block seeing only the final true state.
Prove it by hand before automating anything:
- With the slave reachable and one read already done, set Execute false and watch the online value go false.
- Change a known value at the slave.
- Set Execute true again with Abort inactive, and confirm a second Done arrives with the new value in the destination.
Two successful reads this way prove the port and the addressing; from here the only remaining problem is sequencing.
Why does every read after the first come back Aborted? #
Because Abort is wired to the same rung or the same condition as Execute, the request is cancelled as fast as it is launched — give Abort its own rung, inactive during a normal read, and the cancellations stop.
Go online and watch both inputs during an attempt. If Aborted pulses every time Execute rises, trace each input back through the ladder: two branches that look separate can still share one condition, and a shared rung condition drives both inputs together. Abort is a deliberate cancel — a mode change, a controlled end of communications — and has no business being true during an ordinary poll. After separating them, confirm Aborted stays false across several consecutive reads.
What do Done, Aborted and Error each tell me? #
Done means the exchange completed and the destination now holds what the slave sent; Aborted means your Abort input cancelled it; Error means the exchange failed, with CommError and OperError carrying the reason.
| Output | What it reports | Next action |
|---|---|---|
| Done | The transaction completed; the destination holds the slave's value | Accept the data, set a freshness bit, rearm |
| Aborted | The Abort input cancelled the transaction | Find the condition driving Abort, release it, rearm |
| Error | The transaction failed | Copy CommError and OperError to holding registers, rearm |
| None yet | The transaction is still in progress | Wait — never launch a second request |
Two traps are worth naming. A failed read leaves the previous value sitting in the destination, so old data can masquerade as a live measurement — if the machine or an operator acts on these values, raise a freshness flag with every Done and clear it on Error or Aborted. And copy the two error words on the Error edge before any retry, because a fast retry overwrites them. When Error arrives with a Modbus exception, one common cause is a read crossing a gap in the slave's register map; the code meanings themselves are in the communication error tables of the help for your installed version.
How do I turn one read into a continuous polling sequence? #
Run four phases — rearm, launch, wait, evaluate — with a timer setting the interval and the completion outputs gating every new launch, and track one outstanding-request bit so nothing stacks requests.
| Phase | Execute | Leaves the phase when |
|---|---|---|
| Rearm | False, Abort inactive | The block has run at least one scan with Execute false |
| Launch | False-to-true transition | The request is out; set the outstanding-request bit |
| Wait | No new edge | Done, Aborted or Error appears |
| Evaluate | Unchanged | Data accepted or diagnostics retained; clear the bit, return to rearm |
Build it in this order:
- Give Abort its own rung and prove it stays false through a normal read.
- Add the rearm phase: Execute false across at least one block execution before every launch.
- Add the completion gate: with the outstanding-request bit set, no timer and no enable condition can launch again.
- Split the results: Done accepts the data; Error and Aborted retain diagnostics and mark the data not fresh.
- Loop it, and prove consecutive reads with a changing slave value.
One wiring habit to avoid: feeding Done straight back into Execute. Done arrives while Execute is still high, so the feedback latches the request instead of producing an edge — let Done drive the rearm step and let the sequence produce the next launch.
How fast should the TM200 poll the slave? #
Set the interval from the update rate you actually need, then confirm each transaction finishes well inside it: with a 500 ms interval, a 10 ms task and a 60 ms read you get a fresh value every 500 ms.
Illustrative worked example — take your own scan time from the task configuration and your own transaction time from an online measurement. Task scan: 10 ms. Measured launch-to-Done time for one read: 60 ms. Wanted update rate: about twice a second, so the polling timer presets to 500 ms.
- t = 0 ms: launch, Execute true, outstanding bit set.
- t = 60 ms: Done; Execute drops false, rearm begins.
- t = 70 ms: one 10 ms scan with Execute false; rearm complete.
- t = 500 ms: timer done; next launch.
Period = 500 ms, so the refresh rate is 1000 / 500 = 2 values per second, and the worst-case data age is the interval plus one outstanding transaction: 500 + 60 = 560 ms. Now the slow case: the same read to a busy slave measures 700 ms. The timer expires at 500 ms while the transaction is outstanding, so hold the launch; Done at 700 ms, the rearm adds one 10 ms scan, the next launch lands at 710 ms, and the rate becomes 1000 / 710 ≈ 1.4 per second. The sequence stays correct; only the rate drops.
If you need faster refresh, the timer is not the only lever. On one serial port every register and every slave adds time, and why Modbus RTU polling on one serial port runs slow shows where the milliseconds go.
How do I confirm the fix online? #
Go online, change a known value at the slave, and verify that a later Done arrives together with the new value in the destination — then repeat it across several transactions while watching Abort stay false.
Watch four things together in one data table or chart:
- Execute dips false between launches for at least one scan, then rises again.
- Aborted and Error stay false for the whole run.
- Done pulses once per poll, and each pulse lines up with the updated destination value.
- The freshness bit, if you added one, is true after every Done and never left set after a failure.
Change the slave value several times in a row. Every change should appear behind a Done within one polling period; if one stalls, the sequence is rearming or gating somewhere you did not intend, and the manual two-read test localizes it.
Questions asked
Can I wire Done straight back into Execute to retrigger the block?
No. Done arrives while Execute is still high, so feeding it back gives no new rising edge. Use Done to start the rearm step instead: drop Execute, let the block run at least one scan in that state, and let the polling timer or the sequence logic generate the next false-to-true transition. If Done also resets your timer, put that reset on its own rung so the rearm period cannot be skipped.
Why did my first read succeed if Abort is wired to the same rung?
Done proves one exchange completed. When Execute and Abort rise together, the result depends on the order the block samples the two inputs in that scan, so a first launch can complete while the next attempt is cancelled — which is exactly why the fault looks like works once, never again rather than never works. Separate the inputs, then confirm Aborted stays false across several consecutive reads online.
How long should Execute stay false between polls?
One full scan of the task that calls the block is the minimum; staying false longer costs nothing but update rate. In practice, one to two scans of rearm plus your polling timer covers the timing. If you later move the block into a faster task, the rearm shortens by itself because the scan time drops — recheck the polling period only if you also change the timer preset.
Do CommError and OperError keep their values when the next poll starts?
Not reliably, and that is the trap. A rapid retry can overwrite the most informative pair of codes before anyone reads them. Copy CommError and OperError into holding registers on the Error edge, timestamp them if you can, and let the sequence pause on a fault instead of retrying blindly. The code meanings are listed in the communication error tables of the software help for the version you have installed.
Does the same retriggering apply to WRITE_VAR?
Yes — treat the write block the same way: it also performs one transaction per Execute rising edge, so a held Execute writes once. When reads and writes share one serial port, sequence them so a write never launches while a read is outstanding, or both slow down and start reporting errors. Give each block its own rearm phase and gate each on its own completion outputs.