LD UDFB Guided Learning Q13: Modify the featured UDFB so that a single timer resource is usedA

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 13

Modify the featured UDFB so that a single timer resource is used.

Answer

This is left as a design exercise for advanced students.

Please consider this Structured Text (ST) article as a guide.

Observe:

  • Single timer instance
  • Several move operators to select between timTransition and timGlitch depending on the desired time for each state
  • The timer is reset on each state transition.

Tech Tip: This may be an academic exercise, as the code is easier to understand when individual timers are used. In my opinion, it makes sense for a structured text implementation but has questionable value for field deployed ladder logic implementation. Stated another way, ladder logic is prized for its simplicity, don’t clutter the code unless it is absolutely necessary to same memory.

At the same time, I challenge each of you to construct the ladder logic code to better understand the flow and subtle interaction between the state changes and the timer.

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