09-10-2007 02:54 PM
09-10-2007 02:55 PM
09-10-2007 02:57 PM - edited 09-10-2007 02:57 PM
Message Edited by F. Schubert on 09-10-2007 03:03 PM
09-10-2007 03:01 PM
09-10-2007 03:03 PM
09-10-2007 03:08 PM
09-10-2007 03:17 PM - edited 09-10-2007 03:17 PM
@exo wrote:
Altenbach,
1. Your code failed in two ways. First, and I don't know why, it didn't access the file, just the internet. Second, the second time I run it,(i.e. not in the loop but when I start it up again, it doesn't reintialize object to blank and runs the vi instead of waiting for an imput.
There is no way to test without the subVI, but looking at your current code, it is probably also peppered with race conditions. You really need to cleanup your coding style.
You have no case structure, so it ALWAYS runs the VI, no matter what. Could it be it depends on the state of the boolean? If the VI remains in memory, it will retain the control values from the previous call. TO start with defined values, you should feed them via connector terminals when calling.
Maybe you also want to change your boolean to "latch action" so it resets to false automatically after each press.
You really need to familiarize yourself with dataflow and modify the code correctly. Let's have a look at your code:

There are four independent parts(A,B,C,D) and all will execute once per call of the VI and it it is NOT defined in what order these four parts execute (LabVIEW does not execute left to right or top to bottom, for example). Most likely, the FOR loop will take the longest, and since it constantly writes to all these local varaibles anyway, the two code segments on the right serve no purpose at all.
In theory, you could imagine a case where "D" starts executing first and places the old, stale value on the wire. In the meantime, "A" writes empty strings to same, after which part "D" finishes and write the wire content to the indicator. You'll end up with an unpredictable value on the indicator until the subVI executed the first time and renews the indicator.
You have to know that you cannot predict execution order unless there is data dependency via wires. (You might argue that the parts depend on each other via local variables, but this does not impose any execution order. A local variable can be read even if nothing ever has written to it in the past.)
That's where race conditions come from!:)
Message Edited by altenbach on 09-10-2007 01:18 PM