04-08-2015 01:41 PM
I had posted earlier about a program I inherited with Create User Event and Register For Events.
http://forums.ni.com/t5/LabVIEW/confused-by-Create-User-Event/m-p/3095641/
The program has a Producer loop which has an Event Structure with one of the event cases being <error in (no error)>: User Event.
I was under the impression that this event case will catch when there is an error in the consumer loop, but it doesn't.
The Producer loop continues running.
04-08-2015 01:50 PM
What exactly is the question? Without seeing any code in your producer loop, we can't know what's happening. If you wire the error wire to the Generate User Error error terminal, and also to the Event Data input, and there's an error, then you won't actually generate an error event. Or, if you figured that out so you disconnected the error input to Generate User Event, but continued to use the Error Out terminal, then you'll have accidentally cleared the error. Also, just generating a user event with error data will have no effect on whatever else the producer loop is doing.
04-08-2015 01:51 PM
04-08-2015 02:00 PM
@nathand wrote:
What exactly is the question? Without seeing any code in your producer loop, we can't know what's happening. If you wire the error wire to the Generate User Error error terminal, and also to the Event Data input, and there's an error, then you won't actually generate an error event. Or, if you figured that out so you disconnected the error input to Generate User Event, but continued to use the Error Out terminal, then you'll have accidentally cleared the error. Also, just generating a user event with error data will have no effect on whatever else the producer loop is doing.
This is how the original programmer set up the Producer loop.
04-08-2015 02:02 PM
@mikeporter wrote:
It doesn't do it automatically if that's what you mean. Something still has to fire the event. On my blog I created a system that has a separate event handler loop. I then created a separate VI that goes in all the other processes that fires the error event if an error occurs.
Remember that an error event is just a UDE the data of which happens to be an error cluster. By the way, you may find it easier to work with the data from the event if when creating the event reference you put the error cluster inside another cluster. If you do, the event data will be an error cluster. The way you have it now, there are three separate data values in the event data.
Mike...
I am not sure how to fire the error event in the Consumer loop.
I don't see any code that does that.
04-08-2015 02:04 PM
04-08-2015 02:04 PM
04-08-2015 02:06 PM
@nyc_(is_out_of_here) wrote:
I am not sure how to fire the error event in the Consumer loop.
I don't see any code that does that.
Normally this would be done by using the Generate User Event function, this would be like an Enqueue putting an event to be handled. Then your event structure will dequeue that in the case registered for that user event.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
04-08-2015 02:08 PM
If you follow that user event reference around, you should see a Generate User Event function being called. That is what would be causing your producer loop to process the error data (ie, it must be sent to the producer loop via the User Event).
04-08-2015 02:20 PM
Thanks for all the help.
He has a Generate User Event in two places.
This code is a mess, and I have been trying to figure out why in some instances errors aren't being caught and the Producer loop is not stopping.