9

I need simple modbus Java library with source code. I found on google but there is .jar file and doesn't have strong using manual. Can anybody suggest me modbus library with using manual or source code ?

Damir
  • 48,513
  • 89
  • 234
  • 352
  • I assume you mean a library for programming PLCs. Does your PLC provider have any recommendations? Doing a quick google, have you tried http://sourceforge.net/projects/modbus4j/ – Peter Lawrey Jan 14 '11 at 09:00
  • j2mod is a fork of jamod that is still supported in 2017, so if you ended up with installing jamod, consider replacing it with j2mod (API is the same, but some other features were added). – Konstantin K Mar 28 '17 at 20:24

4 Answers4

9

You can try Jamod. I never used it, but a colleague of mine used it sometime ago and he was pleased with it.

jassuncao
  • 4,595
  • 3
  • 26
  • 35
7

Try this one:

http://sourceforge.net/projects/jamod/files/jamod/1.2/

By the way, you can use JDGUI to see the sources of any jar file.

Juvanis
  • 25,000
  • 3
  • 61
  • 84
  • I didn't knew that decompiler. I've been using jad for some time but jad doesn't support the latest versions of .class files. Thank you for the tip – jassuncao Jan 14 '11 at 09:44
  • I've been using Jamod 1.2 for the master and is quite good. The problem is that it does not implement the methods for a Slave using RTU... Only ASCII. From Jamod "Serial Slave How-To" page: "WARNING: The RTU encoding is not supported in slave mode." (Source: http://jamod.sourceforge.net/kb/serial_slave_howto.html) – SergioMP Jan 25 '19 at 09:19
4

If you are using Modbus RTU (Serial) Java Communications API is needed; stolen from FieldKit documentation:

The Java Communication API is available from different sources:

  1. Sun Microsystems is publishing versions for the Solaris and the Windows platform at http://java.sun.com/products/javacomm/.
  2. Keane Jarvi publishes a LGPL licensed Linux and cross-platform COMM API at http://www.rxtx.org/.
  3. An excellently performing package for a large variety of platforms is the SerialPort package from Solutions Consulting at http://www.serialio.com. Using this package, poll cycles of less than 10 ms can be achieved!

Perhaps jSSC is a good javax.comm implementation too.

bluish
  • 23,093
  • 23
  • 110
  • 171
jacktrades
  • 6,766
  • 13
  • 50
  • 80
  • j2mod has [sources on github](https://github.com/steveohara/j2mod). There is some documentation as well. Looks pretty good from a fast overview. – catch23 Feb 15 '21 at 19:37
0

There is another one recent solution modbus4j.