operator hardware input

Malak
01-21-2002, 09:56 AM
I'm replacing some old equipment and I
need a way to communicate a simple switch
closure to a VB program. What are some ways
to do this? Serial port? It needs to be low
overhead and as simple from a hardware
viewpoint as possible. The existing program
otherwise is 80 pages plus so variable
allocations could be close to limits already.

I was modifying keyboards by wiring the switch
across the enter input but newer keyboards are
hard to work with.

Thanks.

Thinker
01-21-2002, 11:03 AM
Here is an idea that I haven't tried but might work. If you use a
mscomm control, and wire the com port transmit line through the
switch and back into the receive. Every so often, you send a
character and look for that character to be returned. If it isn't, the
switch is open. Like I said, just a wild idea that occurred to me.

Banjo
01-21-2002, 05:06 PM
Another alternative would be to use the joystick port. It would allow 4 input switchs. You need to use the joyGetPosEx function to read the buttons.
Type JOYINFOEX
dwSize As Long ' size of structure
dwFlags As Long ' flags to indicate what to return
dwXpos As Long ' x position
dwYpos As Long ' y position
dwZpos As Long ' z position
dwRpos As Long ' rudder/4th axis position
dwUpos As Long ' 5th axis position
dwVpos As Long ' 6th axis position
dwButtons As Long ' button states
dwButtonNumber As Long ' current button number pressed
dwPOV As Long ' point of view state
dwReserved1 As Long ' reserved for communication between winmm driver
dwReserved2 As Long ' reserved for future expansion
End Type

Declare Function joyGetPosEx Lib "winmm.dll" (ByVal uJoyID As Long, pji As JOYINFOEX) As Long
You can look at the details in MSDN.

Malak
01-22-2002, 08:09 AM
Thanks for the ideas. I just need to pick
my poison now. :-)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum