09-25-2007 10:23 AM
09-25-2007 10:55 AM
Use an Event structure (Structures->Event Structure), create an event for Radio Buttons Value Change. In the event, wire your radio buttons icon to a case structure. In the case structure, have a "0" and a "2" numeric constants, wire them outside the case stucture to two "Disabled" property nodes (right click on numeric control on block diagram, go to Create->Property Node->Disabled), each correspodning to the motor parameters you can set. You want a 0 going to the property node if you want it enabled, a 2 if you want it disabled and grayed out.
Michael
09-25-2007 11:20 AM - edited 09-25-2007 11:20 AM
@Dejun wrote:
I am trying to input 'motion distance' and 'motion velocity' for a motor using control. Since the motion time is fixed, konwing one of these two parameters will also know the other. Therefore, I plan to give user an option, either input distance or velocity.
It is not necessary to force the user to choose first what he wants to change, grey out things and complicate the user interface.
All you need is two controls, one for distance and one for velocity and the user is allowed to change either one of them at any time! However, changing one will update the value of the other (e.g. via local variable) such that the math is consistent. Attached is a simple example. Modify as needed. 🙂
Message Edited by altenbach on 09-25-2007 09:22 AM
09-25-2007 09:46 PM
09-25-2007 10:48 PM
@Dejun wrote:
Both methods use loop structure, which is what I want to avoid in my code.
My loop is event driven and does NOT use any CPU resources unless one of the values changes. Even then, the CPU use is insignificant in the greater scheme of things. 🙂
You could waste or save way more CPU by programming the main tasks more or less efficiently. So Focus on that! 🙂
09-25-2007 11:13 PM
09-25-2007 11:18 PM
That is still no problem.
For example, you can place this event structure inside your own big loop and make the event structure transparent by adding an empty timeout case with small (or even zero) timeout.
09-25-2007 11:51 PM - edited 09-25-2007 11:51 PM
Message Edited by Dejun on 09-25-2007 11:59 PM
09-25-2007 11:59 PM
The beauty of LabVIEW is the fact that things can happen in parallel and simultaneously. Here's a parallel loop containing an event structure that only spins when needed to keep the two controls consistent and uses near zero CPU. The main loop can spin at any rate you want and can contain other controls.
See if it all makes sense to you. 🙂
09-26-2007 12:06 AM - edited 09-26-2007 12:06 AM
Message Edited by Dejun on 09-26-2007 12:08 AM