omron — A2W_Pushbutton_Brochure_EN_201805_A47IE01

 Using Visual Basic (Switching the Screens by the “Page” Variable) By default, the page name is automatically specified as “Page” followed by the sequential number, such as “Page0”, “Page1”, … You can utilize that to switch screens by fixing the “Page” part while defining the numerical value part as variable, and modifying the variable value. Note, however, that you cannot use this method if the page name has been changed from default. 1. Declare on the NJ side a Numerical-type variable to store page numbers. 2. Declare on the NA side the following variables. NJ_1_PageNumber: links with the page number variables set on the NJ side. Page_No: stores page numbers. Page_Str:

set “Page” as the initial value. Used in Visual Basic described below. Page_No_Str: a String-type variable that stores the numerical value part of the Page. 3. In the global subroutine, write the code as shown on the right. By converting the page numbers into text strings and linking them to “Page”, the initial value of “Page_Str”, the text strings such as “Page0” or “Page1” that correspond to the page names are created. The screens can then be switched by assigning the text strings to “_HMI_CurrentPage”, the system variable that indicates page names. 4. In the [Global Events] tab page, specify the conditions to execute the code created in Step 3.

The figure on the right shows that the code created in Step 4 is executed every 100 msec. 5. Changing the value of the “PageNumber” NJ variable switches the screen from the PLC. 44