How to connect to a Computer?

Thread Starter

jmccoy125

Joined Dec 7, 2008
3
I am trying to connect a voltage comparator to a computer. I want to use the data from the comparator to trigger something in a program I have on the computer, but I'm stuck as far as how to get a connection to the computer. Anybody have any good ideas?

I was thinking maybe through the serial port or the USB port. If anyone had any tutorials, how-to's, or suggetions that would be great.

Thanks
 

beenthere

Joined Apr 20, 2004
15,819
The parallel port is a simple way to connect the comparator, provided the output is at logic level - 0 to 5 volts.

The problem is getting the computer to see the input. A few lines of code in any language that allows hardware level access will let you set the port to input and look for the bit changing.
 

Thread Starter

jmccoy125

Joined Dec 7, 2008
3
I don't have a parallel port on my PC though. Would I need a parallel to serial converter or just interface directly through the serial port.
 

Wendy

Joined Mar 24, 2008
23,809
We're talking RS232 here, I'm not sure what you're refering too. You can get an external RS232 card for your computer.
 

leftyretro

Joined Nov 25, 2008
395
I don't have a parallel port on my PC though. Would I need a parallel to serial converter or just interface directly through the serial port.
If you have a serial port (COMM port) on your PC then there are control signals already on that port for reading a digital input signal (DCD, etc) however you must insure your digital signal is electrically compatilbe to the RS-232 standard or go through a voltage level switcher. On the software side you have to have or write a program that can read the comm port control signals and that whatever action you wish it to take.

Lefty
 

DickCappels

Joined Aug 21, 2008
10,662
If your computer has USB, here is a very crude method, but on that is quite likely to work: Take a cheap keyboard apart, figure out what needs to be shorted on the controller chip to simulate a given keystroke, then use a transmission gate such as a 74HC4066 to simulate the contact closure.

Here is a similar hack:
http://www.geocities.com/AirPanther/keyboard.htm

With USB you can use two keyboards - one for you and one for your applicaiton circuit (actually, you can throw away the keyboard and just keep the part with the controller chip), and most likely, your program can take input from the console (USB keyboard in this case) without having to come up with any special drivers.
 
Top