In our projects, we sometimes need to switch the screen display on the touch screen using variables external to the PLC . For example, I want the touch screen display to automatically switch to the desired screen after pressing a button, instead of having to press the screen switching button on the touch screen.
Let's look at how to achieve this functionality on a Siemens touchscreen. Many functions in Siemens touchscreens are implemented by calling system functions. Similarly, the screen switching function can also be achieved by calling system functions.
To achieve the function we just mentioned, we need to complete it in three parts.
First, create a variable on the touchscreen. The variable's data type should be INT. For example, create a variable named VW0. In the variable's properties, in the "Event" section, select "Change Value" and then call the system function "ActivateScreenByNumber". After calling this system function, select the variable VW0 that we just created in the "Screen Number" section.
Second, in the "General" section of the created screen properties, set a number for each screen in the "Screen Number" column. Note: the numbers cannot be repeated.
Third, write a PLC program. For example, if I need to switch to screen number 2 after pressing the I0.0 button, then I use I0.0 in the PLC program to activate a transmission command to transmit 2 to VW0. In this way, the screen on the touch screen will automatically switch to screen number 2. If I need to switch to screen number 3, then I transmit 3 to VW0.