LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to (most efficiently) pass data around

Solved!
Go to solution

Tony,

 

Why are you stuck on the term "wirelessly?" You really should use wires & dataflow to make sure your data is intact.

 

Can you give us a real world example on where you would need this "wireless" functionality?

 

Eric

0 Kudos
Message 21 of 29
(1,585 Views)

My simple reason is the same one as why the local varible is used to push stop (wirelessly) in 2 different loops.

 

Real application:

 

I have a DAQLoop (prod-cons) constantly acquiring data, and UILoop (prod-cons) waiting for user events.

And, they're mutually exclusive, and in my UILoop there is graph update, alarm processing, etc.

 

 

Are these solutions correct:

 

1. If you can't solve it wirelessly, how do people usually pass the data globally by global i guess for critical signals?

 

 

2. and, to pass waveform data (which is huge & continously) i guess by using functional global right?

0 Kudos
Message 22 of 29
(1,580 Views)

Perhaps this is what you are looking for...

Download All
0 Kudos
Message 23 of 29
(1,566 Views)

Same code, posted as a screenshot...

0 Kudos
Message 24 of 29
(1,565 Views)

Note that the FGV absolutely MUST be non-re-entrant.

0 Kudos
Message 25 of 29
(1,560 Views)

Give this nugget a good read:Action Engine



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 26 of 29
(1,535 Views)

Thanks Chris, i like this solution. 🙂

0 Kudos
Message 27 of 29
(1,508 Views)

Thanks Cross, i will read Action engine too 🙂

0 Kudos
Message 28 of 29
(1,507 Views)

There is another paradigm which usually works better.  In any given loop, your best way to stop the loop is to use its native control mechanism.  In your example, you have a data acquisition loop and a UI loop.  Data acquisition loops are typically controlled by some sort of state machine or command processor, often queue based.  UI loops are controlled by an event structure.  The acquisition loop should exit when it gets a command or state transition to exit.  In this case, it should fire a user event which will cause the UI loop to exit.  The UI loop can exit due to a variety of control, menu, or user events.  In this case, it should send a command to the DAQ loop to exit.

 

But wait, you say, my DAQ loop does not have a command processor, so using the functional global is far easier.  If true, you need to refactor your DAQ loop so it is a command processor, state machine, or something similar.  Using any global, including functional globals, for control purposes usually points to a place you could have a better design.  Virtually all LabVIEW users go through the Global/Local » Functional Global » Queue/Notifier/Event command passing phases.  I certainly did, and I don't want to go back.  I consider functional global command and control variables a hack to use when you are in a hurry, but something to be solved with proper messaging in the future.  Simply put, globals break data flow and should be used only when absolutely needed.  The more you learn data flow, the more you avoid globals - by choice. You simply do not need them in virtually all cases.

Message 29 of 29
(1,485 Views)