LD UDFB Guided Learning Q03: – Describe UDFB mapping and memory

This article is part of a guided learning series on building and analyzing User-Defined Function Blocks (UDFBs).

:pushpin: Canonical Article: Building a User-Defined Function Block (UDFB) Using Siemens TIA Portal
:blue_book: Learning Companion (Q&A): Explore All Questions

You are reading: Question 3

Describe UDFB mapping and memory including input, output, static, and constant.

Type: Explicit
Recommended for: :hammer_and_wrench: Technicians, :graduation_cap: Students

Answer

Collectively, this list identifies the UDFB’s input and out interface as well as the memory structure.

Inputs and Outputs

The UDFB follows a left to right flow with input on the left and outputs on the right. Part of the programmer task is to define the type associated with each input and output. The example program used type Boolean, time, and string.

Note that the ladder logic representation also includes an enable input and an enable output. These are used to β€œhang” an instantiated UDFB on the rung.

Static

The UDFB’s static reserves memory for the UDFB. The name static appears to be a holdover from the C programming language. In both cases, static is a keyword indicating that the memory is preserved over function calls. This is vital function used to maintain the uiState in the featured program.

Constants

Constants make the program more human-readable. This is a mapping process where a human readable tag (e.g., uiStateFault) is associated with a number (e.g., 4) or other memory type. The human will use the tag. However, upon compilation, the PLC’s compiler will substitute the associated number.

:writing_hand: Article by Aaron Dahlen, LCDR USCG (Ret.), Application Engineer at DigiKey