LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1 with De-Queue on STOP?

Hi everyone,

 

Attached is a vi I have been working on (using simulated DAQ cards; so data are sine waves)... When I press 'STOP' I get "Error 1" warnings; something to with de-queue inputs? Any suggestions?

 

Thanks,

Jack

0 Kudos
Message 1 of 23
(4,025 Views)

Well, your stopping your loops when you get an error on your queues.  You are getting an error (invalid reference) in your consumer loops when you destroy the queue right after the producer loop.  This is expected based on your code.  You might want to catch error code 1 and clear it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 23
(4,016 Views)
Ok... Makea senses... How might you stop both consumer loops to avoid errors?

Thanks,
Jack
0 Kudos
Message 3 of 23
(3,994 Views)

@jcannon wrote:
Ok... Makea senses... How might you stop both consumer loops to avoid errors?

Thanks,
Jack

I've actually seen examples where they wire the error to the conditional terminal and jump out that way.  They then swallow the error so you don't see it.  I guess you can read the value of the stop button and wire that to the conditional terminal also.  You can also make the consumer loops into state machines and have separate queues and have the producer issue shutdown states to each consumer.  (Useful because it is scalable.  Complicated if you don't need scalability.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 23
(3,989 Views)

Well, for your DAQ loop, you already have a STOP in the enum.  Why not just exit when you get that command?  Also, don't release the queue to send data to the DAQ loop until after the DAQ loop is complete.  The top loop can just exit on the error.  That's not nearly as big of a deal.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 23
(3,970 Views)

Hi crossrulz,

 

I have been working on this for almost a week and I am still unable to get this to work... I always get the error message no matter what I do OR some but not all loops stop (which leaves a loop hanging)...

 

Any chance you could post a basic example of what you mean? I must be doing something wrong... The attached is my latest attempt...

 

Regards,

Jack

0 Kudos
Message 6 of 23
(3,924 Views)

Move the Release Queue functions to after the respective consumer loops.

0 Kudos
Message 7 of 23
(3,919 Views)

Thanks RavensFan... That worked...

 

However, I have used a notifier to stop all the loops, rather than a queue (as I only need one notifier, rather that a queue between each loop)... I assume that is ok and appropriate coding practice...

 

I now have another problem.. In my UE Command Loop I would like to add ALL user commands that will be used in the vi, such as menu commands for read, idle and stop, plus other boolean comments that might, for example, change the x axis scale on wavefort charts... Currently, the way I have this set-up makes the chart flicker...

 

It it possible to have ALL user commends send in the one queue so that the number of wires can be reduced? Attached is my current code.

 

Thanks,

Jack

0 Kudos
Message 8 of 23
(3,888 Views)

Why did you change from using queues to notifiers?

 

Now you have several loops that execute based on a notifier.  With queues, the loops will wait until something is in the queue which effectively throttles the loop.  Now that you are using "Get Notifier Status" those same loops are running as fast as they can.  That is probably why thinks look like they flicker.  You aren't yielding any real time to the CPU to take care of display updates.

 

Go back to using queues.  At least put wait statements in your loops if you insist on continuing the way you are now.  It scares me when someone is improving their code, then suddenly decides to change the way they are doing something for no apparent reason.

0 Kudos
Message 9 of 23
(3,879 Views)

You're getting flicker because in your Data Display loop, the only case that writes valid data to the graph is the RUN case. Your writing default data to the graph otherwise. Just saw Ravensfan reply so maybe I'm all wet on that.

 

I'd also recommend taking all your DAQ setup code and putting it into a subVI.

0 Kudos
Message 10 of 23
(3,878 Views)