Make your own free website on Tripod.com

Java ModbusException Class Members

public class ModbusException extends RuntimeException

A ModbusException object represents an exception condition related to a communication operation whith modbus slave device. These exceptions include communications exceptions and modbus functions exceptions, for instance , if you try to preset a register and the address is invalid, the modbus slave return a message indicating this invalid operation.

You do not need to create objects of this class, this creation is intended to be made inside Modbus class.

Constructor

public ModbusException(String s, int iErrorNumber)

parameters

s - String with error Description.

iErrorNumber - Error number.

example

objModbus.ThrowException(true);

try {

//It's not needed to verify each call for errors

objModbus.ForceSingleCoil((short)17,172,true) ; //force coil 173 ON in slave device 17
objModbus.PresetSingleRegister((short)17,1,3) ; //preset register 40002 to 03 in slave device 17

}

catch(ModbusException e) {

         System.out.println( e.getMessage());

}

 

See also: RuntimeException in Java help files.