|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.lsst.ccs.drivers.modbus.Modbus
public class Modbus
Handles Modbus RTU messages on a serial line
| Constructor Summary | |
|---|---|
Modbus()
|
|
| Method Summary | |
|---|---|
void |
close()
Closes the connection to the Modbus |
org.lsst.ccs.drivers.ftdi.Ftdi |
getFtdi()
Gets the associated Ftdi object |
void |
open(int index,
String serial)
Opens a connection to the Modbus |
void |
open(String node,
int index,
String serial)
Opens a connection to the Modbus |
byte[] |
readCoils(short dAddr,
short cNmbr,
short count)
Reads a set of coils |
byte[] |
readDiscretes(short dAddr,
short iNmbr,
short count)
Reads a set of discrete inputs |
short[] |
readInputs(short dAddr,
short rNmbr,
short count)
Reads a set of input registers |
short[] |
readRegisters(short dAddr,
short rNmbr,
short count)
Reads a set of holding registers |
byte[] |
send(short addr,
byte[] cmnd,
int timeout)
Sends a command to a device on the Modbus and returns its response |
void |
writeCoil(short dAddr,
short cNmbr,
boolean value)
Writes a coil |
void |
writeCoils(short dAddr,
short cNmbr,
short count,
byte[] value)
Writes a set of coils |
void |
writeRegister(short dAddr,
short rNmbr,
short value)
Writes a holding register |
void |
writeRegisters(short dAddr,
short rNmbr,
short[] value)
Writes a set of holding registers |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Modbus()
| Method Detail |
|---|
public void open(int index,
String serial)
throws ModbusException
index - The zero-based index of the Modbus adapter within the
list of FTDI devices selected by the serial argumentserial - A string which, if non-null and non-empty, restricts
the list of available devices to those with a serial
number containing this string
ModbusException
public void open(String node,
int index,
String serial)
throws ModbusException
node - The name of the node from which the Modbus is being
served, or null for the local nodeindex - The zero-based index of the Modbus adapter within the
list of FTDI devices selected by the serial argumentserial - A string which, if non-null and non-empty, restricts
the list of available devices to those with a serial
number containing this string
ModbusException
public void close()
throws ModbusException
ModbusExceptionpublic org.lsst.ccs.drivers.ftdi.Ftdi getFtdi()
public byte[] readCoils(short dAddr,
short cNmbr,
short count)
throws ModbusException
dAddr - The Modbus address of the devicecNmbr - The number (starting at 1) of the first coil to readcount - The number of coils to read
ModbusException
public byte[] readDiscretes(short dAddr,
short iNmbr,
short count)
throws ModbusException
dAddr - The Modbus address of the deviceiNmbr - The number (starting at 1) of the first input to readcount - The number of inputs to read
ModbusException
public short[] readRegisters(short dAddr,
short rNmbr,
short count)
throws ModbusException
dAddr - The Modbus address of the devicerNmbr - The number (starting at 1) of the first register to readcount - The number of registers to read
ModbusException
public short[] readInputs(short dAddr,
short rNmbr,
short count)
throws ModbusException
dAddr - The Modbus address of the devicerNmbr - The number (starting at 1) of the first register to readcount - The number of registers to read
ModbusException
public void writeRegister(short dAddr,
short rNmbr,
short value)
throws ModbusException
dAddr - The Modbus address of the devicerNmbr - The number (starting at 1) of the register to writevalue - The (16-bit) value to write
ModbusException
public void writeCoil(short dAddr,
short cNmbr,
boolean value)
throws ModbusException
dAddr - The Modbus address of the devicecNmbr - The number (starting at 1) of the coil to writevalue - The value (false = off, true = on) to write
ModbusException
public void writeRegisters(short dAddr,
short rNmbr,
short[] value)
throws ModbusException
dAddr - The Modbus address of the devicerNmbr - The number (starting at 1) of the first register to
writevalue - The array of register values to write
ModbusException
public void writeCoils(short dAddr,
short cNmbr,
short count,
byte[] value)
throws ModbusException
dAddr - The Modbus address of the devicecNmbr - The number (starting at 1) of the first coil to writecount - The number of coil values to writevalue - The array of coil values to write
ModbusException
public byte[] send(short addr,
byte[] cmnd,
int timeout)
throws ModbusException
addr - The destination Modbus addresscmnd - The command byte array to send.timeout - The timeout period (ms)
ModbusException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||