LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

control and indicator in one

Hello,
 
I have read several posts on obtaining a control and indicator with only one object, but they dont quite seem to do what i need it to do.  Currently, we are using labview for frequency analysis, so a scroll bar is used to sweep across a desired frequency.  right now, there are two scrollbars in the program tied to a property node of XScale.Maximum and XScale.Minimum for our graphs.  Right below the scrollbar there is a numeric indicator that displays the current position of the scrollbar.  the scrollbar is ok for a quick frequency sweep, however is very limited for a precision frequency sweep.  the current range of the sweep is 0-12500 hertz.  is it possible to have that numeric display also act as a control where any number entered here will automatically change the value of the scrollbar and the corresponding graphs and at the same time still display the current frequency if only the scrollbar is used?
 
thanks in advance
Chris
0 Kudos
Message 1 of 12
(4,421 Views)
Something like this?
0 Kudos
Message 2 of 12
(4,403 Views)
Using the shared variable is simplest
 
 
Eric
0 Kudos
Message 3 of 12
(4,401 Views)
thanks for the vi's.  the examples are exactly what i am trying to implement in labview.  as a rookie, i was examining the sweeper block diagram and i couldnt figure out how to use the shared variables. do you guys have a quick and easy explaination of how the shared variable is used and how they were implemented in this particular vi?
 
thanks,
chris
0 Kudos
Message 4 of 12
(4,395 Views)

Shared variables have to be created in the Project Explorer.  It's best to create these before you even build your VI.  From the
Getting Started menu, go to file/new project. You'll have a new Project Explorer window with a few "prefabricated" submenus.  Right click on the "My Computer" icon, and select "New/Variable".  A Shared Variabl Properties explorer will now open up.  GIve it a name you can remember (default is "variable1")  The default data type is double, which is what I used, but you can use any data type you like....you just have to be sure it's compatible with your controls and indicators!  Hit OKAY.  Now, your new variable should show up under "untitled library" if you didn't name it something else.   Now, hit File/save all, and the FIRST part of the process is done. (Whew!)

 

Now, the rest is very simple....almost identical to creating a data socket.  Create your vi as you normally would.  Right click on the front panel item you want to share.  Go to PROPERTIES, and a tabbed window will come up.  Find the Date Binding tab.  Select SHARED VARIABLE ENGINE.  Browse to the new variable you created above.  Higlight that, click OKAY.  Click Okay again and you're done.  When you start your VI, it should tell you that the variable is being deployed...it might take a few moments.

 

Good luck!

 

eric

0 Kudos
Message 5 of 12
(4,392 Views)
Why not just right click on the slide and select visible items/digital display and turn the digital display on.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 6 of 12
(4,389 Views)
Eric,
 
I was able to get it to work, thank you.  But i wasnt able to get it exactly like yours.  on your sweeper.vi when you grab either the knob or digital control/indicator they seem to be bounded together and they move together in unison.  i was unable to get mine to do that, i had to do two separtate data bindings with the same variable.  it does the same thing but i was curious as to why they did not behave the same way.  i've included the code, but i was pretty sure i followed your directions correctly.
 
Joe,
 
I tried to select and turn on the digital display right from the scroll bar, but i couldnt find that option.  should that option be located in the property nodes somewhere?
 
 
0 Kudos
Message 7 of 12
(4,354 Views)
Chris,

The Scrollbar does not have the digital display option just because you usually you use it to scroll through a page. But, LabVIEW does provide functionality where you can get a digital display. All you have to do is to wire the output of the Scrollbar into a numeric indicator. You can change the datatype of the output value of the Scrollbar by right-clicking on it in the front panel; and choosing Data Range. The attached VI shows an example of this.

Message Edited by Adnan Z on 11-30-2006 01:39 PM

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 8 of 12
(4,330 Views)
Adnan,
 
your vi was close to what i wanted it to do.  I needed that numeric indicator to act as a control as well.  our scroll bar in the program is that same size and it has to do a frequency sweep over a range of 0-12500 hz.  using just the scroll bar to obtain a window that is in the range of 5000-5100hz for example is a real chore with just the scroll bar.  so i was trying to get the scroll bar sweep to display on that numeric indicator and if the user wanted to see a definitive window, on that numeric display the user can enter the desired frequency.  the vi that i uploaded seems to do it, however on the sweeper.vi uploaded seems to do it better and i was not able to figure out how to make the two different vi's to merge into one.
 
thanks,
chris
0 Kudos
Message 9 of 12
(4,299 Views)
Aww...now there ya go gettin' all practical on us! 🙂
 
eric
0 Kudos
Message 10 of 12
(4,292 Views)