LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure

As it is this VI is not even running. Here what I'd like to do:
Whenever the situation in the figure happens, I want the code in the event structure to execute once. For this to happen I have set the VI to start in case 1 and created an event called "Load setting Indicator" (circled in red in figure 1) and given it an initial value using property nodes.
Is there a better way to do this?
Thank you!!
Download All
0 Kudos
Message 1 of 5
(2,332 Views)

Use a Value (Signalling) property node to write the data to rather than the indicator terminal if you want the case in the event structure to fire.

 

One problem with your code is that the event structure is in the loop and will hold up the execution of the loop until an event occurs.  And in your case, you only have one event, the load settings value change.  I doubt you want to fire a load settings change just to get the event structure to run and have the loop iterate again.  You should probably have a timeout case on that event structure.

 

Something else I see is that you have an array that you have an Index Array with a lot of indices wired up to get some elements to just build into another array.  The elements seem to be adjacent row 0 column 0 through row 0 column 6.  Just use Array subset to get your new array with one function and a couple index constants.

Message 2 of 5
(2,318 Views)

Hi RavensFan,

 

Thank you for your reply.

Wouldn't it be easier to take the event structure out of the while loop?

 

 

0 Kudos
Message 3 of 5
(2,299 Views)

Hi even91,

 

I would like to make a few basic remarks to your code:

- a state machine would be good for your program

Initialize your device(s)

event structure in idle case

read daqmx and include your comparisons to decide which state comes next, e.g. if your limit is exceeded do shutdown (your case 2)

and so on ...

- search for initialized and uninitialzed shift registers

- if you want to have a switch, use a switch, Load on/Power on

 

 

Regards,

MOJO

 

0 Kudos
Message 4 of 5
(2,298 Views)

@even91 wrote:

Hi RavensFan,

 

Thank you for your reply.

Wouldn't it be easier to take the event structure out of the while loop?

 

 


No.  What if you want to change the settings while the VI is running?

 

And if you took it out of the loop, and you had the event set lock front panel until event completes (which is the default setting), once it has run once and you are in the loop and press a load setting change again, you'll lock up your front panel cold because you'll never get to executing the event structure again to handle the event that was queued up.  the event won't complete and the front panel remains locked.

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