Introduction

In the LL984 Editor you can assign a variable (like _400001 or sym1) or an address (like %M1) to an FFB pin or to a contact/coil.

If the variable is not declared, the Create variable? dialog opens.

If the variable or address assigned is not compatible with the pin or contact/coil, a message will be displayed in the output window after Build > Analyze .

Automatic Variable Naming

If you, for example, assign an address (e.g. %MW1) to a pin, the Create variable? dialog opens proposing a variable name (e.g. _400001) and a data type (e.g. UINT).

The following rules apply to this automatic proposal, depending on the address of the actual parameter, the pin type and dimension (n) in case of an array type:

Address

Pin Type

Dimension (for array types)

Variable Name

%MW1

UINT

1 (n)

_400001 (_400001_n)

INT

_400001_I (_400001_In)

WORD

_400001_W (_400001_Wn)

%IW1

UINT

1 (n)

_300001 (_300001_n)

INT

_300001_I (_300001_In)

WORD

_300001_W (_300001_Wn)

%I1

EBOOL

1 (n)

_100001 (_100001_n)

%M1

EBOOL

1 (n)

_000001 (_000001_n)

NOTE: For the most used pin types UINT and EBOOL no type suffix are appended to the proposed variable name.

Use Case 1

Assignment to a pin of type UINT

User-Assigned Address

Variable

Variable Created and Assigned

Variable Type

%MW1

not existing yet

_400001

UINT

NOTE: As the pin type was UINT no type suffix was appended to the variable name.

Use Case 2

Assignment to a pin of type ARRAY[1...n] of UINT

User-Assigned Address

Variable

Variable Created and Assigned

Variable Type

%MW1

not existing yet

_400001_n

ARRAY[1...n] of UINT

Use Case 3

Assignment to a pin of type ANY or ANY_ARRAY_UINT or ANY_ARRAY_BOOL (dynamic array)

The dimension (n) of a dynamic array will be provided by another dimension pin (e.g. LENGTH) of the function block.

This dimension pin will be initialized during block insertion.

The dimension of the array will be calculated based on the dimension pin value entered as actual parameter of the dimension pin.

  • If the resulting type is a UINT array:

    dimension = dimension pin value.

  • If the resulting type is a Boolean array:

    dimension = dimension pin value * 16.

User-Assigned Address

Variable

Variable Created and Assigned

Variable Type

%MW1

not existing yet

_400001_n

ARRAY[1...n] of UINT

If you modify n on the dimension pin to n2:

User-Assigned Address

Variable

Variable Created and Assigned

Variable Type

%MW1

not existing yet

_400001_n2

ARRAY[1...n2] of UINT

%MW1

already existing

_400001_n2

attributes (like descriptors, comments etc.) are taken over

ARRAY[1...n2] of UINT

Use Case 4

Assignment to a pin of type DDT1

User-Assigned Address

Variable

Variable Created and Assigned

Variable Type

%MW1

not existing yet

_400001_DDT1

DDT1

Memory Consumption

If you create any kind of located variables (elementary type, array or DDT) this will not increase memory consumption on the PLC (except for Upload information).

New Variable Creation

If you assign a different address or modify a dimension pin, a new variable will be created.

The old attributes (except the address) will be overtaken and the old variable will be deleted, if it is not used anywhere else in the program.

Invalid Variables

If you create a located variable with an address range which exceeds the address range defined under State RAM of the CPU´s Configuration tab, the following message will be displayed after Build > Analyze:

Topological address index is not valid.

There are different ways to solve this issue:

  • Click the message displayed in the output window to open the Data Editor and adapt the address of the variable.

  • Click the message displayed in the output window to open the Data Editor and delete the variable and create a new variable with an applicable address range.

  • Adapt the address range defined under State RAM of the CPU´s Configuration tab.

NOTE: If you just create a new variable at the pin of the function block without deleting the previously created, invalid variable the message mentioned above will be displayed again after next Build > Analyze .

Example:

Under State RAM of the CPU´s Configuration tab you entered a value 10000 for %MW.

In your program you have an L_BLKM function block with LENGTH = 10.

At the SOURCE pin of the function block you enter following value: %MW9999.

This results in creation of the following variable:

_409999:ARRAY[1..10] OF UINT@%MW9999

As the start address is %MW9999 and the length is 10, the end address will be %MW10009.

This exceeds the address range (10000) defined under State RAM of the CPU´s Configuration tab.

Therefore the message mentioned above will be displayed after Build > Analyze.