Declaring new variables

To create new variables, you can use the declaration editor or the Variables pane. You can also declare new variables directly from within the POU body. The procedure for this depends on which programming editor (LD/FBD, ST/IL or SFC) you use.

The following procedure requires that the Variables pane be opened.

  1. Select New variable from the context menu or use Tools > New variable...

    The dialog Create new variable opens.

    A warning indicates invalid field entries. Move the mouse over the triangle to display a tooltip on the data required.

  2. Under Location, select the location of the variable

    The variable can be declared in the header of the current POU header, in the global variable list or in a user-defined library (if available).

  3. Under Class, select a variable class

    The available classes depend on the declaration location.

  4. Under Identifier, enter a symbolic name
    • Do not use special characters such as !, ", $, %, brackets, etc.
    • The first character may not be a digit.
    • The last character may not be an underscore. An underscore may not be followed by another underscore.
    • The identifier may not consist of only an address, e.g. 'R0', 'DT0', 'LD0'. The identifier may not consist of only a keyword, e.g. 'ADD', 'ARRAY', 'INT'.
  5. For global variables: Enter address
  6. Select Type
  7. Enter initial value (optional)
  8. Under Comment, enter a text, if desired
  9. OK

    The new variable is created in the desired location.

    If you have created a global variable with this dialog, the new global variable is automatically declared in the GVL and inserted in the POU body as VAR_EXTERNAL.

Related topics:

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