01-23-2008 09:04 AM
Hello,
I agree with Ben – it sounds like a race-condition occurs due to multiple writers to the very same global.
If I would summarize global variables it would be like this:
Global variable is a location in memory that can be accessed by multiple VIs.
Pros: easy to use, works fine for data smaller than 32-bits
Negative: not suitable for large amounts of data, lossy since it can be overwritten before the data is read. A VI with a lower priority might not have enough processor time to read the data before other VIs overwrite the data. It might affect determinism since it is a shared resource (mutex).
Definitely go for Functional Globals considering you are using LV RT 7.x, if you not explicitly set it to be reentrant only one copy exists in memory.
Summary of functional globals:
SubVI store data in shift register. Minimize jitter by setting it to a subrouting priority level.
If it is skipped it will return the default value for the data type and not the default indicator values.
An easy way to see if it was executed or not is to use a Boolean Output that is set to True.
If is executes it will return a True if not a False (default value for Booleans)
Functional global variables can be a lossy form of communication; if a VI overwrites the shift register data before another VI reads the data
01-23-2008 09:12 AM
Jimmie wrote "Functional global variables can be a lossy form of communication; if a VI overwrites the shift register data before another VI reads the data"
This is true for the simplest form of AE's.
I have written AE that survive a power failure for the machine they are running on or comm failures (when the AE's are being used share data between distributed nodes) such that they pick-up right were they left off and only loose data when one of the machines is down for an extended period of time ( i.e. days ).
No other form of data sharing can make those claims.
Gotta love those AE's!
Ben
01-23-2008 10:28 AM
01-23-2008 10:47 AM
01-24-2008 10:01 AM
01-24-2008 10:26 AM - edited 01-24-2008 10:27 AM
01-24-2008 10:33 AM