LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use error cluster in event structures

This is my first attempt at using event structures and I really do not understand them very well.

 

Normally I would wire the error cluster in a way that the VI will stop on an error.

 

How do I do that with an event scructure?

 

I have wired the error boolean to write to the stop button using a local variable.

 

My vi stops when the stop button on the panel is pressed but does not stop when there is an error.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 5
(2,442 Views)

Two things.  One is that writing to a local variable does not trigger an event on the control to which the local is linked.  The other is that you have the tunnel connected to the termination terminal set to "Use Default if Unwired."  Just wire the error cluster status to that tunnel in the Timeout case.  No need for the local at all.

 

Lynn 

0 Kudos
Message 2 of 5
(2,440 Views)

johnsold wrote:

 One is that writing to a local variable does not trigger an event on the control to which the local is linked.  

 


That's good to know...

 


johnsold wrote:

 

The other is that you have the tunnel connected to the termination terminal set to "Use Default if Unwired."  Just wire the error cluster status to that tunnel in the Timeout case.  No need for the local at all.

 


That's how I had it originally it, but the VISA session is not closed properly on error.

 

Unless this is not a concern anymore, I have noticed on recent LV versions many of the VISA vi's are being depreciated more and more...

 

I guess I could just move the VISA close outside the loop like I used to do

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 5
(2,418 Views)
Working with what you have I would do this.
Tim
GHSP
0 Kudos
Message 4 of 5
(2,410 Views)

aeastet wrote:
Working with what you have I would do this.

 

That looks like something I would do too, and (IMHO) not really an "improvment" over using the state machine programing style.

 

Normally I would have an "error" state that would handle the errors and attempt an elegant shut down of the insturments. 

 

I guess I thought there would be a "better" way using the event structure?

 

Seems a little excessive for the one case of somone just closing the window instead of stopping and exiting properly.

 

I guess this is not really a good vi to explore the bennifit of event structures?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 5
(2,391 Views)