# LD UDFB Guided Learning Q02: – Advantages of a Latch, Set Reset Coils, and Numeric Methods

**URL:** <https://forum.digikey.com/t/ld-udfb-guided-learning-q02-advantages-of-a-latch-set-reset-coils-and-numeric-methods/56608>\
**Category:** Automation and Control\
**Tags:** guided-learning\
**Created:** [June 20, 2025, 6:06pm UTC](https://forum.digikey.com/t/ld-udfb-guided-learning-q02-advantages-of-a-latch-set-reset-coils-and-numeric-methods/56608 "2025-06-20T18:06:03Z")\
**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 20, 2025, 6:06pm UTC](https://forum.digikey.com/t/ld-udfb-guided-learning-q02-advantages-of-a-latch-set-reset-coils-and-numeric-methods/56608/1 "2025-06-20T18:06:03Z")

</div>

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](https://forum.digikey.com/t/building-a-user-defined-function-block-udfb-using-siemens-tia-portal/56095)  
📘 Learning Companion (Q&A): [Explore All Questions](https://forum.digikey.com/t/learning-companion-for-a-ladder-logic-based-user-defined-function-block/56388)

You are reading: Question 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).

**Type** : Explicit  
**Recommended for** : 🛠 Technicians, 🎓 Students

### Answer

As described in the primary article, we can select our state (memory) based on program complexity. Here are several methods to maintain a PLC’s state.

#### Latch

The [3-Wire start-stop circuit](https://forum.digikey.com/t/introduction-to-the-3-wire-start-stop-circuit/39176) is a very simple state machine based on an explicit latch. As seen in Figure 1 the M1 contact provides the holding current until the stop button is pressed.

#### Set/Reset Coils

Set and reset coils provide a succinct way to hold the states. They are not as verbose as the latch as the holding circuit does not need to be explicitly coded.

However, a moderately complex state machine such as described in the primary article would have an uncomfortable number of coils. Here the term “moderately complex” describes a state machine with multiple branches from any given state.

#### Cam or Drum Sequencers

Cam and drum sequencers provide a built-in method that is easy to read and to program. They are perfect for a machine that follows a deterministic path but can be complex when we need to jump across states. As an example, consider the cam indexer as shown in the previous question. If state “clamp” were encoded position C and state “fault” was position F, a fault detected in the clamp state would require us to quickly step through states D and E.

#### Numeric Methods

The numeric method as described in the primary article easily accommodates complex state transition with a structure that is clean and easy to follow. The beauty is that we can troubleshoot an error by monitoring the current state then testing the transition to each state.

 ![Figure 1: Wire diagram for the 3-wire start stop circuit developed using KiCad.](https://global.discourse-cdn.com/digikey/original/3X/5/f/5f058cfd99aaed2701d4af47e6e3eef604ffe591.png)

**Figure 1** : Wire diagram for the 3-wire start stop circuit developed using [KiCad](https://www.kicad.org/).

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