Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Communication with RS232 port  RSS feed

 
Smith Kool
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys!

I'm new here but that's not a problem I think

The problem:

I have a dynamometer (if you care what is the machine that I'm using) that send the data to my pc through RS232. The main idea is that when I send the ASCII code 'S' to it, the dynamometer should return me -

18 bytes as follows: 0,1,2,3,4 - the messured force F; 5,6,7,8,9 - Fmax; 10,11,12,13,14 - the messured speed dF/dT and bytes 15,16,17 - status (0/1 for each - MaxHold, Nulled, Overload). All the bytes are standard ASCII strings.

So my problem is that I will make the rest of the code, the loops for sending the 'S', the Null command to the machine at the beginning... I have no problems to save this info into a file for example .txt either.

My problem is that I cant understand and I cant find maybe an already done and known method for simple sending/receiving commands or information through this RS232.

As far as I saw... I will have to use the class javax.comm that is not supported since... ages and the other way is to use rxtx libs that I dont understand very good... I'm afraid that there won't be any good doc for this lib and I will fail with the use whether I get it or not.

I know that my problem is not so easy maybe but this is part from my final educational exam and I really need help. I will appreciate it BIG TIME!

Thanks a lot from now on to the ppl that will try to help me!

PS: Sorry for my bad grammar.
 
Tony Docherty
Bartender
Posts: 3264
81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

If you are on a Windows platform then I don't think javax.comm will work as Windows support was withdrawn from it some time ago. Your best bet is probably RXTX. There is some documentation available for example http://rxtx.qbang.org/wiki/index.php/Using_RXTX.

I've done very little port programming under Java but I'll help where I can and there may well be others here who know a lot more about the subject than I do so I suggest you have a go and then if you get stuck ask here for specific advice.
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it must have been 10 years ago that Sun (former owner of Java before Oracle bought them) decided not to support the RS/232 interface any more. It's old technology and modern computers rarely even have RS/232 ports any more. So (1) RXTX is your best bet for a working piece of code, and (2) Don't expect that there are a lot of people with experience in the technology now. But... good luck with your project!
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Tom says - RXTX is the way to go. I'm using it to communicate using Java with PIC chips and Arduino boards and it works great for both Windows and Linux. It even works well with the Raspberry PI.

Though Paul is quite right in indicating that RS232 is now old technology it still has a place as a very very cheap interface between computers and hardware.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!