LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

User Event not caught

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.

 

 

0 Kudos
Message 1 of 13
(4,240 Views)

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.

0 Kudos
Message 2 of 13
(4,234 Views)
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...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 13
(4,229 Views)

@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.

Capture.PNG

0 Kudos
Message 4 of 13
(4,221 Views)

@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.

 

 

0 Kudos
Message 5 of 13
(4,218 Views)
But what is firing the event? And what is the producer loop doing in response?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 13
(4,214 Views)
You need to post your code.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 13
(4,210 Views)

@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.

0 Kudos
Message 8 of 13
(4,207 Views)

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).


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 9 of 13
(4,201 Views)

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.

 

 

 

0 Kudos
Message 10 of 13
(4,192 Views)