07-24-2025 07:19 AM
Hi everyone,
I'm working on a test bench software where I acquire data in an Acquisition Module. This module sends data via Broadcast in the Timeout case of a Helper Loop.
Currently, two modules are successfully receiving this broadcast:
So far, everything works fine.
Now, I have a third module that contains a state machine in the MHL (Message Handling Loop). Inside this state machine, I also need access to the data — specifically to check whether the values are within certain limits.
I tried the following approach:
However, this approach caused issues:
My question: Is there a better way to receive data inside a state machine in an MHL without interfering with the broadcast mechanism?
Would it be a good idea to register for the Broadcast directly inside the state machine? Or is there a more robust pattern for this kind of scenario?
Any suggestions or best practices would be greatly appreciated!
Thanks in advance!
07-24-2025 08:17 AM
I think that the broadcast is the best way to share your data from the acquisition module. There is no need to put additional methods for the same task.
My advice is to receive the broadcast inside the EHL of the state machine module and pass it directly to a notifier. Inside the state machine you can get the latest data from the notifier at the moment you need it as it is cyclically updated in the EHL.
07-24-2025 08:43 AM
Hi Fabian,
The way I get the latest broadcasted data in a state machine is to have the SM in the timeout case of a helper loop and register for the particular data broadcasts that the SM logic needs. The latest data is then passed around the HL in a data cluster which can be unbundled and used in the SM. I've not run into problems with the data broadcast being at a higher rate than the Timeout, but then again, I've also been using the Wovalabs HL utility to handle the timeout value.
07-25-2025 03:24 AM
Thanks everyone for your ideas and support!
Some comments regarding SC_boy's suggestion:
I initially tried that approach, but ran into an issue. When I'm inside the state machine (SM) within the event structure, I don't receive any data because I'm already handling the timeout case in the SM. So receiving data during the SM procedure wasn't feasible in my setup.
Instead, I followed the method described by Ludwig72 with one modification:
I receive the broadcast outside the Event Handling Loop (EHL) of the module. I created a dedicated SM-Sub-VI and then passed the data to the SM using a notifier inside the Sub-VI. This setup works well so far, and I hope it remains stable without causing issues down the line.
Here's a screenshot of the implementation:
Thanks for your comments.
07-27-2025 06:04 AM
All sound advice here.
Personally, I don't like having the state machine inside the MHL. Instead, here at HSE, we have our open-source State Machine module template which implements the state machine in a helper loop.
DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )