Hi,
Thanks for this great api. I'm using it with an Beaglebone Black which runs on Android. I successfully used for ModBus TCP Slave app. It worked like a charm. Now I'm trying to use it for Modbus serial slave app. But I am having an error. I think the problem is portname. I'm not realy sure what to use as a portname. Here is the code I tried:
ModbusSerialListener listener = null;
SimpleProcessImage spi = null;
spi = new SimpleProcessImage();
spi.addRegister(new SimpleRegister(45));
spi.addRegister(new SimpleRegister(56));
spi.addDigitalOut(new SimpleDigitalOut(false));
spi.addDigitalOut(new SimpleDigitalOut(false));
ModbusCoupler.getReference().setProcessImage(spi);
ModbusCoupler.getReference().setMaster(false);
SerialParameters params = new SerialParameters();
params.setPortName("/dev/ttyO0");
params.setBaudRate(9600);
params.setDatabits(8);
params.setParity("None");
params.setStopbits(1);
params.setEncoding("ascii");
params.setEcho(false);
listener = new ModbusSerialListener(params);
listener.setListening(true);
ModbusCoupler.getReference().setUnitID(1);
Error: java.lang.NoClassDefFoundError: net.wimpi.modbus.net.SerialConnection
And I'm getting it at "listener = new ModbusSerialListener(params);" part.
It sounds like either you have a JAR that doesn't include the referenced class, or you aren't providing the gnu.io package that SerialConnection requires.