How-to
Adjust an Ewon tag alarm threshold from ViewON
Short answer
Yes: put the operator's entry in a MEM tag and let an ONCHANGE BASIC block write it into the monitored tag with SETSYS TAG load, set and save, then CFGSAVE. Use AlLow or AlHigh for warning levels, AlLoLo or AlHiHi for danger levels, and AlTimeDB for the delay. If the PLC owns the comparison, read its level and alarm bit as plain tags instead.

On this page
Yes. A ViewON page can display an Ewon tag's alarm level and change it, but not by typing a tag name into the alarm-level field: those fields hold fixed numbers. The working pattern is a MEM tag behind the ViewON entry control and a short BASIC block that runs when the operator's value changes — it loads the monitored tag, writes the number into the chosen alarm field, saves the tag and commits the configuration to flash. The same load, set, save sequence covers the warning levels, the danger levels and the activation delay. The one decision that shapes the build is where the alarm is evaluated, in the Ewon or in the PLC, so start there.
Decide where the alarm is evaluated #
The threshold has one authoritative home, and picking it comes before any scripting.
| Alarm evaluated in | Threshold lives in | What the ViewON page does |
|---|---|---|
| The Ewon tag alarm | The tag's alarm-level fields | Writes the operator's value into the field through BASIC |
| The PLC program | PLC logic or data | Reads the level and the alarm bit as plain tags |
At a site with no PLC, the Ewon's own alarm function is the whole solution and the block below is the answer. Where a PLC already compares the value, keep the comparison there: a second threshold in the Ewon gives two numbers that drift apart. The last section covers that split.
Build the operator entry in ViewON #
- Enable the alarm on the monitored tag first; nothing below matters until it alarms at all. In the examples the monitored tag is
Tag_1, a numeric tag. - Create the operator's tag as a numeric MEM tag, for example
Tag_1_AlLow, initialized to the alarm level currently in force, so the page opens showing the truth rather than zero. - Place a numeric entry control on the ViewON page and bind it to that MEM tag. Keep the name free of slashes: a tag whose name contains a slash shows as invalid in ViewON, a failure covered in why Ewon tags with a slash show invalid in ViewON.
- Bind a display control to the same MEM tag so the last accepted entry stays visible next to the input.
- If the activation delay must also be adjustable, add a second numeric MEM tag for it, for example
dPTimeDelay.
Write the threshold into the tag #
The block below registers the trigger; the labeled part runs whenever the MEM tag's value changes. The load line brings Tag_1 into the SETSYS buffer, the next line sets one alarm field to the operator tag's current value — a trailing @ reads a tag's value in BASIC — the save line stores the tag, and CFGSAVE commits the configuration to flash. Tag and label names are examples; keep them consistent with your own tag list.
ONCHANGE "Tag_1_AlLow", "GOTO Change"
END
Change:
SETSYS TAG, "LOAD", "Tag_1"
SETSYS TAG, "AlLow", Tag_1_AlLow@
SETSYS TAG, "SAVE"
CFGSAVE
Write only the field of the alarm being adjusted. The available fields are:
AlLow— low warning levelAlHigh— high warning levelAlLoLo— low-low danger levelAlHiHi— high-high danger level
Because the run loads the whole tag configuration, sets one field and saves it back, every untouched field keeps its stored value.
Set the activation delay with AlTimeDB #
The delay field is AlTimeDB. A write to ALDELAY does not change the delay; that name is not the field the tag configuration uses. Same sequence, with the delay field and the delay tag:
ONCHANGE "dPTimeDelay", "GOTO ChangeDelay"
END
ChangeDelay:
SETSYS TAG, "LOAD", "Tag_1"
SETSYS TAG, "AlTimeDB", dPTimeDelay@
SETSYS TAG, "SAVE"
CFGSAVE
The field takes a plain number in the time base the tag's alarm configuration page already shows for the delay, so read the existing value there and enter the operator's number in that same base.
Verify the new threshold #
- Enter the new value on the ViewON page and confirm the block ran: the display bound to the MEM tag shows the entry, and the tag's configuration page shows the new number in the alarm field.
- If the page is served through a remote proxy and the read-back looks stale, give it a moment before assuming a failed write — that lag is the behavior explained in why web data lags through an eWon WAN proxy.
- Drive the process value across the new trigger point and confirm the intended warning or danger alarm activates.
Worked example: a high alarm on a temperature tag is set to 50 °C and the operator enters 45 °C. The trigger point moves down by 50 °C − 45 °C = 5 °C. A process holding 47 °C sits 50 °C − 47 °C = 3 °C below the old trigger, so it never alarmed; the same 47 °C sits 47 °C − 45 °C = 2 °C above the new trigger, so the alarm now fires. Check the direction before testing: the same number means fires-above in AlHigh and fires-below in AlLow — the field gives the number its meaning.
One limit on all of this: an Ewon tag alarm notifies, it does not protect. Keep the over-temperature cutoff in the PLC or the safety hardware, whatever level the operator types.
When the PLC owns the alarm #
Where a PLC is in the loop, it evaluates and the Ewon reports.
- Keep the threshold and the comparison in the PLC program; the operator's new setpoint goes to the PLC, not into Ewon alarm fields.
- Map two plain Ewon tags to the PLC: one reading the active threshold, one reading the alarm bit the PLC sets.
- Put the Ewon's alarm on the bit, so notification and email functions fire on the PLC's decision, and display the threshold tag on the ViewON page for visibility.
- When the setpoint has to reach the PLC inside an MQTT payload rather than through a direct tag write, that path is its own task, covered in subscribe to MQTT and write the value back to the PLC.
The decision in one line: with a PLC, it compares and the Ewon repeats the result; without one, the ONCHANGE block is the whole mechanism, and AlTimeDB rides along in the same pattern.
Questions asked
Can the operator adjust both the warning and the danger level?
Yes, but give each field its own MEM tag and its own ONCHANGE block, one writing AlHigh and the other AlHiHi. Because each run loads and saves the whole tag configuration, one block per field keeps an entry from overwriting a level it was not meant to touch. Two entry controls on the same ViewON page then cover both levels.
Does the new alarm level survive a power cycle?
Only after CFGSAVE runs. The SETSYS save stores the tag in the running configuration; CFGSAVE is the step that commits it to the gateway's flash. Leave CFGSAVE out and the change works until the next restart, then the old level returns. Keep it as the last line of every block that changes alarm fields.
Why does re-entering the same value not run the script?
ONCHANGE fires when the tag's value actually changes. Typing the number that is already in the MEM tag produces no change event, so the block never runs. That is harmless while the configuration already holds that number; after a restored or edited configuration it can leave the field stale. Nudge the entry to a different value and back, or add a separate MEM tag the operator bumps to force the write.


