This article is part of a guided learning series on building and analyzing User-Defined Function Blocks (UDFBs).
Canonical Article: Building a User-Defined Function Block (UDFB) Using Siemens TIA Portal
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: Technicians,
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.
Article by Aaron Dahlen, LCDR USCG (Ret.), Application Engineer at DigiKey