02-16-2006 06:34 PM
02-16-2006 06:50 PM
The reason you don't see an update is due to data flow. No data appears at any output terminal until the loop has finished executing. That is a data flow rule. So naturally when the loop is done and data is sent out, you only see the last string generated.
In order to see the updates for each subvi loop iteration in a main vi, you need to access the subvi indicator by reference. The attached llb contains a main and a sub vi. This will show you how to access the subvi's indicator and display the value in main as it is being changed in the subvi.
02-17-2006 05:13 PM
02-17-2006 06:07 PM
Here is a bit more explanation to help you understand.
If you have a variable in a vi, this variable's value is stored in a particular memory location on the computer. If you pass this variable to a subvi, the subvi will create a new memory location for the value. If the value changes in the subvi, memory location 2 is changed but not memory location 1.
Now if you create a reference to the variable in the main vi, you are capturing the "address" of the memory location of the variable. That's what a reference is, an address of where the value is stored. If you pass the reference to the subvi, then any changes in the subvi will be written to the address of memory location of the variable being referenced. So now changes in the subvi will be recognized by the main because the value is being stored at the same memory location. Another way to put it is that a reference is like a pointer in C.
Is this clear?
02-17-2006 07:04 PM