LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Only one chance to detect a joystick?

Right now in LV v7.1.1, the "Query Input Devices" VI (Advanced --> Input Device Control palette) only seems to recognize the presence or absence of a USB joystick the first time it is run. If the joystick is subsequently connected to or disconnected from the USB port after this first pass through the VI, it goes unnoticed as all subsequent passes through the VI return the same answer. The only way to get an updated answer is to close out the Query Input Devices VI and all VIs that call it and then re-open and re-run.
 
Is there any other way to programmatically flush whatever cache this information is being held in other than closing/restarting everything?
0 Kudos
Message 1 of 8
(3,696 Views)

Hello Warren,

What about using the Win system DLL call from inside the Query Input Devices VI to build your own piece of code to continuously monitor whether an input device is connected?  I believe it might be caused by that shift register inside of the function.

 

Regards,

Clint M
National Instruments

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

Hi Clint,

The only DLL call I see in the Query Input Devices VI that's associated with a joystick is "C:\Program Files\National Instruments\LabVIEW 7.1\resource\lvinput.*" and that is not a DLL that ships with windows. NI would appear to be the source of it. What's more, there appears to a shift-register equivalent data store within the DLL code because, with execution highlighting turned on, it's easy to see that the DLL call will return the same initial call's information over & over again regardless of the subsequent attachment state of the joystick. Yes there is a shift register in the VI, but that does not appear to be the source of my "problem" at the moment.

Thanks for the thought though...

I don't suppose there are any other routines within the lvinput library which I could call to reset the state? Got (lvinput) documentation? 

Warren

Message Edited by Warren Massey on 07-25-2007 07:20 AM

0 Kudos
Message 3 of 8
(3,645 Views)
Has a solution to this "problem been found" I would very much like to know the answer as well.
Kevan -
0 Kudos
Message 4 of 8
(3,474 Views)


solarburnDOER wrote:
Has a solution to this "problem been found" I would very much like to know the answer as well.
Kevan -



Not that I ever heard or found...
0 Kudos
Message 5 of 8
(3,461 Views)
Is there any documentation regarding the usage of lvinput and their commands?
0 Kudos
Message 6 of 8
(3,257 Views)
0 Kudos
Message 7 of 8
(3,242 Views)

HERE and HERE  I have written some Nuggets on direct USB communication.  An example is listed for a mouse, but it whould be easily adaptable to a joystick.

 

Since the communication is in the user's hands, a "missing" joystick can be re-scanned and re-opened programatically.

 

Let me know if this helps.

 

Shane.

0 Kudos
Message 8 of 8
(3,231 Views)