Introduction To Variables On The NA


Variables are at the heart of the NA Series Machine Interface. The NA is a variable based system, so learning how to configure and use variables properly is very important.
There are several different kinds of variables that exist in the NA:

‐ System variables
‐ Global HMI variables
‐ Internal device variables (other controllers within the Sysmac project)
‐ External device variables (other NJ/CJ controllers)
- VB (local) variables

Like in a controller, to use device variables they have to be mapped. This then creates global HMI variables for this mapping and they appear in the global variable list.

For complete list of NA HMI System variables please read 'Introduction to NA System Variables' article.

Global Variables:

Global variables editor can be found in “Programming – Data – Global Variables” section. The user can create new variables in this section:


The following properties are available for mapped and not mapped variables:

1. Initial Value
A variable can have an initial value applied upon runtime initialisation. This can be applied to all basic data types, but cannot be applied to a Network Variable mapped to an NJ Global variable.

2. Retain
The Retain property will cause the last known value of a variable in runtime to be retained and automatically reapplied when the HMI re-starts, in the following list of circumstances.

• Power off \ power on cycle
• Stop and Restart runtime execution

NOTE: If variables have both the Retained property enabled and an Initial Value applied, the retained value takes precedence. On runtime initialisation the retained value overwrites any Initial Value attributed to the variable.


The Retain property can be applied to all basic data types. When applied to an array variable, the Retain property retains and applies the value of each array element individually.
The Retain property cannot be applied to a mapped Variable. The user can choose to not initialise the retained values when downloading a project

3. Constant
The constant property makes the variable a constant, with the value as defined in the ‘Initial Value' Field. The value of the variable cannot be changed programmatically and any attempt to change the value in the application by assignment should result in a compilation error.
The Constant property can be applied to all basic data types, and to array variables.
The Constant property cannot be applied to a mapped Variable.

A description can be defined up to a max length of 2048 characters

5. AT Field
The AT field describes the mapping relationship to a device and the data location in that device. The user should not need to understand the format.

6. Read-Only Property
Field defining the Read-Only property of a Network Variable. Read-Only variables can be read from an external device, but are never written to it.

7. Update Rate (mapped variables only)
Mapped variables have their values read at regular intervals from the registered devices (by default this is every 500ms). The Update Rate defines the regular Interval at which the value is read. The update rates that can be applied are fixed within the system and limited to values in the following list.

None (i.e. the variable is write-only)
100 Milliseconds
500 Milliseconds
1 Second
2 Seconds
5 Seconds
10 Seconds
30 Seconds
1 Minute
5 Minutes
10 Minutes
30 Minutes
1 Hour

Data Types

NA HMI is .NET based platform, because of that all the NA global variables data types are VB.NET data types
To learn more about NA Data Types and how NJ (IEC) variables convert to NA variables please read 'Introduction To NA Data Types And Variables' article.
To learn more about Mapping Variables please read the 'Introduction To Mapping Variables On The NA' article.

Local (VB) NA variables

Further variables can be created and are known as ‘local variables’. These only exist in VB and within the scope of the declaration. They can be declared as a page variable (at the top of the Page.vb), or within a sub routine.


Global vs. Local

Local variables can be used only within the VB code. They cannot therefore be used for Animations, Events or object Expressions even within the page they were declared.
Page Local variables keep their values at all times during runtime.
Local variables declared within the sub, will keep its value only during execution of the sub they were declared in.
Global variables can be used and referred to anywhere, across the whole project.

For the list of which variables can be used on specific objects, actions, and code functions, including relevant data types, please read 'Using NA Global Variables with Objects and Methods' article.

See Also:

Introduction to the NA series HMI