I'm making a kind of timing project to time dogs in a relay race. I've writen software in VB6 using the MSComm control to handle the splits and total times, etc. The start/finish line is a Retro Reflective photoelectric sensor.
I have very, very, little experience with electronics :roll:
All I need to do is to be able to detect when 5V DC is present on a pin at the RS232 connection on the computer. In other words, the computer is connected to my circuit through a COM port (RS232), and listens for a state change on one of the pins (I don't care which one I guess).
So what I'm wondering is if I can do this. Can I just detect a voltage on a pin (rather than having to send data to it)?
I'll attach the circuit and you can rip it appart.
In an RS232 port, if your software can read the state of some of the control signals which are inputs to the PC, such as CTS or DSR, then yes you could use the port to detect 0v or 5v, depending on the receiver IC in your PC. The true RS232 standard requires < -3v and > +3v, athough I cant remember an input which would not accept 0v as a valid state.
I am not familiar with VB6, but using assembler I would read the appropriate bit(s) in one of the status registers for the UART.
As for the serial port itself, the 0v side of you power supply should connect to pin 5 of the 9 pin D connector.
For your inputs, you could use CTS - pin 8, DRS - pin 6, DCD - pin1, or RI - pin 9. Assuming they are all impemented in your serial port.
I cant comment any further on your photoelectric sensor without seeing the data sheet for it.
In the mean time, I'll check the circuit out to see how it works.
Thanks again !!
Here's an updated diagram. Apparently they sent me the PNP instead of the NPN so I had to rework my diagram...good thing because I had the wiring for the sensor wrong to begin with ops: :
if you are worried about damaging the serial port you could also put another resistor in series with the signal pin, 10k would probably work there too.
I got home and tested everything on my W2K machine and it works like a charm...thanks for everyone's help!! I have to test it on XP at home and see what's up with that.