Skip to main content

Serial Port Programming(detecting 5V signal from USB)

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
2 replies [Last post]
abhishekshishodia
Offline
Joined: 2011-06-24
Points: 0

Please help me,

I am working on a project aiming to detect a 5V external DC signal from USB port. For that I am using RS232/USB adaptor.

Corresponding to that I am writing an application in java using javax.comm library and following this tutorial http://java.sun.com/developer/Books/javaprogramming/cookbook/11.pdf .

I am able to detect the port at which adaptor is attached

and also able to open that port. But when I am passing the 5V signal ( taken from anaother USB port pins) to CTS,DSR or RxD pin and 0V to pin 5 of RS232 there is not any data detected.

Tell me how to conquer that problem. I am attaching a project that I am using to check this (I found this one from net), it is not in java I am just using to check the status of pins but not getting any response, find an .exe in it somewhere to run directly.

Please tell me what type of data is generated and how could I read that data.

AttachmentSize
SerialPortEvents.zip111.75 KB

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
4chen500
Offline
Joined: 2008-12-09
Points: 0

What platform are you running this on?

On Win32, the comm implementation is not complete. If this is to be on Win32, I recommend using the rxtx library.

abhishekshishodia
Offline
Joined: 2011-06-24
Points: 0

Thanks,

Yeah, I am running it on win32. Now I started using rxtx library. Please tell me is there any function available to detect individual status of pins in this library.

As I am able to detect that each time I pass 5V signal to pin CTS of RS232 and connecting pin 5 to ground, DCD (Data Carrier Detect) pin is High.

It would be great if I will be able to detect the status of pin DCD each time it is high.

Please help me............