Three ways in C#: 1. you can use a timer to get an event at some rather low frequency (well below 1 kHz); it wouldn't be very reliable, there would be some jitter (you might want to read my timers article). 2. you can choose a realtime thread priority, and cause a busy loop to monopolize one CPU core to read a parallel pin at high frequency (hundreds of kHz); the exact frequency would depend on the number of instructions in your loop and your CPU frequency. 3. you can provide an external clock, then choose a realtime thread priority, and cause a busy loop to monopolize one CPU core to read a parallel pin at high frequency (hundreds of kHz). By waiting on the external clock, your code would be independent of the exact instructions and your CPU frequency. Other ways would include writing a specialized driver (not in C# though). None of the above is likely to be acceptable as far as behavior and results quality go. If you want to create say an oscilloscope, you need more external hardware, including some memory, so the communication doesn't have to be real-time at all. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.