How-to
HMI periodic tag updates by script and scheduled task
Short answer
For periodic HMI tag writes, the scheduler's cyclic task is floored at 60000 ms, so anything faster needs a PLC clock bit read as an HMI tag with a 100 ms acquisition cycle and a script bound to that tag's value-change event. The event fires on every detected edge, on every screen; a trigger field on a screen fires only while that screen is open.
On this page
- Why does my HMI scheduled task not run faster than once a minute?
- How do I write tags periodically faster than the scheduler allows?
- How do I make the PLC toggle the trigger bit?
- Which acquisition cycle does the trigger tag need?
- How do I attach a script to the tag's value change?
- Why does a hidden screen field stop working when I change screens?
- How do I prove the update rate on the bench?
- Which method fits which update period?
- Questions asked
You asked the panel to write tags on a period far shorter than its scheduler will cycle, and no scheduler setting closes that gap. On this class of HMI runtime the cyclic scheduled task stops well short of that rate, a trigger field on a screen dies with its screen, and a script by itself has no clock to follow. The working pattern is to borrow the PLC's clock: toggle a bit at the period you want, read it as an HMI tag on the shortest acquisition cycle the connection offers, and bind the write script to that tag's value-change event. This article states the scheduler's floor, builds the bit, attaches the script, and shows the bench count that proves the rate.
Why does my HMI scheduled task not run faster than once a minute? #
The scheduler's cyclic task has a hard floor of 1 minute (60000 ms): the interval list simply stops there, so a task asked to write tags every few seconds never gets an interval to run at, and no setting lowers that floor.
The cyclic type in the scheduler repeats its function list at the interval you enter, and the entry bottoms out at the shortest cyclic interval this runtime documents — the floor lives in the runtime, not in your project. Adding more tasks does not help either: each one obeys the same floor, and nothing in the scheduler chains two minute-tasks into a half-minute rate. What the task can do is call a script function or system functions such as a tag write, so it remains the right tool once your period sits at the floor or above. Below it, the scheduler is the wrong clock, and the fix is to borrow one from the PLC.
How do I write tags periodically faster than the scheduler allows? #
Drive a clock bit in the PLC, read it as an HMI tag with a 100 ms acquisition cycle, and attach your write script to that tag's value-change event — the event then fires on every detected edge, on every screen, with no scheduler involved.
The trigger hangs on the tag, not on a screen object, so each sampled change calls the script once wherever the operator happens to be. Your period is set by how often the bit changes state; the acquisition cycle sets the floor under it. The next three sections build the bit, size the acquisition cycle, and wire the event.
How do I make the PLC toggle the trigger bit? #
Give the bit a change interval equal to your target period: use the PLC's built-in clock-memory feature where one exists, and a two-rung timer toggle in the scan where it does not — either way the cost is a few configuration steps and no hardware.
The steps below build a bit that changes state every 500 ms:
- Check the CPU's configuration for a clock-memory setting — a byte whose bits the firmware toggles at fixed, documented frequencies. If the CPU has one, enable it, note the byte address, and pick the bit whose change interval matches the target period.
- Where the CPU has no clock-memory feature, toggle a bit with a timer: a rung that starts a timer with a preset of 500 ms each time the bit is off, and sets the bit from the timer's done output, so the bit flips every time the timer completes.
- Put the bit on an address the HMI connection can read — a memory-area bit or a non-optimized data block boolean — and let nothing else write to it.
- Load the PLC and watch the bit flip in an online status table before you touch the HMI side; a trigger that never toggles in the PLC will never fire a script anywhere.
Which acquisition cycle does the trigger tag need? #
Set the trigger tag's acquisition cycle to 100 ms — the shortest cycle this class of connection samples dependably — and keep the bit's change interval at 100 ms or longer, because an edge that falls between two samples is an edge the script never sees.
The value-change event works off samples, not off the wire: the runtime reads the bit once per acquisition cycle and compares it with the last sample. Leave the tag on a slow default cycle and most edges vanish; force the cycle down to the shortest the connection offers and the event tracks the bit cleanly. Sampling also sets the ceiling — at that shortest cycle the script can run no faster than once per sample, about 10 runs per second — so a period under that belongs in the PLC, not in the HMI. One trigger tag at that rate is a light load, but it shares the connection with every other tag; if other points start updating late after the change, slow the bit down or give the trigger a connection of its own.
How do I attach a script to the tag's value change? #
Open the trigger tag in the HMI tag table, go to its events page, and bind the value-change event to your script function — from then on the runtime calls that function once per detected change, rising and falling edges alike.
- In the HMI tag table, select the trigger tag, open its properties and find the events list.
- Pick the value-change event and add a script call as its action; the runtime lists the project's script functions by name.
- Keep the function short and blocking-free: read the tags you need, write the targets, return. A loop or a wait inside an event script stalls the whole runtime — the failure described in Why an HMI Screen Freezes Until a Script Finishes.
- Write internal tags and PLC tags the same way from the function; the connection setting on each target tag decides where the value lands.
- If you want one run per full on-off cycle instead of one per edge, gate the body on the bit's state — run the writes only when the trigger reads 1 — and the rate halves.
- Save, compile and load to the panel, then watch one bit flip drive one write on a test screen before trusting the chain.
One caution: these writes travel the ordinary communication path, not a safety function, so the PLC must supervise any setpoint the script writes — a dropped link or a stopped runtime must leave the machine in a defined state, not frozen on the last HMI command.
Why does a hidden screen field stop working when I change screens? #
Because a trigger field belongs to its screen: the value-change binding on a screen object fires only while that screen is open, and the runtime's always-on background screen does not accept normal objects, so the workaround would be one hidden field on every screen.
That per-screen copy works, but it is a maintenance trap: every new screen must remember its invisible field, and a screen added by someone else silently breaks the periodic write. Use a screen field deliberately, and only when the periodic action is screen-local — refreshing a display or arming a control while its own screen is shown is exactly what a field binding is for. For a machine-wide periodic write, the tag event of the earlier sections is the only pattern here that survives a screen change.
How do I prove the update rate on the bench? #
Count runs with an internal counter tag the script increments, log it against the clock for one minute, and check the arithmetic: a bit changing state every 500 ms must produce 60000 ms ÷ 500 ms = 120 script runs per minute, twice per on-off cycle.
- Expect small jitter: the count lands on 120 give or take a sample. A result near 60 means half the edges are lost — usually an edge-filtered trigger or a cycle left too slow — and a result near 240 means the bit toggles twice as fast as you intended.
- A count that never moves points at the connection, not the script: the tag stopped sampling, so no change reaches the event. Work that with Is It the Driver, the Tag or the Screen? Diagnosing HMI Values before editing anything.
- The counting method has limits of its own — long scripts and missed samples bias the tally, as Can an HMI Script Count PLC Bit Changes Reliably shows — so treat a count within a few percent of the arithmetic as a pass, and re-run the minute twice before signing the rate off.
Which method fits which update period? #
Use the scheduled cyclic task for periods of 1 minute and longer, the clock-bit value-change event for 100 ms to 1 minute, and move anything faster than the shortest acquisition cycle into the PLC — this runtime cannot deliver a script rate quicker than that.
| Your update period | Method to use | Why it wins there |
|---|---|---|
| At or above the scheduler's floor | Scheduled cyclic task calling the script or system functions | No PLC logic to build, and the floor never bites at these rates |
| Between the shortest acquisition cycle and the floor | PLC clock bit into a tag value-change event | Screen-independent; the bit sets the rate, the sampling cycle sets the limit |
| Under the shortest acquisition cycle | Move the periodic logic into the PLC | Sampling cannot count edges it never sees |
| Only while one screen is open | Trigger field on that screen | Turns the screen-only limitation into the point |
Pick by the period first, then by where the logic lives. If the table puts you on the tag-event row, the build above is the whole job — one toggling bit, one fast tag, one short script — and the bench count is your acceptance test.
Questions asked
Does the value-change script keep running when the operator moves to another screen?
Yes — screens have no part in it. The script fires on every change the runtime samples, whatever screen is showing, and it stops only when the runtime stops or the connection to the PLC drops: the tag then stops sampling, the bit keeps toggling in the PLC, and the writes pause until the link returns.
What if my runtime has no scripting option at all?
Then the value-change event can still call system functions — a tag write, a set-bit, an increment — on every change, at the same fast rate; what it loses is arithmetic, because system functions cannot compute a setpoint the way a script can. Where the logic needs calculation, keep it in the PLC and let the panel only display the result, or accept the scheduler's slower cyclic floor for anything that fits a minute-scale period.
How much extra communication load does a fast trigger tag put on the PLC link?
One tag on the shortest acquisition cycle is a light load by itself, but it competes with every other tag on the same connection for the update budget. Watch the connection's diagnostics after the change: if other points start updating late or a communication alarm appears, raise the bit's change interval, or move the trigger onto a connection of its own so the periodic writes cannot starve the process data.
Can two different scripts run from the same clock bit?
Yes — add both functions to the same value-change event and the runtime runs them in the order listed, one after the other. Keep the pair short: at a fast trigger the writes land many times a second, and any blocking call inside either function delays every screen. If the two jobs are unrelated, give each its own bit and event, so a fault in one cannot stall the other.