ModbusCoupler.getReference().setProcessImage(spi);
ModbusCoupler.getReference().setMaster(false);
ModbusCoupler.getReference().setUnitID(2);
//3. Set up serial parameters
SerialParameters params = new SerialParameters();
params.setPortName(portname);
params.setBaudRate(9600);
params.setDatabits(8);
params.setParity("None");
params.setStopbits(1);
params.setEncoding("ascii");
params.setEcho(false);
if (Modbus.debug) System.out.println("Encoding [" + params.getEncoding() + "]");
//4. Set up serial listener
listener = new ModbusSerialListener(params);
listener.setListening(true);