Serial Ports

Overview

Response Times

If you are used to designing on an embedded platform, you’ll have to get used to much slower response times for Java-running serial ports.

Below is a breakdown of what response times are achievable when communicating with external devices using a serial port in Java. These times are measured from when the last byte of input data is received on the computer’s serial port to when the first byte of data is sent from the computer’s serial port.

  • < 5ms: Not really possible
  • 5-20ms: Achievable, but not really guaranteed.
  • >20ms: Comms should work most of time. However, remember that on non-real-time systems such as Windows and standard Linux distributions that there is no absolute guarantee your message will be sent out in time.

Summary of COM Port Libraries

jSSC

(Java Simple Serial Communicator). It is said to be cleaner and less buggy than the RXTX library.

Some reported issues using jSSC with virtual COM ports on Linux systems.

It can be added to your project with the following Maven code:

RXTX

Just look at their fine example of a website…

A screenshot of RXTX's (a Java comm port library) front page on their website. Dear god.
A screenshot of RXTX’s (a Java comm port library) front page on their website. Dear god.

I hope you could tell I was being sarcastic.

serial-comm

 

Posted: July 1st, 2016 at 12:56 pm
Last Updated on: July 11th, 2016 at 8:01 pm