Global variables list

Global variables are available for the entire project. They can be transferred from the global variable list to a POU header. Global variables can be declared very comfortably in the POU body (using LD/FBD, ST/IL or SFC). Or use the declaration editor to create the global variable list.

Do not assign addresses unless you have to! Provide addresses for PLC inputs and outputs (X, Y) or if access to certain memory areas is required.The compiler automatically assigns addresses after the power has been turned on. This prevents errors caused by duplicate outputs and ensures that the addresses are automatically updated when the PLC type is changed.The following variables must be declared in the global variable list:

  • Variables which are assigned to inputs and outputs, e.g. X0, Y0 of the PLC
  • Variables which need to be assigned to a certain address, e.g. DT0, to enable communication with an operator device
  • Variables which need to be accessible from other POUs (via VAR_EXTERNAL)

You can enter addresses in one of the following formats:

  • FP format, e.g. X0. The corresponding IEC address is generated automatically when you move to the next field.

  • IEC format, e.g. %IX0.0. I = input, X = bit and 0.0 for first unit and first input. The corresponding FP address is generated automatically when you move to the next field.

Related topics:

Explanation of fields

A project has a list of global variables. The global variable list (GVL) applies to all POUs in the project.

The fields in the variable lists have the following meaning:

  1.  (1) Class is the variable class, e.g. VAR_GLOBAL, VAR_GLOBAL_CONSTANT, etc.
  2.  (2) Identifier is the symbolic name that is used in the program.
  3.  (3) FP address or IEC address is the physical address which is assigned to the variable.
  4.  (4) Type: after entering an address, a data type is automatically preselected (e.g. BOOL, INT, STRING). Another type can be selected from the list.
  5.  (5) Initial is the starting value which is assigned to the variable whenever your PLC is started. You can change the value if required.
  6.  (6) Autoextern inserts the global variable automatically into the headers of all current and future POUs displayed in the Project pane. This function can be permanently activated under Extras > Options > Program options > Editors > Declaration editors.
  7.  (7) Comment is a description of a variable.
NOTE
  • Identifiers may not start with a number.
  • Identifiers using a special syntax can determine the data type according to the prefix table.
  • FP addresses (X0, Y1, etc.) are fixed terms and may not be used as identifiers.
  • Do not assign addresses unless you have to! Provide addresses for PLC inputs and outputs (X, Y) or if access to certain memory areas is required.

  • You can enter addresses in one of the following formats:

    • FP format, e.g. X0. The corresponding IEC address is generated automatically when you move to the next field.
    • IEC format, e.g. %IX0.0. I = input, X = bit and 0.0 for first unit and first input. The corresponding FP address is generated automatically when you move to the next field.
  • To add empty lines to the list, press <Shift>+<Return>
  • Insert new lines with Edit > New declaration > Top > Before > After > Bottom
Related topics:

Modified on: 2019-12-10Feedback on this pagePanasonic hotline