Program Variables facilitate the transfer of values between the HMI Dashboard and the Control Program. These allow users to read and write values used by the IG21's PLC logic.
To create a Program Variable, navigate to the gateway's program by clicking Industrial >> Control >> Details.
On the next screen click Edit. This brings you to the Structured Text programming screen. For additional information please see our article on programming the IG21.
To the right of the screen you will see the word "Variables", which is where program variables are listed. The wrench icon will create a new Data Input you can associate with a variable in the structured text. The downward arrow will allow you to associate an existing Data Input with a structured text (ST) variable.
New Program Variable
When you click the wrench icon, the below image pops up. The name you enter here will be the default name of both the ST variable and the created Data Input. Both are editable after creation.
Entering 'testvalue' as the name results in a program variable as shown below. The top field is the ST variable name and can be changed here by clicking in the field. The bottom field is the Data Input name and can be changed from the Data Inputs screen. Notice that the name of the IG21 precedes the default variable name. This variable can now be used in the HMI Dashboard like other Data Inputs.
A Program Variable should not be defined within the structured text itself. Once in this list it can be referenced like any other variable. For programming purposes it is of type IREAL and requires a decimal point in any calculations or comparatives. When it has a value it will be displayed at the bottom.
Program Variable with Existing Data Input
To use an existing data input (that is not coming into the IG21's IO terminals) simply click the downward arrow. You can then enter the ST variable name of your choice and select the appropriate Data Input from a drop down selection. In this example I am using a register read over Ethernet/IP to represent a tank level. Notice the current reading of the value is 0.