public class Modbus
extends org.lsst.ccs.drivers.ascii.Ascii
| Modifier and Type | Class and Description |
|---|---|
static class |
Modbus.ConnType
Private & package data.
|
org.lsst.ccs.drivers.ascii.Ascii.DataBits, org.lsst.ccs.drivers.ascii.Ascii.FlowCtrl, org.lsst.ccs.drivers.ascii.Ascii.Option, org.lsst.ccs.drivers.ascii.Ascii.Parity, org.lsst.ccs.drivers.ascii.Ascii.StopBits, org.lsst.ccs.drivers.ascii.Ascii.Terminator| Constructor and Description |
|---|
Modbus() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isAddressMode()
Returns whether entity numbers are direct addresses.
|
void |
open(org.lsst.ccs.drivers.commons.DriverConstants.ConnType type,
String ident,
int parm1,
int parm2)
Opens a connection to the Modbus.
|
void |
open(Modbus.ConnType type,
String ident)
Opens a connection to the Modbus.
|
void |
open(Modbus.ConnType type,
String ident,
int parm1)
Opens a connection to the Modbus.
|
void |
open(Modbus.ConnType type,
String ident,
int parm1,
int parm2)
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
|
void |
setAddressMode(boolean mode)
Sets whether entity numbers are direct addresses.
|
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
|
close, closeSilent, flush, isOpen, makeDataCharacteristics, open, open, openFtdi, openFtdi, openFtdi, openNet, openNet, openSerial, openSerial, openSerial, read, read, readBytes, readBytes, setCommandTerm, setDefaultParm, setOptions, setResponseTerm, setTerminator, setTimeout, setTimeout, write, writeBytes, writeBytespublic void open(Modbus.ConnType type, String ident, int parm1, int parm2) throws org.lsst.ccs.drivers.commons.DriverException
type - The type of connection to makeident - The device identifier:
host name or IP address for network;
serial number for FTDI device;
port name for serialparm1 - The first device parameter:
port number for network;
baud rate for FTDI or serialparm2 - The second device parameter:
unused for network;
data characteristics for FTDI or serialorg.lsst.ccs.drivers.commons.DriverExceptionpublic void open(Modbus.ConnType type, String ident, int parm1) throws org.lsst.ccs.drivers.commons.DriverException
type - The type of connection to makeident - The device identifier:
host name or IP address for network;
serial number for FTDI device;
port name for serialparm1 - The first device parameter:
port number for network;
baud rate for FTDI or serialorg.lsst.ccs.drivers.commons.DriverExceptionpublic void open(Modbus.ConnType type, String ident) throws org.lsst.ccs.drivers.commons.DriverException
type - The type of connection to makeident - The device identifier:
host name or IP address for network;
serial number for FTDI device;
port name for serialorg.lsst.ccs.drivers.commons.DriverExceptionpublic void open(org.lsst.ccs.drivers.commons.DriverConstants.ConnType type,
String ident,
int parm1,
int parm2)
throws org.lsst.ccs.drivers.commons.DriverException
open in class org.lsst.ccs.drivers.ascii.Asciitype - The type of connection to makeident - The device identifier:
host name or IP address for network;
serial number for FTDI device;
port name for serialparm1 - The first device parameter:
port number for network;
baud rate for FTDI or serialparm2 - The second device parameter:
unused for network;
data characteristics for FTDI or serialorg.lsst.ccs.drivers.commons.DriverExceptionpublic void setAddressMode(boolean mode)
mode - Whether or not address mode is to be setpublic boolean isAddressMode()
public byte[] readCoils(short dAddr,
short cNmbr,
short count)
throws org.lsst.ccs.drivers.commons.DriverException
dAddr - The Modbus address of the devicecNmbr - The number of the first coil to readcount - The number of coils to readorg.lsst.ccs.drivers.commons.DriverExceptionpublic byte[] readDiscretes(short dAddr,
short iNmbr,
short count)
throws org.lsst.ccs.drivers.commons.DriverException
dAddr - The Modbus address of the deviceiNmbr - The number of the first input to readcount - The number of inputs to readorg.lsst.ccs.drivers.commons.DriverExceptionpublic short[] readRegisters(short dAddr,
short rNmbr,
short count)
throws org.lsst.ccs.drivers.commons.DriverException
dAddr - The Modbus address of the devicerNmbr - The number of the first register to readcount - The number of registers to readorg.lsst.ccs.drivers.commons.DriverExceptionpublic short[] readInputs(short dAddr,
short rNmbr,
short count)
throws org.lsst.ccs.drivers.commons.DriverException
dAddr - The Modbus address of the devicerNmbr - The number of the first register to readcount - The number of registers to readorg.lsst.ccs.drivers.commons.DriverExceptionpublic void writeRegister(short dAddr,
short rNmbr,
short value)
throws org.lsst.ccs.drivers.commons.DriverException
dAddr - The Modbus address of the devicerNmbr - The number of the register to writevalue - The (16-bit) value to writeorg.lsst.ccs.drivers.commons.DriverExceptionpublic void writeCoil(short dAddr,
short cNmbr,
boolean value)
throws org.lsst.ccs.drivers.commons.DriverException
dAddr - The Modbus address of the devicecNmbr - The number of the coil to writevalue - The value (false = off, true = on) to writeorg.lsst.ccs.drivers.commons.DriverExceptionpublic void writeRegisters(short dAddr,
short rNmbr,
short[] value)
throws org.lsst.ccs.drivers.commons.DriverException
dAddr - The Modbus address of the devicerNmbr - The number of the first register to writevalue - The array of register values to writeorg.lsst.ccs.drivers.commons.DriverExceptionpublic void writeCoils(short dAddr,
short cNmbr,
short count,
byte[] value)
throws org.lsst.ccs.drivers.commons.DriverException
dAddr - The Modbus address of the devicecNmbr - The number of the first coil to writecount - The number of coil values to writevalue - The array of coil values to writeorg.lsst.ccs.drivers.commons.DriverExceptionCopyright © 2018 LSST. All rights reserved.