10-02-2009 03:52 AM
Hello,
I have a problem with variables in SubVIs. If I bring them onto my MCB2400 (ARM) they reinitialize on every call. So it´s impossible to Build a Counter in a SubVI. If I run the same VI on my PC everything works fine. Just on the ARM it doesn´t work anymore.
In my example (see Attachment) I build two counter. One hat the Variable to increment in the mainVI and the other in the subVI. And that in the mainVI works the other not (on the MCB2400). But if I run the same on the PC both work without any Problem.
Has somebody an idea where is m mistake or is it a bug in LV2009 Embedded ARM ?
bye & thanks
amin
Solved! Go to Solution.
10-02-2009 06:34 AM
This is not a bug.
When it comes to read the local variable the program gets a value from the indicator which is in your PC, not on the target. Control/indicators are not updated continuosly but with the period specified in "Configure Target" dialog. In your application you didn't give any chance to that indicator to be updated until next iteration.
However, it is not recommended to use local variables. You can use instead something like this:
As an alternative you can use 1 iteration loops storing that local into a shift register.
10-02-2009 07:14 AM
OK thanks,
this solution works. But I still don´t understand why it works with variables in the mainVI and not in a subVI.
bye & thanks
amin