From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure Question

In Event Structures, what is the recommended method for wiring the output of one event case to the input of another event case?

0 Kudos
Message 1 of 13
(2,964 Views)

 

Use a shift register to hold the data.

0 Kudos
Message 2 of 13
(2,952 Views)

Would using a local variable be acceptable?

 

0 Kudos
Message 3 of 13
(2,950 Views)

Logically it will work.

 

For every read and write( of Local variable) LabVIEW will allocate additional memory.

 

The Pros and Cons are many times discussed .A search in the forum will give you more info.

 

 

0 Kudos
Message 4 of 13
(2,946 Views)

 

gufus wrote:

Would using a local variable be acceptable?


----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 5 of 13
(2,940 Views)

Yes, it would. It however depends on your data, if its is only to be used locally (in the same VI) I would use a local of shift register, if there is a chance that the data could be used globally I would select a different method (Functional global, Queue, etc) to pass the data, e.g. in case you decide to use it elsewhere or move some functionality.

Regards,
André (CLA, CLED)
0 Kudos
Message 6 of 13
(2,933 Views)

@gufus wrote:

Would using a local variable be acceptable?

 


As has been said, locals should be shied away from.  If you are using the local specifically for holding data, there are better ways.  If you are using it to control GUI, that's a slightly different story.  From your quick description, I was say the shift register is what you want.


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 7 of 13
(2,918 Views)

andre.buurman@carya wrote:

Yes, it would. It however depends on your data, if its is only to be used locally (in the same VI) I would use a local of shift register, if there is a chance that the data could be used globally I would select a different method (Functional global, Queue, etc) to pass the data, e.g. in case you decide to use it elsewhere or move some functionality.


Locas have bene discussed quite a bit and there are countless threads which discuss why it is a good idea to avoid using them. While they may be easy to use they lead to race conditions if not used carefully. I would not recommend the advice I quoted above. Eveb within a single VI the use of locals can cause problems and should be avoided.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 13
(2,901 Views)

Let me clarify.  The Event Structure has four event cases.  Each event case is launched by pressing its own independent button on the front panel.  There are four buttons on the front panel to handle the four event cases.  However, the actions of the third event case depends upon inputs from the second event case. 

 

Right clicking on the event case border does not provide the option to create a shift register.  I am at a loss for how one can create a shift register for a Event Structure.

 

Thanks.

0 Kudos
Message 9 of 13
(2,889 Views)

@gufus wrote:

Let me clarify.  The Event Structure has four event cases.  Each event case is launched by pressing its own independent button on the front panel.  There are four buttons on the front panel to handle the four event cases.  However, the actions of the third event case depends upon inputs from the second event case. 

 

Right clicking on the event case border does not provide the option to create a shift register.  I am at a loss for how one can create a shift register for a Event Structure.

 

Thanks.



Your event structure should be within a while loop. If it is not it is not a very useful event structure since it will only run once for the first event. The shift register would be on the while loop, not the event structure itself.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 10 of 13
(2,886 Views)