Knowledge Base
Showing results for 
Search instead for 
Did you mean: 

Script program misses digital input change of value.


A script program monitors the value of a digital input on an IO module. The input is wired to a switch that, when pushed by an operator, will toggle a digital output ON/OFF to start/stop a piece of equipment.

The issue is the program will randomly fail to see the input changing when the operator releases the button too quickly. This happens even though the IOU module detected the input change as indicated by the LED on the input channel of the UI-16 module.


Automation Server

SXW UI module

Script Program


In SmartStruxure, Script programs are executed by a task and then go dormant until the task schedules the program to run again. If the input changes and then returns to the value it had the last time the program executed, the change will be missed.


Instead of a digital input, use a counter input and modify the PE Script to toggle the output when the count increments.


Numeric Input theINPUT

Numeric Output theOUTPUT

Numeric thePreviousInVal


thePreviousInVal = theINPUT

goto 2


if theINPUT > thePreviousInVal then goto 3


if theOUTPUT = off then theOUTPUT = on else theOUTPUT = OFF

goto 1

Tags (1)
Labels (1)
Version history
Revision #:
1 of 1
Last update:
‎2018-09-06 09:45 AM
Updated by: