From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to change indicator/control depending on enum?

Solved!
Go to solution

Hi all. I'm rather new to LabView, and I'm trying to make a program for a robot that can be run virtual, so without a DAQ or anything connected, and thus has input toggles. But it should also be able to run "real", so with the DAQ, and thus the controls should be changed to indicators. Is there a way to do this or not?

0 Kudos
Message 1 of 21
(3,233 Views)
Solution
Accepted by topic author jdepypere

@jdepypere wrote:

Hi all. I'm rather new to LabView, and I'm trying to make a program for a robot that can be run virtual, so without a DAQ or anything connected, and thus has input toggles. But it should also be able to run "real", so with the DAQ, and thus the controls should be changed to indicators. Is there a way to do this or not?


Not as long as your VI is running. You can, though, do that using VI scripting.

 

https://decibel.ni.com/content/message/39353

 

Br,

 

/Roger

 

Message 2 of 21
(3,227 Views)

Hmm seems a little bit too complicated for a simple use, I'll just leave it as it is, the inputs should be updated every 10ms anyway so if a button is clicked it shouldn't have too much influence..

 

Thanks for the fast reply!

0 Kudos
Message 3 of 21
(3,224 Views)

Without seeing your code, it is hard to tell. Perhaps you should have two "input" modules (subVIs), one for manual input with the boolean switches and another for the DAQ inputs.  Then your robot control panel has a toggle switch to choose which input source will be used at any given time.  This can be operated at run time and each of the input subVIs can be optimized for the purpose.

 

You can also write a value to a control using local variables. This may be appropriate in your application, but use of local variables is not encouraged with newcomers to LabVIEW because of the ease with which they are often misused, typically creating race conditions.

 

Lynn

0 Kudos
Message 4 of 21
(3,205 Views)

You can always write to controls using local variables, so that's what you should do.

 

In additions there are properties that you should change so it behaves like an indicator. For example you should set it to disabled so it cannot be operated and you could even change the visuals (hide increment, change background to grey, etc) so it looks and acts indistinguishable from an indicator to the user of the program.

 

If it should act as a control again, switch the properties back.

 

All this does not require scripting.

0 Kudos
Message 5 of 21
(3,204 Views)

Here is a printsreen of the program. Simply put, the box under "Kies stand:" has two options: virtual and real. So when it's Virtual, he buttons K1, E1 and E2 should be clickable. However, when the option is real, these get inputs from the DAQ. I'm using a few local vars, but didn't think the race conditions through so I'll try minimizing that. However I still don't understand how I could do this even with local vars.. I have to work with local vars anyway, since I'm going to have a different DAQ module I think.

Capture.PNG

0 Kudos
Message 6 of 21
(3,200 Views)

You probably do not need local variables unless you are going to write to the controls.  Appropriate use of the dataflow paradigm almost always eliminates the need for locals for any other purpose.

 

Please show us the code.

 

Lynn

0 Kudos
Message 7 of 21
(3,198 Views)

Here's the current code, in a case. In the top while loop there is also the 'virtual' option, where nothing happens.

Capture.PNG

 

Here's another sot of the bottom while, where the 'reset' and 'start' buttons are used.

Capture2.PNG

 

Oh, and the red boxes are drivers to use the DAQ, they initialize, read/write and close the connection.

0 Kudos
Message 8 of 21
(3,192 Views)

Pictures are useless. Attach the actual Vi instead.

0 Kudos
Message 9 of 21
(3,182 Views)

Oh my bad, new on this forum and actually to all of LabView 🙂

 

Currently only the 'Reset' button has it's function, and that is to reset the positon up to a limit switch.

The 'Start' button goes up to the limit switch on the other side.

 

The Other switch is going to be used to count the # of rotations made by the motor.

Download All
0 Kudos
Message 10 of 21
(3,176 Views)