Can a boolean variable (variable1, variable2) be connected to a touchscreen, so that when variable1 is 1, the screen automatically switches from screen 1 to screen 2, and when variable2 is 1, the screen automatically switches back from screen 2 to screen 1?
The screen can be switched by changing the variables.
1. ProTool: Create a new variable 1. In the properties of variable 1, under "Functions", select "Event" as "Value Change", select "Change Screen Fixed" as the function, and select "Screen 2" as the parameter. In the properties of variable 1, under "Options", select "Continuous Read". Configure variable 2 in the same way.
2. WinCCflexible: Create a new variable 1. In the events of variable 1, select "Change Value", select "Activate Screen" for the function, and select "Screen 2" for the parameter; select "Continuous Cyclic Acquisition Mode" for the general settings of variable 1. Configure variable 2 in the same way.
The principle behind this is that when variable 1 changes (whether from 1 to 0 or from 0 to 1), regardless of the current screen, it will switch to screen 2.
In WinCC Flexible, I usually do this: define only one variable (1), select "Change Value" for the event, choose "Activate Screen Number" for the function, and still select variable 1 as the parameter; note that each screen has its own screen number in its properties; select "Continuous Cyclic Acquisition Mode" for the general settings of variable 1. Variable 1 can use variables from the PLC.
The principle behind this is that at the start of the project, variable 1 is set to 1, displaying the screen numbered 1. When variable 1 changes to 2, the screen numbered 2 is displayed, and so on...