Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to design a comparator?

Status
Not open for further replies.
Absolutely, there need be a small hardware interface in there somewhere. Pretty much as you enquired of the OP.

Have a great day
Ron
 
I have a device that supplies 5 V signal each time a object passes through it, I want to detect this 5V signal through USB port of a PC and an application increments a variable each time it receives this signal. As a result this behaves as a counter. This is needed because later LPT port was available on systems on which pin 17 directly receives 5V signal and an application receives it. This is not possible with USB port. Thats why I need an ADC to convert this 5V to binary and this binary could be readed by USB port.

After So much efforts, I guess the device I am holding in my hand can do this for me, A Mouse

Each time the device send me a 5 V signal I light up an infrared LED and an Infrared sensor senses it, just like found inside the trackball mouse. An on-board processor chip is also found inside the mouse and its job is to read the pulses form the infrared sensors. These sensors are turned by the processor chip into binary data that our PCs understand and which is sent to the computer though a cord.

Now help me to find the datasheet of that on-board processor chip.

Also Senior members tell me Will this idea work for me accurately?

Waiting for your suggestions......
 
Last edited:
Look here.
**broken link removed**
 
Also Senior members tell me Will this idea work for me accurately?
I'm not a senior member, but I'll tell you that it's a very odd way to do what you're after. It might only work if the LED is moving & you'd see the mouse cursor move. It's not practical by any stretch of the imagination though.

Waiting for your suggestions......
I've already given you a suggestion in the other thread - use a USB-serial converter & connect the signal line to CTS, DSR or RXD. This has the effect that you seem to be after of the signal being "turned by the processor chip into binary data that our PCs understand and which is sent to the computer though a cord."
 
hi sisso,
You say that someone at your work said you must use the USB port to detect the +5V.

Can I ask what your 'works' company produce.???
The way they have stated how the project must be done suggests they know little of USB usage.

Dougy,
For what its worth, I would consider you to be a 'senior member', in age, experience and contributions
 
Hello Eric,
I was saying Senior members relatively to me, yeah as you all are senior to me I should'nt say like this, it was my bad.
Well I am a intern at the company and they have given me this project. They just want to replace LPT port they are using
with USB by any method.
 
hi,
In that case do as Dougy suggests, buy an USB/RS232 adaptor and use one of the RS232 control lines.
 
Last edited:
Dougy,
For what its worth, I would consider you to be a 'senior member', in age, experience and contributions
Um.. thanks for the complement, but I've got something like 40 years before I'm eligible for retirement.
 
I have bought USB/RS232 adaptor . Now please tell me what type of signal is generated at USB port if I pass 5V signal to CTS,DSR or RXD pin. If it is an interrupt signal then I have to open its serial port to detect that signal @doughy83 as you have suggested in earlier post or USB programming interface. Also, can I pass 5V signal to only one pin of DB-9 doing nothing with rest eight.
 
Now please tell me what type of signal is generated at USB port if I pass 5V signal to CTS,DSR or RXD pin.
CTS & DSR can be read through the serial port status bits, or can raise an event. Activity on RXD can be read by way of a character being received (if the pulse is short) or through the break condition (if the applied 5V pulse is extended).

If it is an interrupt signal then I have to open its serial port to detect that signal
You should open the serial port before using it, yes.

Also, can I pass 5V signal to only one pin of DB-9 doing nothing with rest eight.
You will also have to connect the GND pin appropriately.

Did you require any electrical isolation between the 5V signal and the PC?

What language are you programming in? It affects the way approach of handling the events/interrupts/signals.
 
First of all @doughy83 My aim is to read from USB data pin not from Db-9 pins. As I have mentioned earlier I am passing 5V signal to a pin of DB-9 of USB/RS232 adaptor. The event/interrupt generated at the other end of the adaptor i.e. USB end should be readed.

Well I don't know whether there is a need for electrical isolation or not.

The language I am using is Java with the help given on following link https://www.ibm.com/developerworks/library/j-usb/index.html.

So, I want to read data at USB port. Tell me if any other language would be more appropriate for that.
 
Last edited:
I'm have a bit of trouble understanding what you're on about.

First of all @sissy the USB/RS232 appears as a serial port on the computer. So to find out what is going on at the db9 pin, you open the serial port and you can access the status of the db9 connector. The status passes from the pins of the db9 through the RS232/USB converter through the USB data lines into the computer. If this is not what you're after, then sorry I can't help you.

I can't help you with Java. C#/C/C++/VB.NET/VB6 would be a different story.
 
I'm have a bit of trouble understanding what you're on about.

First of all @sissy the USB/RS232 appears as a serial port on the computer. So to find out what is going on at the db9 pin, you open the serial port and you can access the status of the db9 connector. The status passes from the pins of the db9 through the RS232/USB converter through the USB data lines into the computer. If this is not what you're after, then sorry I can't help you.

I can't help you with Java. C#/C/C++/VB.NET/VB6 would be a different story.

As I am a newbie to Electronics and did'nt know that USB/RS232 adaptor behaves purely RS232 port on a PC. Thanks for the help and expecting more from you till the project completes. As far as language is concerned yeah I can do in C/C++ also. Please help me with that.
 
Well, here's a program in C# that will open the serial port and tell you the status of the bits. You can use the visual C# express to compile it, or there's an executable file in the zip somewhere that should work.
 

Attachments

  • SerialPortEvents.zip
    66 KB · Views: 85
I am passing +5V signal to RXD pin of RS232 and connected pin 5 to negative terminal of battery(for GND) but after checking through this application "Advanced Serial Port Monitor" not getting anything. Please help me....
where I am wrong?
 
I'm not familiar with that program "Advanced Serial Port Monitor", but it looks like it is only for displaying received serial data (based on a quick glance of the homepage). You likely won't be getting any valid serial data poking 5V into the RXD pin. Try the program I posted, and try connecting the 5V to the CTS or DSR (or CD) lines. If that doesn't seem to work, try connecting 0V to the CTS or DSR (or CD) lines instead.
 
Try the program I posted, and try connecting the 5V to the CTS or DSR (or CD) lines. If that doesn't seem to work, try connecting 0V to the CTS or DSR (or CD) lines instead.
tried all the possibilities, this doesn't seems to work. please help me........
 
The suggestion(s) from dougy should work. However, I will make a suggestion for what it is worth. Way back in the beginning of this thread I mentioned the need for a piece of hardware to interface between the USB port and your input signal. Since you are not making progress with the USB to RS232 converter I suggest you consider using one of these units. With a cost of $29 USD they are very inexpensive. They offer two digital inputs in addition to 4 analog inputs. They are very easy to write code for in several languages and code samples are available. They have a whole line of these "starter kits" for data acquisition. They also have international sales and distribution. Anyway, if you aren't having any luck you may want to consider a simple interface like this as a solution.

Ron
 
thanks Reloadron, but friend I do not want to use a dedicated device that could make the project so simpler that when I will be evaluated I will n't have anything to say about my work rather than just demonstrating this product.
Now my question is that,
Can I utilize the ring indicator pin of DB-9. mean to say when I supply 5V signal the ring indicator goes active high and rest it remains active low. Is there any way to do that,
if not what should I do.......plzzz help.
 
OK, I just dug out an old USB to RS232 adapter I had. There are only 3 lines that can be used as an input the way you want to use it. Those lines are CTS, DSR and DCD (Not sure about DCD). I wrote literally a few lines of code in VB6 to open the Comm Port (com3 in my case) and poll the RS232 port. I open the port, I poll the port under a timer and it reads the port just fine. On your computer using the USB to RS232 adapter which com port number (as in COMM 1, COMM 2 etc does the port show up as? This is pretty much doing exactly as dougy 83 suggested.

Ron
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top