Home > IEC 61131-3 (english) > IEC 61131-3: Parameter transfer via parameter list

IEC 61131-3: Parameter transfer via parameter list

Parameter lists are an interesting alternative for transferring parameters to PLC libraries. Strictly speaking, these are global constants (VAR_GLOBAL CONSTANT) whose initialization values can be edited in the Library Manager.

When declaring arrays, their boundaries must be defined as constants. At the time of compilation, it must be known how large the array should be. The attempt to define the array boundaries by a variable is rejected with an error message.

  nUpperBound      : INT := 5;  
  aTest            : ARRAY [1..nUpperBound] OF INT;
// Compiler error: Border 'nUpperBound' of array is no constant value

Only the use of constants solves the problem.

  aTest            : ARRAY [1..nUpperBound] OF INT;
  nUpperBound      : INT := 5;

This can lead to problems, especially in PLC libraries. For example, if you want to map a data buffer to an array, it is not necessarily known at the time of library development how large this data buffer has to be in the respective applications.

The solution here is a parameter list, which is inserted when creating a PLC library.


A parameter list can be added at any point in the PLC project (the PLC project from which the PLC library originates). Parameter lists are usually created for the global variable lists (GVLs).


The parameters are declared as constant global variables.

{attribute 'qualified_only'}
  cUpperBound    : INT := 3;
  cString        : STRING := 'Hello';
  cIntArray      : ARRAY [1..cUpperBound] OF INT := [1, 2, 3];
  cStructArray   : ARRAY [1..3] OF ST_Test := [3( (nValue := 1,
                                                   fValue := 3.1,
                                                   wsValue := "abc") )];
  cEnum          : E_Test := E_Test.eValue02;
  cStruct        : ST_Test := (nValue := 1, fValue := 3.1, wsValue := "abc");

The variables can be pre-initialized by initialization values. Even more complex variable structures can be initialized with values.

These parameters can be edited in the Library Manager in the application in which the library was integrated. The Library Manager is opened by double-clicking on the respective library reference.


The fields in the column Value (editable) can now be changed as required. These changeable constants can be used within the respective PLC library or in the application that references them.

FUNCTION F_AddArrayValues : INT
  aTest      : REFERENCE TO ARRAY[1..Param.cUpperBound] OF INT; 
  nIndex     : INT;
FOR nIndex := 1 TO Param.cUpperBound DO
   F_AddArrayValues := F_AddArrayValues + aTest[nIndex];

The changed initialization values are stored in the respective PLC project file (*. plcproj). Thus, each application that references a library with a parameter list has its own values. The library itself remains unchanged.

The values set in this way also withstand a PLC reset, both a cold reset and resetting to the original values. The values are not reset until the library is removed and reinserted. This means that parameter lists can also be used to transfer general parameters.

All parameters in a parameter list are usually accessible via ADS. The fact that parameters always have to be declared with CONSTANT does not prevent them from being written via ADS.

If a parameter is used as an array boundary, changing these variables will have serious consequences. Especially if the value of the parameter is increased.

aTest   : ARRAY [1..MyLibrary.Param.cUpperBound] OF INT;

Even if the parameter is increased at runtime of the PLC program, the array retains its original size. If this parameter is also used in the loops, accesses outside the allowed array boundaries can occur.

FOR nIndex := 1 TO MyLibrary.Param.cUpperBound DO
  aTest[nIndex] := nValue;

To prevent this, the attribute tc_no_symbol can be used to prevent ADS symbol generation. Access via ADS using the symbol name is then no longer possible for this parameter.

  {attribute 'tc_no_symbol'}
  cUpperBound             : INT := 5;
  1. Alexey
    September 11, 2017 at 8:04 am

    Mr. Henneken thank you for the article.
    It is very helpful for me.

  2. Aliazzz
    September 11, 2017 at 6:35 pm

    ADS is a Beckhoff specific protocol. Can you think of generic protocol alternatives available to access the properties of the parameter list?
    I suppose netvars, if they are supported by the target runtime, but what else?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: