08-20-2014 12:04 PM
Hi All,
I'm developing motion control system for a single motor. Was having some difficulties, so I decided to just work the control input/output value passing with the control buttons.
I started with the LV Example Radio Buttons, then add my bits.
I've two options.
First, moving the motor incrementally. The user enters the degrees, selects CW/CCW, then GO!. The degrees get converted to microsteps, then multiplied by 1 or -1 pending the direction. This works as expected. I can drop this into my motor control VI, the data passes as needed.
The second is motor jogging. The user selects the speed, steps/second (will convert to degrees/sec later). Then they should be able to press the CW or CCW button and the motor jogs until the button is release. The selected speed should remain for both the jog buttons until a different value is selected. This fails. (nevermind my latching might not be set correct.
What is happening is that after one button press of CW or CCW, clears everything and replaces with 0. Feels like it is back feeding?
I've tried using a while loop in the event to continue sending the same value. I didn't have success. I've tried moving parts of the Radio Button outside the Event Case and Main While Loop. No success.
Any thoughts? Attached is the VI.
Thanks!
Solved! Go to Solution.
08-20-2014 12:43 PM
@EngineerJim wrote:
What is happening is that after one button press of CW or CCW, clears everything and replaces with 0. Feels like it is back feeding?
CW/CCW is not checked by the Event Structure.
What does "clear everything" mean?
08-20-2014 12:52 PM
Sorry, "clearing everything" was not a good choice of words. After clicking the CW or CCW (which I still have labeled as Boolean and Boolean2), it returns a 0 in the Number, Rounded Number (2 and 3), and String (2 and 3) indicators. The value held in the Message indicator is what should be passed and used by Boolean and Boolean 2 everytime they are pressed and held. When they are released, they shouldn't be changing any values set by the radio buttons.
08-20-2014 01:02 PM - edited 08-20-2014 01:04 PM
Hopefully someone with more experience will pipe in.
I have only used Event Structure for discrete clicks. I am not sure whether it is possible or not to have a button where it is to be held down of indefinite lenght of time.
Edit: http://forums.ni.com/t5/LabVIEW/Event-control-of-button-press-and-hold/td-p/553284 may be of interest
08-20-2014 01:44 PM
Thank you. There are several examples. I can see one that I can build off of which looks like it should work. Just needs some elbow grease.
08-20-2014 01:56 PM - edited 08-20-2014 01:57 PM
The way you have it, the "use default if wired" setting on the string tunnel leaving the Event structure erases your "number".
You should use a shift-register to keep the number.
08-20-2014 02:18 PM - edited 08-20-2014 02:26 PM
Thanks, Jim. This was one of two things I noticed from one of the programs in the link nyc sent and it stood out as the solution.
I've never worked with the shift register before and have added this to my VI. With the way you've draw, it sends the correct radio button, but not the value of the button. It sends 0, 1, or 2. By moving the line over (shown in attached), I get the value. I'm sure I've done something quirky though with how I've the radio button setup which is why this is doing that.
Still a lot to learn!!
08-20-2014 02:32 PM
The second I saw the subject line, I knew it would be a "Use Default if Unwired" issue. Seen this way too many times.