Declaring global variables

To declare variables using the declaration editor, follow the procedure below. Variables can also be declared very comfortably in the POU body (using LD/FBD, ST/IL or SFC) or in the Variables pane.

NOTE
  • 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.
  • To structure your program, you should declare all global variables in the global variable list before starting to program.
  1. Open Global variables from Project pane
  2. Under Class, select a variable class
  3. Under Identifier, enter a symbolic name

    Only execute the next two steps for inputs and outputs of the PLC or when a certain address assignment is required for the variable, e.g. when data are exchanged with operator devices.

  4. Enter address in FP format, e.g. X0

    The corresponding IEC address is generated automatically when you move to the next field.

    or enter address in 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.

  5. Under Type, select to open the Type selection dialog
  6. Under Type class, select the desired data type class
    • Elementary data types
    • Data unit types
    • Function blocks
  7. Under Library, select the desired library
  8. OK
    The initial value preset for the selected data type is displayed automatically. You can change this value at any time.
    Optional:
    • Select Autoextern to automatically insert them into all POU headers
    • Under Comment, enter a text, if desired
Related topics:

Modified on: 2020-10-01Feedback on this pagePanasonic hotline