# Modbus Write Recipe Wait for Tag Reset

**URL:** <https://forum.inductiveautomation.com/t/modbus-write-recipe-wait-for-tag-reset/85295>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [February 6, 2024, 2:02pm UTC](https://forum.inductiveautomation.com/t/modbus-write-recipe-wait-for-tag-reset/85295 "2024-02-06T14:02:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [February 6, 2024, 2:02pm UTC](https://forum.inductiveautomation.com/t/modbus-write-recipe-wait-for-tag-reset/85295/1 "2024-02-06T14:02:28Z")

</div>

I have a PLC that I need to write recipes to. This is done by loading values into Modbus tags, then setting an `Activate Data` tag to trigger recipe loading. The trigger tag gets reset to zero when finished.

When doing a series of these operations, what is the best way to wait and block on the tag to be reset? Doing a while loop with a tag read doesn't feel like the right answer.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 6, 2024, 2:12pm UTC](https://forum.inductiveautomation.com/t/modbus-write-recipe-wait-for-tag-reset/85295/2 "2024-02-06T14:12:20Z")

</div>

> Doing a while loop with a tag read doesn't feel like the right answer.

That's for sure.

Use a tag change event?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [February 6, 2024, 3:35pm UTC](https://forum.inductiveautomation.com/t/modbus-write-recipe-wait-for-tag-reset/85295/3 "2024-02-06T15:35:52Z")

</div>

I don't think that would work in my situation. I'm looping over recipes to load into the PLC, and so I need to block on the tag reset after each recipe load.

```auto
for recipe in recipes:
    # write recipe data
    system.tag.writeBlocking([tag],[value])
    # activate data
    system.tag.writeBlocking([tag],[value])
    # wait for data activation tag to reset before moving on 

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 6, 2024, 3:40pm UTC](https://forum.inductiveautomation.com/t/modbus-write-recipe-wait-for-tag-reset/85295/4 "2024-02-06T15:40:08Z")

</div>

You simply cannot do that. Make a state machine and call it from a timer event. Put the state in a memory tag. Every timer event, read the state, read the handshake, perform the next step if allowed, update the state.
