# Learning Companion for a Ladder Logic Based User-Defined Function Block

**URL:** <https://forum.digikey.com/t/learning-companion-for-a-ladder-logic-based-user-defined-function-block/56388>\
**Category:** Automation and Control\
**Tags:** engineering-briefs\
**Created:** [June 14, 2025, 12:20am UTC](https://forum.digikey.com/t/learning-companion-for-a-ladder-logic-based-user-defined-function-block/56388 "2025-06-14T00:20:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![APDahlen](https://sea2.discourse-cdn.com/digikey/user_avatar/forum.digikey.com/apdahlen/32/40191_2.png) [@APDahlen](https://forum.digikey.com/u/APDahlen)\
**Post date:** [June 14, 2025, 12:20am UTC](https://forum.digikey.com/t/learning-companion-for-a-ladder-logic-based-user-defined-function-block/56388/1 "2025-06-14T00:20:36Z")

</div>

This page contains a series of questions to accompany an article exploring ladder logic as applied to a User-Defined Function Block (UDFB) built using the Siemens TIA Portal. Please review the [primary article](https://forum.digikey.com/t/building-a-user-defined-function-block-udfb-using-siemens-tia-portal/56095) to provide context for the following questions.

These questions may be assigned as homework, an interactive group discussion, or as part of an AI-directed learning exercise. Note that the AI can serve as a strong sounding board from which you can explore the questions.

📌 Canonical Article: [Building a User-Defined Function Block (UDFB) Using Siemens TIA Portal](https://forum.digikey.com/t/building-a-user-defined-function-block-udfb-using-siemens-tia-portal/56095)

 ![Figure 1: Image of the Siemens S7-1200 used to develop and test the UDFB-embedded state machine code.](https://global.discourse-cdn.com/digikey/original/3X/0/d/0d50f690bb48f1caf2f41e0e98ece189632b5ee3.jpeg)

**Figure 1** : Image of the Siemens S7-1200 used to develop and test the UDFB-embedded state machine code.

## Recommendation for use of an AI-based More Knowledgeable Other (Vygotsky’s MKO)

This learning companion may be used as a self-guided tool with the AI serving as a sounding board. For the most effective learning:

- Provide context for the AI by directing its attention to the [canonical article](https://forum.digikey.com/t/building-a-structured-text-user-defined-function-block-udfb-using-siemens-tia-portal/56241).

- Point the AI to this page and prompt it to ask each question, one at a time, from this list and provide feedback from the perspective of an experienced control system’s engineer.

- Provide complete answers and ask for clarity where required.

## Question organization in this document

Questions are listed in order of increasing complexity.

- **Explicit** : The first questions are taken directly from the associated document. They are practical and directly test your understanding of the material.

- **Implicit** : Questions in the middle offer increasing levels of complexity. Instead of implicitly questioning the material, they ask the reader to deeply consider the material and draw parallels to related topics.

- **Topic Adjacent** : The final critical thinking question(s) address topics adjacent to the article material. These critical thinking questions expand the article’s content allowing you to develop a big picture understanding of the material and its relationship to adjacent topics. They are often open ended, require research, and are best answered in essay form.

### Each question is categorized with a recommendation audience:

- 🛠 Technicians – Practical, troubleshooting-oriented

- 🎓 Students – Academic understanding

- 🧪 Capstone students and field engineers – system-level analysis, design tradeoffs

* * *

## Questions for anchored AI-assisted learning

This section contains a list of questions with answers to help you better understand the material.

📌 Canonical Article: [Building a User-Defined Function Block (UDFB) Using Siemens TIA Portal](https://forum.digikey.com/t/building-a-user-defined-function-block-udfb-using-siemens-tia-portal/56095)

### 1) What is a state machine? 🛠🎓

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q01-what-is-a-state-machine/56607)

### 2) What are the advantages and disadvantages of each method used to hold a PLC’s state? At a minimum include the latch, set/reset coils, and numeric methods (integer state variables). 🛠🎓

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q02-advantages-of-a-latch-set-reset-coils-and-numeric-methods/56608)

### 3) Describe UDFB mapping and memory including input, output, static, and constant. 🛠🎓

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q03-describe-udfb-mapping-and-memory/56609)

### 4) Define enumeration and then describe how it assists with the design and maintenance of a state machine. 🛠🎓

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q03-define-enumeration-as-related-to-a-plc-based-state-machine/56610)

### 5) What is the difference between an edge-triggered and a level-sensitive UDFB? 🛠🎓

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q05-difference-between-edge-triggered-and-level-sensitive-udfb/56613)

### 6) How is PLC-based numeric state machine like a C case-switch statement? 🎓

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q06-how-is-plc-based-numeric-state-machine-similar-a-c-case-switch/56614)

### 7) Construct a graphical bubbles and arrows representation of the featured state machine. Ref: [FSM State Diagrams](https://forum.digikey.com/t/finite-state-machine-fsm-state-diagrams-with-latex/37780) 🛠🎓

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q07-construct-bubbles-and-arrows-representation-of-the-state-machine/56637)

### 8) The fault reset network considers both NOT xEnable and xReset as necessary conditions to perform a reset. What would happen if the NOT xEnable condition were removed. Be specific and explore this from the operator’s perspective. 🎓

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q08-what-would-happen-if-the-not-xenable-condition-were-removed/56638)

### 9) Identify the implicit one shot in a state machine. 🎓 🧪

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q09-identify-the-implicit-one-shot-in-a-state-machine/56639)

### 10) Select appropriate values for timGlitch and timMove in a motor starter? 🎓 🧪

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q10-select-appropriate-values-for-timglitch-and-timmove-in-a-motor-starter/56640)

### 11) What is state fall through for a state machine? 🎓 🧪

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q11-what-is-state-fall-through-for-a-state-machine/56641)

### 12) Should we use an unsigned int or type double as the state variable? 🎓 🧪

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q12-should-we-use-unsigned-int-of-double-as-the-state-variable/56642)

### 13) Modify the featured UDFB so that a single timer resource is used. 🎓 🧪

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q13-modify-the-featured-udfb-so-that-a-single-timer-resource-is-used/56643)

### 14) How to account for a motor overload. 🧪

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q14-how-to-account-for-a-motor-overload/56647)

### 15) Modify the state machine to drive a dual coil DCV. 🧪

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q15-modify-the-state-machine-to-drive-a-dual-coil-dcv/56648)

### 16) How can a UDFB’s fault status string be used with an HMI? 🧪

[Answer](https://forum.digikey.com/t/ld-udfb-guided-learning-q16-how-can-a-udfbs-fault-status-string-be-used-with-an-hmi/56649)

## About this author

Aaron Dahlen, LCDR USCG (Ret.), serves as an application engineer at DigiKey. He has a unique electronics and automation foundation built over a 27-year military career as a technician and engineer which was further enhanced by 12 years of teaching (interwoven). With an MSEE degree from Minnesota State University, Mankato, Dahlen has taught in an ABET-accredited EE program, served as the program coordinator for an EET program, and taught component-level repair to military electronics technicians. Dahlen has returned to his Northern Minnesota home and thoroughly enjoys researching and writing articles such as this.
