Erratic behaviour joystick button on soundblaster

Hi everybody,

I just installed an old PC that has a sound card(isa with sound card+joystick interface) that i use as an automation device(programmed in Pascal). What it does is read for many hours the joystick port for buttons pressed(a digital sensor connected to a relay closes the circuit and generates the event). The problem is that is generating erratic button presses( with absolutely no aparent reason - it works for days with no problem then it fails) - it might be the sensor who sends the wrong signal..electric noise...but i believe the problem is on the side of the computer. What should i do - might it be a defective sound blaster compatible card?

The sensor is trying to sense a metal(the metal is glued to a 35mm cinema film)..when it senses the metal(very rapidly..in a fraction of a second) it activates a "relay" that closes the circuit for the joystick button generating an event.

The code i use to read the bit In pascal:

FUNCTION button_1 : Byte; BEGIN button_1 := ((Port[$201] AND $10) XOr $10) ShR 4; END;

Isn't there a way to force the event to last longer than the time the relay is active to allow me to diferentiate between real events and hipothetical electricity contamination?

Some sort of a timer..everything happens very quickly...

Any help would be welcome. Thank You.

Reply to
cyberfreak
Loading thread data ...

Google "switch debouncer" and you should find a number of circuits for this type of thing. If you are getting fleeting noise, something like a Schmitt trigger on the input may help. Again, a G search will turn these up. Basically this type of gate only responds to voltages above a certain level.

In the modern world all of this can be programmed with a simple microcontroller. That allows you to play more with the values, just in software.

The old game port on a sound card or a stand-alone card is not instrumentation grade. If adding the noise filtering to the switch inputs doesn't help you should consider a better interface. You can buy these for ISA and PCI slots for maybe $200 (some are more, with added features), ready to go. Depending on how critical it is to sense the foil mounted onto the film this small investment could be well worth it.

-- Gordon

Reply to
Gordon McComb

Searching google finds sites like below. An NPN transistor could be used in place of the relay to do the joystick button push. You could do something similar with the serial port. A voltage blip on the rx line will leave jibberish in the input buffer, which can be read on a repeating basis by software.

formatting link

Reply to
Si Ballenger

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.