LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Local Variables read and write

Hello

 

What does the write of local variable do...I know how to use the local variable in the read....but if the local variable is in the write mode...what can I attach it to..any examples..

Also, if iam using local variable to transfer data from one while loop to another then do I need to have some kind of timing like milliseconds multiple timer....I mean in such cases such transfer of data from one loop to another is the timing necessary.

 

Also, what is the race condition....Iam having trouble understand the concept...can anyone please elaborate on that..

 

THanks

0 Kudos
Message 1 of 8
(6,957 Views)

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

 

If you write a value to a local variable (whether a constant or the result of some calculations), you can programmatically change the value shown in a control.

 

A race condition is when two pieces of code can execute in parallel and you have no control over what executes first.  Let's say you write a value to a local variable, and in parallel code you also read from another copy of the same local variable.  What value do you get in the end?  You have no direct control over whether the write action or the read action occurs first.  If you are in a loop, it's even possible that one could occur first in some iterations of the loop, and the other will occur first on other iterations.

0 Kudos
Message 2 of 8
(6,953 Views)

Hi

 

Just Run the VI I have attched with highlight execution ON. That will clear up the things. 

 

Also if you want to confuse yourself just read this http://labviewjournal.com/2011/08/race-conditions-and-functional-global-variables-in-labview/

 

From Link it says,

Avoid using local variables when you can use a wire to transfer data. Every local variable that reads the data makes a copy of the data. Use global and local variables as sparingly as possible.

 

Ravens fan - Your commnets on blog content will be really nice

 

I hope this helps !!

 

Kudos are Welcome excited.gif

 

 

 

 

 

 

-------------------------------------------------------------------------------------------------------------------------------
Thanks & Regards,
Kunal Raithatha.
CTD - CLAD (I wish I can take off that A, and maybe use it later to replace D 🙂

Easy Tip :- "To copy an image to a VI icon, drag the image file and place it on the icon
located in the upper right corner of the front panel or block diagram" ...If you know any
more reply back.
-------------------------------------------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 8
(6,917 Views)
Hey raven
My question was not stupid that u are suggesting me to look at all those beginning tutorials. Iam weigh advance than that I know how laview programming works iam not dumb
0 Kudos
Message 4 of 8
(6,906 Views)

SK0480

 

I don't think he was offensive in any way! Looking at your question, nobody would think that you are an advanced LabVIEW user at all. All he did was to suggest to look at those tutorials. I would recommend that you have a look at them, the answers to your questions are explained really well in there. Don't get offended when people are trying to help please.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 5 of 8
(6,890 Views)

 

SK0480 

 

Question you have asked have answers in those tutorials, here also you ask a primitive question, so trust me there is no harm spending few hours to spend on it and later on save time while programming. 

 

FYI :- How often do you see that 10k, 15k, or 20k badge beside the name ??? How frequent you see these profiles reply untill you bother to hit "Accept as a Solution" or give virtual kudos or atleast say Thanks. You know what it takes to get that ??? Total respect to every Badge owner for their contribution to this community.  

 

 

 

-------------------------------------------------------------------------------------------------------------------------------
Thanks & Regards,
Kunal Raithatha.
CTD - CLAD (I wish I can take off that A, and maybe use it later to replace D 🙂

Easy Tip :- "To copy an image to a VI icon, drag the image file and place it on the icon
located in the upper right corner of the front panel or block diagram" ...If you know any
more reply back.
-------------------------------------------------------------------------------------------------------------------------------
0 Kudos
Message 6 of 8
(6,873 Views)

Ravens Fan wrote:

A race condition is when two pieces of code can execute in parallel and you have no control over what executes first.


More specifically, it is only a race condition if the outcome depends on the order of operation but the order of operations cannot be guaranteed.

 

Many times the result does not depend on the order of operations and thus we don't have a race condition. 😄

0 Kudos
Message 7 of 8
(6,865 Views)

SK,

 

I never said that your question was stupid.  The concept of a race condition is difficult to understand at first, especially for people who have a text-based language background.

 

However, I pointed you to the tutorials because you didn't know what it meant to write to a local variable.  I'm sure that concept is talked about early in one of the tutorials.  If you don't know about local variables, then you don't have as much LabVIEW experience as you think you have and going through the tutorials would be good for you.

 

 

Message 8 of 8
(6,843 Views)