• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Communication with RS232 port

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Heroic work plunger man. Please allow me to introduce you to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic