LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data vanishing from LV2 global...

I have been struggling to figure out this :

( Please look at the attached LV2 global VI written in LV8.0 )

1. There is an Event structure within a 50ms timed loop.

2. In the first event case I write three Strings to the LV2 global by reading the "Value" property nodes of three Combo boxes after they are populated..

3. In another event I read the three strings from the same LV2 global into three indicators.

 But  the indicators are always  reading blank. ( Obvious bugs like trying to read before writing, reading the wrong LV2,  etc have all been eliminated. )

Any reason for this to happen ?

Thanks

Raghunathan


Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 1 of 18
(4,154 Views)
Seems to work fine here. Can you show us the code of he calling program?
 
Are you sure you are connected to the same connectors. Since you use so many connectors, mistakes easily happen.
0 Kudos
Message 2 of 18
(4,147 Views)
Dear Altenbach,

Thanks for trying out the code.

While I cannot post part of the original code which is quite large, I am attaching two simple VIs that I think will explain the problem.

1. Run the main VI.

2. Select the "Write to GV " mode once to write Strings 01,02,03 and then select back "Read from GV" mode. The outputs of the LV2 global will now have the required values written.

3. Now select the other instance of write to LV2 global by making the case structure true. This will write String  06.  But  since the  inputs to Strings 01,02,03  are left unwired, will also erase the values of Strings 01,02,03..

This is my problem.  I think I either have to,

- Have one LV2 global for every string
[or]
- Have a unique case for every string inside the global for EVERY write or read of EACH variable .??

Raghunathan




Message Edited by Raghunathan on 08-19-2007 08:57 PM

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
Download All
0 Kudos
Message 3 of 18
(4,124 Views)
with  bit of extra code, you can only have it update if the input string is not empty... Or set the default to some value and check for that if a null string is valid.

Paul
Message 4 of 18
(4,116 Views)
Your program still has a serious race condition. If the case is TRUE, you are running the VI twice in parallel, and there is no way to tell which instance executes first. Most likely, the lower executes first, writing empty strings to all shift registers of the functional global (except the bottom one).
 
Your subVI is poorly designed because you can only write to all shift registers at once. If you only write one value and leave the others unwired, their respective shift register clears. There are many ways to program around that, but we would need to know what you actually want to do with all this.
0 Kudos
Message 5 of 18
(4,105 Views)
Hi Paul,

Thanks for your useful tip. I was able to get the FG to pass 6 different string values based on the method outlined you. WIth String values this is possible as we can check for a null value. But I am unable to do anything like this for Boolean variables as they only have two states and both are valid. There it seems the only option is to group them all into an array of booleans and index the required element both while writing and reading. Extra code but no other way ??

Regards

Raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 6 of 18
(4,065 Views)


@Raghunathan wrote:
WIth String values this is possible as we can check for a null value.
Even an empty string can be a valid entry sometimes, so I would not limit the program artificially. If you only write one entry at a time, you could make the cases e.g. "write #1", "write#2", ..., "read all" and use only a single string input.

 
0 Kudos
Message 7 of 18
(4,057 Views)


Your program still has a serious race condition. If the case is TRUE, you are running the VI twice in parallel, and there is no way to tell which instance executes first. Most likely, the lower executes first, writing empty strings to all shift registers of the functional global (except the bottom one).
Yes I understand that part and it was intentionally put together to highlight my actual problem as closely as possible ( maybe I could have used a flat sequence to avoid the race ). In the actual code such race condition do not exist. There is never an instance where two writes "try" happen together.



 There are many ways to program around that, but we would need to know what you actually want to do with all this.

Replace normal Global variables.

Thanks

Raghunathan

Message Edited by Raghunathan on 08-20-2007 11:08 AM

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 8 of 18
(4,058 Views)


@Raghunathan wrote:
Replace normal Global variables.

Why?
0 Kudos
Message 9 of 18
(4,050 Views)
Why to replace Global Variables ??

I happened to read this    http://zone.ni.com/devzone/cda/tut/p/id/5317

Reason why I decided to replace them. Otherwise I like thier simplicity in invoking and using.

Raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 10 of 18
(4,043 Views)