Many programmers know that labels (pointers) are used in program flow control (e.g. jump to label), but they may not know that labels are also used with function blocks.

This document aims to explain the use of labels with function blocks and what can be done to save labels.

Design Considerations

Every time a function block is used in a PLC program, and a new instance name is used, this uses a system label. For user defined function blocks this may be known but programmers may not know that this also applies to function blocks within the IEC standard instruction library. Examples of IEC standard instructions that are actually function blocks include the TON and TOF timer instructions.

For a Q00 or Q00J PLC there are only 300 labels available of which GX IEC Developer allocates 150 for function block use (often referred to as system labels – see example picture below). This default can be changed to include all 300 labels but it does mean that no more than 300 function blocks can be used in a Q00 or Q00J PLC program. For a Q02 PLC there are a maximum of 4096 labels so this is much less of a potential problem.

Methods of saving labels:

  1. Use Mitsubishi instructions and not IEC instructions that are actually function blocks with an instance name.
  2. Reuse the same instance name for different uses of the same function block (so long as there is no stored data within the function block – check rules on function blocks).
  3. Use the “Use Macrocode” compilation option (only applies to user-defined function blocks). See example below that can be obtained from the properties of a user-defined function block.

Further Information

For further information see the help system within GX IEC Developer.

[et_pb_divi_related_posts_module _builder_version="3.0.106" header_text="Related Posts" posts_count="5" posts_source="tags" /]