![]() |
How do i find a variable and use it on Labview
Im trying to get a variable on Labview that has an input and an output but i cant find one. Ive found local and global variables but then how do i use them.
|
Re: How do i find a variable and use it on Labview
I seem to be in the same predicament as you... I get the variables, but wiring anything to them gives broken wires. I think I have only found input variables.
FYI, the variables that I am talking about are in the programming menu. EDIT: http://zone.ni.com/devzone/cda/tut/p/id/7585 - Looks like "change to read" is what you (I) want. |
Re: How do i find a variable and use it on Labview
Chris,
After you create a control or indicator on the front panel (or right-click on a subVI or function and select "create control" or "create indicator" which does this for you automatically), you can create local variables for accessing it by right-clicking on its icon in the block diagram and selecting "create local variable". If you use the "finger" tool on a local variable, you can change what variable is attached by selecting from all variables in the VI. Russ |
Re: How do i find a variable and use it on Labview
Thats just a local variable i know how to find them but how do i use one to input and output values.
|
Re: How do i find a variable and use it on Labview
Do what Booksy says - right-click and "change to read" or "change to write" to set it to an indicator/control (aka output/input).
When in doubt, right-click. It unlocks "everything". Russ |
Re: How do i find a variable and use it on Labview
Yes but i want something that doest both at once that just lets it either read or write. Is there some way to connect a read variable and a write variable
|
Re: How do i find a variable and use it on Labview
Quote:
|
Re: How do i find a variable and use it on Labview
check whether the value is boolean or numeric, and make sure it wires to the corresponding input.
|
Re: How do i find a variable and use it on Labview
Yes but will those be connected. I want one value that will be changed by the joystick value and then will change the motor speed not two values. (Im not using the Crio stuff for testing so i cant use get motor speed or set motor speed)
|
Re: How do i find a variable and use it on Labview
1 Attachment(s)
Any wire in LabVIEW can be read from but can only be written to by a single output.
You can create as many local variables (either read or write variety) for the same "physical" variable. You can have many outputs "simultaneously" writing to the same "physical" variable via many local variables (see attached). Russ |
Re: How do i find a variable and use it on Labview
Be careful when you write to a variable. Its good practice to only write to a variable in one location, but you can read from the variable in many locations. If you write to a variable in multiple locations you are bound to run into race conditions.
|
Re: How do i find a variable and use it on Labview
Ok but if i have multiple variables then how do i know which one is which read is connected to which write variable.
|
Re: How do i find a variable and use it on Labview
That "example" that I published? FULL OF RACE CONDITIONS (intentionally). Good luck trying to figure out the order of precedence in that. I was simply trying to show that it's possible.
The OS/program will only store 1 "real" copy of the variable in a single memory location. Every function can simultaneously read/write to the single memory location from "anyplace". But as BLAQmx points out, be careful when you have multiple writes that are happening simultaneously. You'll never know which "write" "wins". That's why I use sequences to force program flow where necessary. Being a very single-threaded engineer, I use a LOT of stacked sequences. Russ |
Re: How do i find a variable and use it on Labview
1 Attachment(s)
Every variable can be either read or written to.I n that sense there is only one variable but two states. This single variable may have multiple copies of readers and writers, but they are all reading and writing from the same place in memory.
Let me know if the screen shot I have attached helps at all. |
Re: How do i find a variable and use it on Labview
In your example you have variables with "X" and "Y" in them all i get are "?"s how did you rename the variable.
BLAQmx where do you find the boolean, string, and numeric all i can find are local, global, and shared and how do you name them. |
| All times are GMT -5. The time now is 20:20. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi