Good morning OkiePC! I want to start off saying how much I appreciate you lending a hand to a Red Lion noob like myself.
You're welcome!
So to be more clear, the operator will already be on the screen when they are asked to press two physical push buttons (to keep hands away from pinch points.) When those 2 buttons are activated, a DINT is moved to a PLC tag. That is the tag I want to trigger the popup, while still on that screen.
Then simply use the trigger on the Crimson tag to call the pop-up. The pop-up will be called once each time the value in that tag changes to match the value you place in the trigger regardless of what page is presently displayed.
On another note, I would also like to hear best practices for passing screen numbers to the PLC so the PLC "knows" what screen the HMI is on as you mentioned.
To have the HMI keep track of what page is being displayed, I will create a tag with "internal" as the source, I will mark it as retentive.
Then on each page properties I will use the "on select" event to assign a value to that tag.
If I want to share that tag with the PLC, I just change the data source to point at the desired PLC tag.
You could also allow the PLC to dictate what page is displayed with another tag. Just use a trigger on data mismatch and run a program that uses a switch statement and a list of cases and breaks:
Code:
switch( HMI_Select_From_PLC ) {
case 1:
GotoPage(Page1);
break;
case 2:
GotoPage(Page2);
break;
case 3:
GotoPage(Page3);
break;
case 4:
GotoPage(Page4);
break;
case 5:
GotoPage(Page5);
break;
}
Side note: A habit I have developed with Crimson is any time I am doing anything with the "=" equals sign, I use two characters:
Code:
y := x //assignment The value in y is replaced with the value in x
y == x //test for equality, returns 0 or 1 (true or false)
y != x //test for inequality
I once wrote a lengthy program in Crimson and had a hell of a time finding a bug because I had inadvertently used "=" where I intended a test for equality and it was changing a tag I did not want changed. "=" is the same as ":=" and is the assignment operator.
Another sidenote: If you are going to write a long program or create a bunch of references to pages or tags, keep the names short and sweet...one or two characters if possible. When you get done with all the typing (which will be easier with short names) you can go back and make the tag/page names more meaningful and lengthy and Crimson will rename them throughout all your objects and programs automatically.