Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Using 4 joystick buttons with Case Statement (http://www.chiefdelphi.com/forums/showthread.php?t=125928)

marccenter 06-02-2014 14:03

Using 4 joystick buttons with Case Statement
 
Dear CD,

I am trying to use 4 joystick buttons in conjunction with a case statement in order to select one motor speed but am not being successful.

My guess is that the execution order impacts the design and does not effectively allow me to select some options.

Can you recommend a design solution?

marccenter 06-02-2014 14:05

Re: Using 4 joystick buttons with Case Statement
 
1 Attachment(s)
Dear CD,

Yeah, it helps to post a picture in the initial email.

Mark McLeod 06-02-2014 14:22

Re: Using 4 joystick buttons with Case Statement
 
I'm on the road so I cannot offer up examples, but I can comment on what you have.

The code you posted has a chicken/egg issue.
None of the Latches are guaranteed to have been set by the loops on the left, before being used in the case statement to the right.
The case statement code on the right happens simultaneously with the checks you are performing on the left.

As far as using joystick buttons to select a motor speed, you can do something like this. Add more buttons (one speed and one Select per new button) for more variations in speed.
It just remembers (latches) the speed associated with the last button pushed.
I can't tell if this is in line with how you are trying to employ the buttons.


Animal Control 06-02-2014 14:23

Re: Using 4 joystick buttons with Case Statement
 
Could you be a little more specific, I'm a bit confused as to where some of the values are coming from. Also wouldn't it be easier to use a case structure with a choice of each value? Sorry if I'm not much help.

marccenter 07-02-2014 09:53

Re: Using 4 joystick buttons with Case Statement
 
1 Attachment(s)
Dear CD,

I can't figure out for the life of me why I cannot see the third button case while seeing cases 1, 2, and 4?

Please see pdf attachment.

My next set of experiments will use Mark's example above but I really think my latching button method using RS Bistable vi should work.

Thanks,

Attachment 16143

Joe Ross 07-02-2014 12:44

Re: Using 4 joystick buttons with Case Statement
 
You still have the race condition that Mark pointed out. Putting the latches in a sequence helps some, but doesn't keep the case statement from executing before or after the sequence.

I think you can implement the whole thing using wires and feedback nodes, and then you would have no race conditions.

As for any specific debugging, that's almost impossible to do with a PDF of a portion of the code, and hardly any description of what the code is supposed to do. Post the VI and a detailed description and maybe someone can help. To me, it looks overly complicated, but since I don't know what its supposed to do, I can't say for sure.

Alan Anderson 07-02-2014 12:51

Re: Using 4 joystick buttons with Case Statement
 
There's an awful lot of complicated stuff going on there. I suspect LabVIEW provides a much simpler way to do what you want, but without knowing what you want to do, I don't want to risk giving inappropriate advice.

What exactly are you trying to do here?

chris.boyle 07-02-2014 14:12

Re: Using 4 joystick buttons with Case Statement
 
1 Attachment(s)
If you are looking to create a latch on a variable, you can use this method:

It works very well for us and it only updates the variable when something changes. We use this method for almost all inputs from the driver station.

Doc Wu 08-02-2014 22:38

Re: Using 4 joystick buttons with Case Statement
 
Quote:

Originally Posted by marccenter (Post 1339075)
Dear CD,

I can't figure out for the life of me why I cannot see the third button case while seeing cases 1, 2, and 4?

I wonder if the third button is generating a a value of 4 and your fourth button generates a value of 8?

When you convert a binary array to a number, each bit takes a power of 2 value. To get three, you'd need 1 and 2 simultaneously.

marccenter 12-02-2014 14:28

Re: Using 4 joystick buttons with Case Statement
 
Doc Wu,

That's it! I haven't tested it yet but I know that's the solution.

When I get a chance, I will post the problem and solution for CD reference.

Thanks,


All times are GMT -5. The time now is 09:51.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi