LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CHANGE CONTROL TO iNDICATOR AT run TIME

Hi:
Is there a way to change a control to be indicator programmatically during run time.  In my program, I want a control to be an indicator based on certain state conditions.
 
thanks,
---trupti
 
0 Kudos
Message 1 of 7
(6,343 Views)

Hi Trupti,

      Typically, one would use a Control (big 'C') and, when needing to use it as an Indicator, would update its contents via a local-variable (or its "Value" property.)  However, the "Indicator" property of a control can be changed programmatically (via a reference to the control) - as long as the target VI is not running or part of (called by) a running program.  The attached VI gets the reference to the first control on the FP of a subVI, and sets it to Control or Indicator.  (You have to create the subVI "Untitled1.vi", and put a control on its FP.)

Cheers!

Message Edited by Dynamik on 09-18-2005 08:53 PM

Message Edited by Dynamik on 09-18-2005 08:54 PM

When they give imbeciles handicap-parking, I won't have so far to walk!
Message 2 of 7
(6,339 Views)

Hi Trupti,

I know this is a bad example... but it is simply to illustrate the point (so don't rate me on it 😉 )

See attached vi.  as an example.

You probably do not have to change the property of the control to an indicator as it will act as an indicator by simply updating it's value.

You can change the value by creating a property node for the Control you wish to use as an indicator.  This is done by right clicking the control and selecting property node.  Click on the newly created property node and select Value.  Click again on the property node and select "Change to Write".

I placed two property node within the Case Statement to illustrate.  In reality, you only use the property node at the location you wish to display the desired value.  I placed the one in FALSE to clear the value, if you run the vi continuously.  The Case Statement is simply to illustrate the example, as well, permitting a selection of whether you'd want to display new info in the control or not. 

If you explain why you wish to do this, we may be able to provide a more accurate example more suitable for your needs.  But hopefully, this will help.

Good nite..  😄

JLV

 

Message 3 of 7
(6,330 Views)


Trupti wrote:
Is there a way to change a control to be indicator programmatically during run time.  In my program, I want a control to be an indicator based on certain state conditions.

A front panel object is either a control (data source) or an indicator (data sink). In one case a wire comes out o it and in the other case a wire leads into it. Each wire on the diagram must have exactly one data source, but can have multiple indicators.

Whenever you change from control to indicator, you create a broken diagram because a wire will have now zero or multiple data sources, both situations break the VI. This cannot be allowed to happen at runtime! Same for subVIs, where controls are wired inputs and indicators are wired outputs. 

As others have mentioned, you can get close by programmatically writing to a control or reading from an indicator using local variables (more efficient) or property nodes (less efficient). In addition, you can programmatically change the apperance. For example, if you have a control and want it to visibly look and act as indicator, you could for example:
  • Write to it indirectly as stated above.
  • Hide the increment buttons using property nodes
  • Block the operator from changing it (Property: disabled=1)
  • Change the background color from white to grey.
  • etc.
Still, the question is why??? 😮
Message 4 of 7
(6,293 Views)

I have a similar problem. I have a table indicator of values that loads during startup. I wish to make changes on that table during runtime and therefore have the data written out to various arrays. To do this, the indicator needs to be able to control. This indicator/control is 40 lines llong and 13 columns wide. It works easily in a manual execuition mode by itself, but in the running condition, the indicator table is just that, an indicator. I didn't really want to address one particular table entry at a time with a control as I need to be able to update several at the same time. The overall application is very large, but this one area is for a PID gain table to show the current values, but be able to update the running array structures as they are being read by other areas. Cuurently I'm doing this using an Excel spreadsheet/text file to get the controls into the software and wish to get away from this input method to active screen displays. Thoughts?

Thanks in advance.

David

0 Kudos
Message 5 of 7
(6,155 Views)
Sorry, I don't understand what you are trying to do. Are you trying to programmatically change the table entries (=indicator) or manually (=control)? (It seems impossible to manually update several entries at the same time.)
 
Does it have to be a table? As a control, a 2D array control is much more convenient if all fields are numeric. If you use a table as control, you need to check the inputs for valid numeric characters.
 
If tre values need to be updated only programmatically, place the table indicator inside a loop.
 
What is "manual execution mode"? I am not familiar with that term.
 
Could you attach a small, simplified example VI to better show what you are trying to do?
Message 6 of 7
(6,154 Views)

Thanks, You had one idea there that I missed, that being the table is string information and it does indeed need to be checked for the proper format on each cell as such.

  This table of PID gain entries is read from a master location and put into use. From there, I needed to change the table into controllable values that will then update the array structures in the rest of the code. This program has a total of 240 subroutines, so its rather large.

In my reference to "Manual Execuition" I was meaning running the one subroutine by itself to diagnose and implement the changes. When I run the main code, this display subroutine is updated every 300ms.

I found a way! I made a local of the table, created from it a property node with values selected. This now gave me two tables. Again, property nodes to turn off visibility on the now read only table, turn on the visibility on the control table. When done, reverse the visibilities. I sitll have a few issues to solve but on the way now, plus I will have to format check those table entries and again, thanks for the reminder there! That was an important one.

🙂
David

0 Kudos
Message 7 of 7
(6,147 Views)