03-15-2008 08:38 AM
03-15-2008 09:21 AM
03-15-2008 09:22 AM
03-15-2008 09:28 AM - edited 03-15-2008 09:29 AM
Lets do it without a local variable. Instead of the case statement, you could also use an event structure.
03-15-2008 10:49 AM
Hi Guys,
Thanks for your help,first Matt.Sorry i am currently at home using a very old version of Labview so cannot open your file.
A picture of the screen might be better or version 8.0 which i could open later...I've had a look at the help again an now see how to
change the local variable from read to write.I can get it working ok with boolean data but still gives strange results if try to use intergers
as with my initial example above.
Dennis,I understand your program and that might be a solution for what i am trying to do but would still like to understand how it
can be done with a local variable.
Labtech5555
03-15-2008 10:58 AM
labtech5555 wrote:
I can get it working ok with boolean data but still gives strange results if try to use intergers
as with my initial example above.
03-15-2008 11:01 AM
I'm not sure I want to show you how a local variable can be used. Local variables certainly have a place in LabVIEW programming but they are usually the most abused feature. They violate every rule of data flow, cause race conditions, create unnecessary copies of data, and often are just lazy programming. You really need to have a good justification for using a local instead of a wire.
If you are getting strange results, then you should post your code.
03-15-2008 12:14 PM
Hi Guys,
I am used to line by line C programming which of course uses variables to control things.Changing to labview
is totally differant thinking as event driven, but i'm still thinking about variables which are nomally easy to control and declare in C programming..
If i seen an example what i wanted originally then i may agree its the wrong way to go and use what Dennis has suggested.
I can't try it untill i go back to work on Monday on the project i' writing...
The example i tried to today is in version 6 so to old to post and i've deleted it already anyway..Instead of getting x incrementing by by 1 at
a time it was going up by a very large number everytime the case was triggered.If no success i'll right it again at work and post on Monday ..
Thanks,
Labtech5555
03-15-2008 12:36 PM - edited 03-15-2008 12:36 PM
If the variable was incrementing constantly, then you probably have the mechanical action of the boolean to one of the switch modes. Set it instead to Latch (i.e. Latch When Released). Here's an event structure with a local. The while loop and case statement in my earlier post can be use as well.
You'll need to shift your thinking a bit when you move to LabVIEW. I went throug the same learning curve when I moved from text based languages to LabVIEW. There are some excellent resources for Learning LabVIEW at http://www.ni.com/academic/lv_training/how_learn_lv.htm.
03-15-2008 12:37 PM - edited 03-15-2008 12:39 PM
labtech5555 wrote:
The example i tried to today is in version 6 so to old to post and i've deleted it already anyway..
Instead of getting x incrementing by by 1 at a time it was going up by a very large number everytime the case was triggered