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: 

Radio button control does not shift in runtime

Consider the below VI that I have attached. In this, there is a radio button control which has four options, i.e. X1, X10, X100, X1000. The problem is that, suppose I select X1 before starting the program, then during the execution of the program, if I select X10, X100 or X1000, then the control does not shift to it. It remains to X1 once the program starts execution. To select the next radio button, I have to stop the VI, then select X10, X100 or X1000 and then again run the VI. So, I am not able to achieve runtime control over the case structure. Please help me out with this.
 
 
 
Regards,
Giridhar Rajan
Automation Engineer
Cruiser Controls,
Mumbai, India
0 Kudos
Message 1 of 5
(2,414 Views)
Hello
Go to block diagram and put the radio button control icon INSIDE the while loop. In this way, its value will be read in each iteration
and action will be taken if value changes.
The way it is now, its value will be read only at start.
 
Cheers
ALipio
 
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 2 of 5
(2,407 Views)
OK, let's look at your code. Here are some ideas for improvements:
 
  • The ONLY difference between the four cases is the value of the increment. Only this value needs to be in the case structure, everything else is the same and belongs outside the case. This also immediately eliminates the local variables.
  • The X and Y are used exclusively as INDICATORS, so why make them controls and change them via local variables? Change them to Indicators! 🙂
  • It is not very efficient to do four subtractions and additions with each loop iteration if only zero or one operation can occur at the same time. You need to rearrange the logic a little bit. It also will make the diagram easier to follow.
  • I would suggest to use an event structure so the loop only iterates if really needed. You can manipulate the timeout to get the desired effect while any of the xy buttons is pressed. (Place an indicator on the iteration terminal [i] to see the difference between the two examples). 

Attached are two examples (LabVIEW 7.1):

  1. A plain vanilla implementation of your code using the above suggestions (JOG_FINAL_SIMPLE.vi)
  2. An improved version using events (JOG_FINAL_EVENTS.vi)

Let me know if you have any questions. Good luck and happy programming. 🙂

Message Edited by altenbach on 08-06-2005 09:51 AM

Download All
0 Kudos
Message 3 of 5
(2,408 Views)

Hi Alipio,

Thanks for the help. It worked for me.

Keep in touch

Regards,

Giridhar Rajan

Automation Engineer

Cruiser Controls,

Mumbai, India

0 Kudos
Message 4 of 5
(2,388 Views)
Hi Altenbach,
 
Thanks for those examples. I learnt how to keep the VIs efficient while running. In fact I have to feed the values obtained by pressing the xy buttons to a motion control hardware, where efficient programming is a key. Thanks again.
 
Regards,
Giridhar Rajan
Automation Engineer
Cruiser Controls,
Mumbai, India
0 Kudos
Message 5 of 5
(2,385 Views)