Quit all loops when an error happens in one loop

Thursday, August 22nd, 2013

When I tried to do parallel tasks (e.g. multiple producer/consumer loops) in LabVIEW, it was always painful to quit all loops “elegantly”. What I wanted was a notifier to tell all loops when an error occours in any loop. I know there are a few error manager VIs in the internet already but I just reinvented the wheel anyway.

In this error manager.vi there are 3 states: reset (clear errors in the shift registor), read (monitor if there is an error) and hold (stop reading when error).

sub3 sub1 sub2

So I sort of created a functional global variable here using the single loop to store the error. You can use this VI in every loop and it will quit all loops if an error happens. Here is an example:

topNote that we need to initialize the error manger before using it. When an error button is pressed in a loop, all loop will quit.

Hope this is useful to you:)

Advertisements

One comment on “Quit all loops when an error happens in one loop

  1. Andras Valko says:

    Hi!

    This is a pretty cool thing to have, I usually use something like this in all my multi-loop projects because it saves me the headache of sending error messages to every single loop. You can also incorporate a standard stop function here. My flavor usually uses the Error (and stop information) stored to set output state, so there is no need for a separate “Hold” state.

    Cheers:

    Andras

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: