03-22-2012 12:07 PM
I am using this VI together with Vision Builder. What happen is that VBAI will update the "Y_position", "Lines_cnt" constantly with numbers.
My purpose is to save all the"Y_position" values in an array "Array".
However the snippet doesn't quite work as expected. For example, if the VBAI updates "Y_position" in this manner: 10.0, 10.5. 11.4, 16.1, the "Array" will only show "0, 0, 0, 16.1". How come the first 3 elements of the array are all 0?
Please help
03-22-2012 12:11 PM
sorry the snippet should look like attached..
03-22-2012 12:13 PM
It might be helpful to include a simple inspecion that illustrates this problem. I don't see anything wrong with the code you provided. Maybe if you show how and when you update the Lines cnt and Y position it will be more clear why you're not getting what you expect.
Thanks,
Brad
03-22-2012 02:22 PM
Hi Brad,
I have to disagree: there is something wrong with the code!
@splee:
- Why don't you use a wire for the "lines cnt"? Right now it looks like a big race condition...
- "Wrong" (IMHO) is not to use the cleanup tool. Your wires go the wrong way and are (partially) hidden - it's bad style that easily leads to bad programming...
03-22-2012 02:27 PM
Are you using this VI in a Run LabVIEW step? If so, why isn't your lines cnt a control instead of an indicator. Make sure you have this control being updated with a previous measurement in the Run LabVIEW VI step. You should use the Vision forum next time instead of the LabVIEW one to avoid confusion with general LV programming.
Thanks,
Brad
03-23-2012 02:01 AM
Hi GerdW,
I don't quite understand about the race condition.
I did use a wire for "lines_cnt". Basically it is a numeric display, and the update comes from Vision Builder.
I don't know how to use the cleanup tool. Could you please show me how I can find out more about it?
And also I believe there is no hidden wires..
I'll post again later
03-23-2012 02:04 AM
Dear Brad,
Nope I am not using this in a "Run LabVIEW step". "Lines_cnt" is an indicator as it is updated by Vision Builder.
03-23-2012 02:06 AM
I cut and pasted the block diagrams, and modified it by changing the update-by-VBAI from user-manual-update, as attached.
This one works though...
But it just does not work in my original program.
03-23-2012 02:53 AM - edited 03-23-2012 02:54 AM
Hi splee,
the "cleanup" tool is the rightmost icon in the tool menu of the blockdiagram...
One more: instead of placing an array constant initialized with 2001 elements you could also place the InitArray function. It is more easy to read and the compiler will also replace it (internally) with a constant...
@Brad:
As you're working at NI: Could you please file a CAR to change the context help for the feedback node (and post the CAR number here)?
I cannot find any information about the "activation input" (well, my German LV names it "Aktivierungsanschluß"). Either the help doesn't explain it or I'm not able to find that information. In case I'm wrong: could you show that piece of information in the context/online help? And: could you explain the purpose of that input?
@splee:
What happens when you delete the TRUE constant?
03-23-2012 03:04 AM
Hi GerdW,
Removing the TRUE constant does not work either