LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN message from case structure

Solved!
Go to solution
Solution
Accepted by topic author PBX

You need to learn more about event structures.  They don't behave the way you think they do.

 

A value change event is triggered in one of two situations, either when a user changes something on a control on the front panel, or when the event is programmatically triggered by the programmer sending a value to a Value (Signalling) property node.

 

In your case, since the X=Y boolean is an indicator, a user can't cause a value change event.  And you don't have any value signalling property node for that indicator in your VI.  So your event structure, which doesn't have any other events (a timeout event, but the timeout is infinite) becomes a big road block and that loop will never iterate.

 

For that particular loop, the correct implementation is to get rid of the event structure, and put that code in a true case of a case structure.

Message 21 of 24
(784 Views)

I've got it working BUT there's still a big problem!

The sequence button is the condition for the while loop to run. When i start the VI and the button is ON then it works. If i switch the button OFF, it goes OFF but if i switch it back ON the loop won't (re)start anymore.

Why o why i wonder? Smiley Surprised

 

timestamp compare loop.png

0 Kudos
Message 22 of 24
(777 Views)

I feel like you still don't understand how dataflow works in LabVIEW.  Turn on execution hightlighting.  Use probes.  Have you taken tutorials?

 

Your code is doing exactly what you programmed it to do.  In order for your while loop to run the sequence button must be on (and on before your VI starts) AND Stop button must NOT be true.  When you turn off the sequence button, the loop will no longer continue.  It ends, and you have no mechanism for it to restart again.

 

This goes back to my message #17 about how complicated your code is right now and really belongs in a Producer/Consumer with Events architecture.  (Not a single event structure misapplied in one loop), but a whole restructuring of the code.  The other architecture to look at is a State Machine.  A state machine means your VI execution is in one of several states such as Initialize, Idle, "Do something", "Do something else", Cleanup/shutdown.  One of those case can even be a "Check events" where you see if any button events have occurred.  To me, any time someone says they have a sequence of events to do, that says "State Machine".

0 Kudos
Message 23 of 24
(770 Views)



 

0 Kudos
Message 24 of 24
(766 Views)