In the simple ST sample we created in the previous exercise, we encountered an issue where our alarm total count continued to increment with each scan cycle while the digital alarm was active. In order to adjust our code to count only new alarms, as we initially intended, we would need to only count a new alarm in the event of a change of alarm state from off to on. This is known as detecting the rising edge of the signal. We can accomplish this in ST using the OSRI instruction.
In the following exercise, we will add the OSRI instruction to the routine we started earlier in this chapter to resolve our alarm counting issue:
- Open up the ST routine we created earlier, called AlarmTotalizer, as in the following screenshot:
The previous screenshot should match the code in your ST routine. We need to rewrite this code using the OSRI instruction to resolve the continuous addition problem...