I am using iFix 4.5 with drivers (ABR and IGS) configured to communicate with a PLC-5, a SLC5/05, and a ControlLogix 5500 processor, all over Ethernet. I am trying to figure out a way to put the current system time on the screen when a bit in one of the processors goes true. For example, when B3:0/0 in my PLC5 goes true, I want the current system (not PLC) time on the iFix screen. The idea is to log start/stop times, etc easliy on a screen, and not dump into an external DB or spreadsheet.
It has to be done on a bit condition, and not by operator input. I thought I had it figured out, and it works almost perfectly. I used the event tag in iFix (named it Event1) to look at the bit in question. OnTrue, the condition is set, and I run a script to change the caption of a pre-set text field (called TimeStampText). My code looks like this:
Private Sub Event1_OnTrue()
TimeStampText.Caption = CStr(Now())
End Sub
It works perfectly every time the condition goes true. The caption changes from TimeStampText to the current System time. However, the problem is that any time I change screens and go back to the main screen, the tag caption updates with a new system time, even if the status of the bit has not changed. In short, the Event works, and so does the caption change, but the script is run every time the screen is loaded, so even though the condition has not changed, a new system time is updated.
How can I keep this from happenening, or is there another way to write the script or event to prevent this? The ONLY time I want the system time to change is when the bit changes state.
Thanks!
It has to be done on a bit condition, and not by operator input. I thought I had it figured out, and it works almost perfectly. I used the event tag in iFix (named it Event1) to look at the bit in question. OnTrue, the condition is set, and I run a script to change the caption of a pre-set text field (called TimeStampText). My code looks like this:
Private Sub Event1_OnTrue()
TimeStampText.Caption = CStr(Now())
End Sub
It works perfectly every time the condition goes true. The caption changes from TimeStampText to the current System time. However, the problem is that any time I change screens and go back to the main screen, the tag caption updates with a new system time, even if the status of the bit has not changed. In short, the Event works, and so does the caption change, but the script is run every time the screen is loaded, so even though the condition has not changed, a new system time is updated.
How can I keep this from happenening, or is there another way to write the script or event to prevent this? The ONLY time I want the system time to change is when the bit changes state.
Thanks!