LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

One Event, One Data Pass, Different Event, Clears Old Data

Solved!
Go to solution

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!

0 Kudos
Message 1 of 8
(2,888 Views)

@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?

0 Kudos
Message 2 of 8
(2,875 Views)

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.

 

 

0 Kudos
Message 3 of 8
(2,870 Views)

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

0 Kudos
Message 4 of 8
(2,866 Views)

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.

0 Kudos
Message 5 of 8
(2,848 Views)
Solution
Accepted by topic author EngineerJim

The way you have it, the "use default if wired" setting on the string tunnel leaving the Event structure erases your "number".

 

labv.png

 

You should use a shift-register to keep the number. 

 

ButtonLogic[1]_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 6 of 8
(2,841 Views)

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!! Smiley Happy

 

 

 

0 Kudos
Message 7 of 8
(2,830 Views)

The second I saw the subject line, I knew it would be a "Use Default if Unwired" issue.  Seen this way too many times.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 8
(2,820 Views)