Pop-up Screen Flashing

Hello all,

I created a screen that is scripted such that when either one of two tags become true (an alarm from a robot), the screen will pop up. It is also scripted to automatically close the screen when BOTH of the tags become false.

The issue I'm having is that when either tag is true, the screen flashes (almost like it is reopening every cycle). The logic is very simple, but it seems that there is a better way. In Tasks, I have an independent script as follows:

//If $Fanuc1_HMI.LT_BatteryAlarm = True Or $Fanuc2_HMI.LT_BatteryAlarm = True Then
// $Open("RobotBatteryAlarm")
//End If

In the Screen Script, I have the following:

//Sub Screen_WhileOpen()
//
// If $Fanuc1_HMI.LT_BatteryAlarm = False And $Fanuc2_HMI.LT_BatteryAlarm = False Then
// $Close("RobotBatteryAlarm")
// End If
//
//End Sub

Is there a better way to do this where the screen won't flash or flicker? I was thinking about adding some logic in the task where if the screen is already opened, not to try to reopen it, but I'm not sure of the best way to do this. Maybe use a local tag which is set when the screen opens, and if that tag is True, have something like:

//If ($Fanuc1_HMI.LT_BatteryAlarm = True Or $Fanuc2_HMI.LT_BatteryAlarm = True) And ExampleScreenTag = False Then
// ExampleScreenTag = True
// $Open("RobotBatteryAlarm")
//End If

Along with the logic in the closing portion to set it back to false like:

//Sub Screen_WhileOpen()

// If $Fanuc1_HMI.LT_BatteryAlarm = False And $Fanuc2_HMI.LT_BatteryAlarm = False Then
// ExampleScreenTag = False
// $Close("RobotBatteryAlarm")
// End If
//
//End Sub

Thanks!
  • The place to do this sort of thing is in the Graphics script. You will need to create a couple of local variables that keep track of the state of your alarms and only execute the Open() one time when the state changes.
  • Thank you for your response. I am relatively new to IWS so I haven't had a chance to look into Graphics scripting at all.

    I am wondering now if I need to keep the logic I have in place in the Tasks for opening the screen (using the local variable as a toggle) like I currently have, but within the graphics script, toggle that local tag on open and close?

    So something to the effect of:

    Tasks - Open screen when either Robot tag is True AND the toggle bit is off.

    Graphics Script - Set the bit to On when the screen opens so the task cannot try to reopen it. Set the bit to Off when the screen closes.

    Screen Script - Close the screen when Both tags are False AND the toggle bit is On.

    I'm going to keep looking into this method further, but I definitely appreciate any input.

    Edit: I see that the Graphics Scripting has the WhileRunning function. I think this is where I need to handle my code since I want the screen to pop up at any time if the tag goes true.

    Thanks!
  • Generally you want to use Graphics scripts instead of Tasks to do graphics actions. While it may work fine in a stand alone application, it can give you headaches when you have a distributed (client/server) application. Each device (client) controls its own graphics scripts as opposed to Tasks which are controlled by the project server.
  • Thanks for your help, Norman E.

    I was able to get this working through the Graphics Script as you suggested. The way our integrator has this set up, the only certain OPC drivers are scripted to poll through the Task list depending on which screen is currently open. I didn't realize this when I added the tags to the Graphic script, and I wouldn't see my screen pop up (since the tags weren't being polled on the default screen).

    Created a new driver and added it to task list to poll the robot tags in question, and voila!

    -K