Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read Com port

 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends, I just want to know is it possible to read data from com port in java ,with out using wrapper class?

TIA.
 
Tim Cooke
Sheriff
Pie
Posts: 2935
121
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure exactly what you mean by "wrapper class" but RS-232 serial communication is available through some extension libraries such as the Java Communucations API
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what you mean by "wrapper class", but check out the libraries listed in the http://www.coderanch.com/how-to/java/JavaIoFaq in the section titled "Where can I get an implementation ...".
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here wrapper class i mean is, without using any c or c# i.e., JNI in java code. I tried using javax.comm for reading serial port,



is always returning "False". But COM3 port is open and its connecting to weigh scale and data is keep polling in that port. I have no idea, whether some prerequesite is required or anything is wrong in the code.
 
Tim Cooke
Sheriff
Pie
Posts: 2935
121
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably not going to be much help here as I'm just Googling around a bit, which I assume you have done plenty of before coming here for help anyway.

Only snip I could find was that one person encountered this problem where they were getting an empty Enumeration because they were using javax.comm API v3 on a Windows environment which is not supported. They resolved their issue by using v2 instead.

Like I said, I'm just Googling for you.
 
Ron McLeod
Bartender
Pie
Posts: 729
29
Android Eclipse IDE Java Linux MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used RXTXcomm with JavaSE on Windows 7 to communicate with an application running on an Adruino over a serial link.

This is the code I used to locate the comm ports:
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Tim Cooke. I'm using comm-win32_all-2.0.1 version 2 only. but still could not able to connect.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saying "not able to" gives us nothing to comment on in order to help you: http://www.coderanch.com/how-to/java/ItDoesntWorkIsUseless
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm using version 2 jar file of comm.jar still it is returning "False" for the code,
.
But COM3 port is open and its connecting to weigh scale and data is keep polling in that port.
 
Tim Cooke
Sheriff
Pie
Posts: 2935
121
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is connecting? What is polling? You say your application is not working but then you say you're receiving data on the port? This makes no sense at all.

Assuming that you have some other application connecting to your Scale then perhaps it is because that thing is hogging the Comm Port that your Java application is unable to get a handle to it. This is just a wild guess on my part.

Like Ulf says, your question is quite vague and you're not giving us much to go an at all. If you want to get more focussed assistance then you need to provide a more focussed question.
 
Paul Clapham
Sheriff
Pie
Posts: 20958
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's been nearly a decade since I used that software, back in the days when computers still came with COM ports installed by default. I vaguely remember that if your code couldn't find any comm ports, that was because it wasn't installed correctly. The installation process was very strange, with different components being loaded into different directories, and it was easy to get it wrong. So go back and review the installation instructions and make sure you followed them exactly.
 
Ron McLeod
Bartender
Pie
Posts: 729
29
Android Eclipse IDE Java Linux MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the scale is connected to a Windows platform, you can easily use the Device Manager to check if the COM port is registered by the operating system, then use a terminal application (such as PuTTY) to make a connection.
commport.png
Device Manager and PuTTY
[Thumbnail for commport.png]
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all response. When my application doesn't able to connect to the comm port, I used the hyperterminal(set by vendor to check data) to check whether data is being polled to com port.
Issue got solved by adding dll and steps followed in this website,http://edn.embarcadero.com/article/31915. Thanks for all, for your wonderful support and time.
 
Tim Cooke
Sheriff
Pie
Posts: 2935
121
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah ha. Paul wins. Installation problem.

Glad you got it sorted and kudos for posting back and letting us know how you resolved it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic