Electronic – Computer peripherals to immediately (<5ms) detect digital input state change in C# programs

digital-logichardwareinputinterruptssoftware

The C# application I'm working on needs to be able to be able to call a function within 5 milliseconds of a digital input signal's state change (0V = off, 5V = on).

Rather than using software to repeatedly poll that input's state, I would like some hardware to simply call a software function when the hardware detects a state change (like how hardware interrupts work).

Does anyone know how to do this (what ports to use) on a standard PC tower? Or does anyone know of any hardware peripherals that allow this functionality?

Occasional latencies are fine. I need <5ms average.

I basically need to take as many samples as possible of the input digital waveform. (preferably in the C# program, rather than in a peripheral micro-controller, although I am open to suggestions).

For instance, I found out the Labjack U3 can poll its digital input in less than a millisecond. This is a valid answer to the question, but I am interesting in more answers, especially ones that don't use polling or poll faster than 1ms.

High input impedance would be nice (digital inputs).

Best Answer

Do you need to perform a specific real-time action, or just record the event?

If the former, you will never accomplish this using commodity hardware and consumer-grade interfaces. You will need both a laboratory-grade signal processor ( it will be a card that can access hardware interrupts directly) and a real-time operating system like VxWorks. A user-centric OS won't interrupt a disk write just because the USB bus wants some attention.

If the latter, get yourself a signal recorder and post-process the buffer output at your convenience.

Related Topic