Base class which implements Modbus data and control functions. More...
Public Member Functions | |
MbusMasterFunctions () | |
Creates new instance. | |
abstract boolean | isOpen () |
Returns whether the protocol has been opened or not (e.g. | |
abstract void | closeProtocol () throws IOException |
Closes an open protocol including any associated communication resources (com ports or sockets). | |
Bit Access | |
Table 0:00000 (Coils) and Table 1:0000 (Input Status) | |
synchronized void | readCoils (int slaveAddr, int startRef, boolean[] bitArr) throws IOException, BusProtocolException |
Modbus function 1 (01 hex), Read Coil Status/Read Coils. | |
synchronized void | readInputDiscretes (int slaveAddr, int startRef, boolean[] bitArr) throws IOException, BusProtocolException |
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes. | |
synchronized void | writeCoil (int slaveAddr, int bitAddr, boolean bitVal) throws IOException, BusProtocolException |
Modbus function 5 (05 hex), Force Single Coil/Write Coil. | |
synchronized void | forceMultipleCoils (int slaveAddr, int startRef, boolean[] bitArr) throws IOException, BusProtocolException |
Modbus function 15 (0F hex), Force Multiple Coils. | |
Register Access (16-bit, 32-bit and floating point) | |
Table 4:00000 (Holding Registers) and Table 3:00000 (Input Registers) | |
synchronized void | readMultipleRegisters (int slaveAddr, int startRef, short[] regArr) throws IOException, BusProtocolException |
Modbus function 3 (03 hex), Read Holding Registers/Read Multiple Registers. | |
synchronized void | readMultipleRegisters (int slaveAddr, int startRef, int[] int32Arr) throws IOException, BusProtocolException |
Modbus function 3 (03 hex) for 32-bit int data types, Read Holding Registers/Read Multiple Registers as int data. | |
synchronized void | readMultipleRegisters (int slaveAddr, int startRef, float[] float32Arr) throws IOException, BusProtocolException |
Modbus function 3 (03 hex) for 32-bit float data types, Read Holding Registers/Read Multiple Registers as float data. | |
synchronized void | readInputRegisters (int slaveAddr, int startRef, short[] regArr) throws IOException, BusProtocolException |
Modbus function 4 (04 hex), Read Input Registers. | |
synchronized void | readInputRegisters (int slaveAddr, int startRef, int[] int32Arr) throws IOException, BusProtocolException |
Modbus function 4 (04 hex) for 32-bit int data types, Read Input Registers as int data. | |
synchronized void | readInputRegisters (int slaveAddr, int startRef, float[] float32Arr) throws IOException, BusProtocolException |
Modbus function 4 (04 hex) for 32-bit float data types, Read Input Registers as float data. | |
synchronized void | writeSingleRegister (int slaveAddr, int regAddr, short regVal) throws IOException, BusProtocolException |
Modbus function 6 (06 hex), Preset Single Register/Write Single Register. | |
synchronized void | writeMultipleRegisters (int slaveAddr, int startRef, short[] regArr) throws IOException, BusProtocolException |
Modbus function 16 (10 hex), Preset Multiple Registers/Write Multiple Registers. | |
synchronized void | writeMultipleRegisters (int slaveAddr, int startRef, int[] int32Arr) throws IOException, BusProtocolException |
Modbus function 16 (10 hex) for 32-bit int data types, Preset Multiple Registers/Write Multiple Registers with int data. | |
synchronized void | writeMultipleRegisters (int slaveAddr, int startRef, float[] float32Arr) throws IOException, BusProtocolException |
Modbus function 16 (10 hex) for 32-bit float data types, Preset Multiple Registers/Write Multiple Registers with float data. | |
synchronized void | maskWriteRegister (int slaveAddr, int regAddr, short andMask, short orMask) throws IOException, BusProtocolException |
Modbus function 22 (16 hex), Mask Write Register. | |
synchronized void | readWriteRegisters (int slaveAddr, int readRef, short[] readArr, int writeRef, short[] writeArr) throws IOException, BusProtocolException |
Modbus function 23 (17 hex), Read/Write Registers. | |
Diagnostics | |
| |
synchronized byte | readExceptionStatus (int slaveAddr) throws IOException, BusProtocolException |
Modbus function 7 (07 hex), Read Exception Status. | |
Custom Function Codes | |
| |
synchronized void | readHistoryLog (int slaveAddr, int channelNo, int resolution, short readArr[]) throws IOException, BusProtocolException |
Vendor Specific Modbus function 100 (64 hex), Read History Log. | |
Protocol Configuration | |
| |
synchronized void | setTimeout (int timeOut) |
Configures time-out. | |
int | getTimeout () |
Returns the operation time-out value. | |
synchronized void | setPollDelay (int pollDelay) |
Configures poll delay. | |
int | getPollDelay () |
Returns the poll delay time. | |
synchronized void | setRetryCnt (int retryCnt) |
Configures the automatic retry setting. | |
int | getRetryCnt () |
Returns the automatic retry count. | |
Transmission Statistic Functions | |
| |
synchronized long | getTotalCounter () |
Returns how often a transmit/receive cycle has been executed. | |
synchronized void | resetTotalCounter () |
Resets total transmit/receive cycle counter. | |
synchronized long | getSuccessCounter () |
Returns how often a transmit/receive cycle was successful. | |
synchronized void | resetSuccessCounter () |
Resets successful transmit/receive counter. | |
Slave Configuration | |
| |
void | configureStandard32BitMode () |
Configures all slaves for Standard 32-bit Mode. | |
void | configureSingleReg32BitMode () |
Configures all slaves for Single Register 32-bit Mode. | |
void | configureCountFromOne () |
Configures the reference counting scheme to start with one for all slaves. | |
void | configureCountFromZero () |
Configures the reference counting scheme to start with zero for all slaves. | |
void | configureLittleEndianInts () |
Disables word swapping for int data type functions for all slaves. | |
void | configureBigEndianInts () |
Configures int data type functions to do a word swap for all slaves. | |
void | configureLittleEndianFloats () |
Disables float data type functions to do a word swap for all slaves. | |
void | configureSwappedFloats () |
Configures float data type functions to do a word swap for all slaves. | |
synchronized void | configureStandard32BitMode (int slaveAddr) |
Configures a slave for Standard 32-bit Register Mode. | |
synchronized void | configureSingleReg32BitMode (int slaveAddr) |
Configures all slaves for Single Register 32-bit Mode. | |
synchronized void | configureCountFromOne (int slaveAddr) |
Configures a slave's reference counting scheme to start with one. | |
synchronized void | configureCountFromZero (int slaveAddr) |
Configures a slave's reference counting scheme to start with zero. | |
synchronized void | configureLittleEndianInts (int slaveAddr) |
Disables word swapping for int data type functions on a per slave basis. | |
synchronized void | configureBigEndianInts (int slaveAddr) |
Enables int data type functions to do a word swap on a per slave basis. | |
synchronized void | configureLittleEndianFloats (int slaveAddr) |
Disables float data type functions to do a word swap on a per slave basis. | |
synchronized void | configureSwappedFloats (int slaveAddr) |
Enables float data type functions to do a word swap on a per slave basis. |
Base class which implements Modbus data and control functions.
The functions provided by this base class apply to all protocol flavours via inheritance. For a more detailed description see section Data and Control Functions for all Modbus Protocol Flavours.
All functions have been implemented thread-safe.
synchronized void readCoils | ( | int | slaveAddr, | |
int | startRef, | |||
boolean[] | bitArr | |||
) | throws IOException, BusProtocolException |
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
Reads the contents of the discrete outputs (coils, 0:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
startRef | Start reference (Range: depends on configuration setting) | |
bitArr | Buffer which will contain the data read. The length of the array determines how many coils are read (Range: 1-2000). |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void readInputDiscretes | ( | int | slaveAddr, | |
int | startRef, | |||
boolean[] | bitArr | |||
) | throws IOException, BusProtocolException |
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.
Reads the contents of the discrete inputs (coils, 1:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
startRef | Start reference (Range: depends on configuration setting) | |
bitArr | Buffer which will contain the data read. The length of the array determines how many coils are read (Range: 1-2000). |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void writeCoil | ( | int | slaveAddr, | |
int | bitAddr, | |||
boolean | bitVal | |||
) | throws IOException, BusProtocolException |
Modbus function 5 (05 hex), Force Single Coil/Write Coil.
Sets a single discrete output variable (coil, 0:00000 table) to either ON or OFF.
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 247) | |
bitAddr | Coil address (Range: depends on configuration setting) | |
bitVal | true sets, false clears discrete output variable |
IllegalStateException | Port or connection is closed | |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void forceMultipleCoils | ( | int | slaveAddr, | |
int | startRef, | |||
boolean[] | bitArr | |||
) | throws IOException, BusProtocolException |
Modbus function 15 (0F hex), Force Multiple Coils.
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
startRef | Start reference (Range: depends on configuration setting) | |
bitArr | Buffer which contains the data to be sent. The length of the array determines how many coils are written (Range: 1-1968). |
IllegalStateException | Port or connection is closed | |
IOException | An I/O error occured | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void readMultipleRegisters | ( | int | slaveAddr, | |
int | startRef, | |||
short[] | regArr | |||
) | throws IOException, BusProtocolException |
Modbus function 3 (03 hex), Read Holding Registers/Read Multiple Registers.
Reads the contents of the output registers (holding registers, 4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
startRef | Start reference (Range: depends on configuration setting) | |
regArr | Buffer which will be filled with the data read. The length of the array determines how many registers are read (Range: 1-125). |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void readMultipleRegisters | ( | int | slaveAddr, | |
int | startRef, | |||
int[] | int32Arr | |||
) | throws IOException, BusProtocolException |
Modbus function 3 (03 hex) for 32-bit int data types, Read Holding Registers/Read Multiple Registers as int data.
Reads the contents of pairs of two consecutive output registers (holding registers, 4:00000 table) into float values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
startRef | Start reference (Range: depends on configuration setting) | |
int32Arr | Buffer which will be filled with the data read. The length of the array determines how many registers are read (Range: 1-62). |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void readMultipleRegisters | ( | int | slaveAddr, | |
int | startRef, | |||
float[] | float32Arr | |||
) | throws IOException, BusProtocolException |
Modbus function 3 (03 hex) for 32-bit float data types, Read Holding Registers/Read Multiple Registers as float data.
Reads the contents of pairs of two consecutive output registers (holding registers, 4:00000 table) into float values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
startRef | Start reference (Range: depends on configuration setting) | |
float32Arr | Buffer which will be filled with the data read. The length of the array determines how many registers are read (Range: 1-62). |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void readInputRegisters | ( | int | slaveAddr, | |
int | startRef, | |||
short[] | regArr | |||
) | throws IOException, BusProtocolException |
Modbus function 4 (04 hex), Read Input Registers.
Read the contents of the input registers (3:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
startRef | Start reference (Range: depends on configuration setting) | |
regArr | Buffer which will be filled with the data read. The length of the array determines how many registers are read (Range: 1-125). |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void readInputRegisters | ( | int | slaveAddr, | |
int | startRef, | |||
int[] | int32Arr | |||
) | throws IOException, BusProtocolException |
Modbus function 4 (04 hex) for 32-bit int data types, Read Input Registers as int data.
Reads the contents of pairs of two consecutive input registers (3:00000 table) into float values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
startRef | Start reference (Range: depends on configuration setting) | |
int32Arr | Buffer which will be filled with the data read. The length of the array determines how many registers are read (Range: 1-62). |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void readInputRegisters | ( | int | slaveAddr, | |
int | startRef, | |||
float[] | float32Arr | |||
) | throws IOException, BusProtocolException |
Modbus function 4 (04 hex) for 32-bit float data types, Read Input Registers as float data.
Reads the contents of pairs of two consecutive input registers (3:00000 table) into float values.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
startRef | Start reference (Range: depends on configuration setting) | |
float32Arr | Buffer which will be filled with the data read. The length of the array determines how many registers are read (Range: 1-62). |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void writeSingleRegister | ( | int | slaveAddr, | |
int | regAddr, | |||
short | regVal | |||
) | throws IOException, BusProtocolException |
Modbus function 6 (06 hex), Preset Single Register/Write Single Register.
Writes a value into a single output register (holding register, 4:00000 reference).
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 247) | |
regAddr | Register address (Range: depends on configuration setting) | |
regVal | Data to be sent |
IllegalStateException | Port or connection is closed | |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void writeMultipleRegisters | ( | int | slaveAddr, | |
int | startRef, | |||
short[] | regArr | |||
) | throws IOException, BusProtocolException |
Modbus function 16 (10 hex), Preset Multiple Registers/Write Multiple Registers.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 247) | |
startRef | Start reference (Range depends on configuration setting) | |
regArr | Buffer with the data to be sent. The length of the array determines how many registers are sent (Range: 1-61). |
IllegalStateException | Port or connection is closed | |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void writeMultipleRegisters | ( | int | slaveAddr, | |
int | startRef, | |||
int[] | int32Arr | |||
) | throws IOException, BusProtocolException |
Modbus function 16 (10 hex) for 32-bit int data types, Preset Multiple Registers/Write Multiple Registers with int data.
Writes int values into a pairs of output registers (holding registers, 4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 247) | |
startRef | Start reference (Range: depends on configuration setting) | |
int32Arr | Buffer with the data to be sent. The length of the array determines how many registers are sent (Range: 1-61). |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void writeMultipleRegisters | ( | int | slaveAddr, | |
int | startRef, | |||
float[] | float32Arr | |||
) | throws IOException, BusProtocolException |
Modbus function 16 (10 hex) for 32-bit float data types, Preset Multiple Registers/Write Multiple Registers with float data.
Writes float values into a pairs of output registers (holding registers, 4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 0 - 247) | |
startRef | Start reference (Range: depends on configuration setting) | |
float32Arr | Buffer with the data to be sent. The length of the array determines how many registers are sent (Range: 1-61). |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void maskWriteRegister | ( | int | slaveAddr, | |
int | regAddr, | |||
short | andMask, | |||
short | orMask | |||
) | throws IOException, BusProtocolException |
Modbus function 22 (16 hex), Mask Write Register.
Masks bits according to an AND & an OR mask into a single output register (holding register, 4:00000 reference). Masking is done as follows: result = (currentVal AND andMask) OR (orMask AND (NOT andMask))
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
regAddr | Register address (Range: depends on configuration setting) | |
andMask | Mask to be applied as a logic AND to the register | |
orMask | Mask to be applied as a logic OR to the register |
IllegalStateException | Port or connection is closed | |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void readWriteRegisters | ( | int | slaveAddr, | |
int | readRef, | |||
short[] | readArr, | |||
int | writeRef, | |||
short[] | writeArr | |||
) | throws IOException, BusProtocolException |
Modbus function 23 (17 hex), Read/Write Registers.
Combines reading and writing of the output registers in one transaction (holding registers, 4:00000 table).
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) | |
readRef | Start reference for reading (Range: depends on configuration setting) | |
readArr | Buffer which will contain the data read. The length of the array determines how many registers are read (Range: 1-125). | |
writeRef | Start reference for writing (Range: depends on configuration setting) | |
writeArr | Buffer with data to be sent. The length of the array determines how many registers are sent (Range: 1-121). |
IllegalStateException | Port or connection is closed | |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized byte readExceptionStatus | ( | int | slaveAddr | ) | throws IOException, BusProtocolException |
Modbus function 7 (07 hex), Read Exception Status.
Reads the eight exception status coils within the slave device.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255) |
IllegalStateException | Port or connection is closed | |
IOException | An I/O error occured | |
IllegalArgumentException | A parameter is out of range | |
BusProtocolException | A protocol failure occured. See descendants of BusProtocolException for a more detailed failure list. |
synchronized void setTimeout | ( | int | timeOut | ) |
Configures time-out.
This function sets the time-out to the specified value. A value of 0 disables the time-out, which causes all subsequent calls to data and control functions to block.
timeOut | Timeout value in ms (Range: 0 - 100000), 0 disables time-out |
IllegalStateException | Port is open | |
IllegalArgumentException | Parameter is out of range |
int getTimeout | ( | ) |
Returns the operation time-out value.
synchronized void setPollDelay | ( | int | pollDelay | ) |
Configures poll delay.
This function sets the delay time which applies between two consecutive Modbus read/write. A value of 0 disables the poll delay.
pollDelay | Delay time in ms (Range: 0 - 100000), 0 disables poll delay |
IllegalStateException | Port is open | |
IllegalArgumentException | Parameter is out of range |
int getPollDelay | ( | ) |
Returns the poll delay time.
synchronized void setRetryCnt | ( | int | retryCnt | ) |
Configures the automatic retry setting.
A value of 0 disables any automatic retries.
retryCnt | Retry count (Range: 0 - 10), 0 disables retries |
IllegalStateException | Port is open | |
IllegalArgumentException | Parameter is out of range |
int getRetryCnt | ( | ) |
Returns the automatic retry count.
synchronized long getTotalCounter | ( | ) |
Returns how often a transmit/receive cycle has been executed.
synchronized long getSuccessCounter | ( | ) |
Returns how often a transmit/receive cycle was successful.
void configureStandard32BitMode | ( | ) |
Configures all slaves for Standard 32-bit Mode.
In Standard 32-bit Register Mode a 32-bit value is transmitted as two consecutive 16-bit Modbus registers.
void configureSingleReg32BitMode | ( | ) |
Configures all slaves for Single Register 32-bit Mode.
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one 32-bit Modbus register instead of two 16-bit registers.
void configureCountFromOne | ( | ) |
Configures the reference counting scheme to start with one for all slaves.
This renders the reference range to be 1 to 0x10000 and register #0 is an illegal register.
void configureCountFromZero | ( | ) |
Configures the reference counting scheme to start with zero for all slaves.
This is also known as PDU addressing.
This renders the valid reference range to be 0 to 0xFFFF.
This renders the first register to be #0 for all slaves.
void configureLittleEndianInts | ( | ) |
Disables word swapping for int data type functions for all slaves.
Modbus is using little-endian word order for 32-bit values. This setting assumes that the slave also serves 32-bit data in in little little-endian word order.
void configureBigEndianInts | ( | ) |
Configures int data type functions to do a word swap for all slaves.
Modbus is using little-endian word order for 32-bit values. The data transfer functions operating upon 32-bit int data types can be configured to do a word swap which enables them to read 32-bit data correctly from a big-endian machine.
void configureLittleEndianFloats | ( | ) |
Disables float data type functions to do a word swap for all slaves.
Modbus is using little-endian word order for 32-bit values. This setting assumes that the slaves also serves 32-bit floats in little little-endian word order which is the most common case.
void configureSwappedFloats | ( | ) |
Configures float data type functions to do a word swap for all slaves.
The data functions operating upon 32-bit float data types can be configured to do a word swap.
synchronized void configureStandard32BitMode | ( | int | slaveAddr | ) |
Configures a slave for Standard 32-bit Register Mode.
In Standard 32-bit Register Mode a 32-bit value is transmitted as two consecutive 16-bit Modbus registers.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
synchronized void configureSingleReg32BitMode | ( | int | slaveAddr | ) |
Configures all slaves for Single Register 32-bit Mode.
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one 32-bit Modbus register instead of two 16-bit registers.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
synchronized void configureCountFromOne | ( | int | slaveAddr | ) |
Configures a slave's reference counting scheme to start with one.
This renders the reference range to be 1 to 0x10000 and register #0 is an illegal register.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
synchronized void configureCountFromZero | ( | int | slaveAddr | ) |
Configures a slave's reference counting scheme to start with zero.
This is also known as PDU addressing.
This renders the valid reference range to be 0 to 0xFFFF.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
synchronized void configureLittleEndianInts | ( | int | slaveAddr | ) |
Disables word swapping for int data type functions on a per slave basis.
Modbus is using little-endian word order for 32-bit values. This setting assumes that the slave also serves 32-bit data in little little-endian word order.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
synchronized void configureBigEndianInts | ( | int | slaveAddr | ) |
Enables int data type functions to do a word swap on a per slave basis.
Modbus is using little-endian word order for 32-bit values. The data transfer functions operating upon 32-bit int data types can be configured to do a word swap which enables them to read 32-bit data correctly from a big-endian machine.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
synchronized void configureLittleEndianFloats | ( | int | slaveAddr | ) |
Disables float data type functions to do a word swap on a per slave basis.
Modbus is using little-endian word order for 32-bit values. This setting assumes that the slave also serves 32-bit floats in little little-endian word order which is the most common case.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
synchronized void configureSwappedFloats | ( | int | slaveAddr | ) |
Enables float data type functions to do a word swap on a per slave basis.
The data functions operating upon 32-bit float data types can be configured to do a word swap.
slaveAddr | Modbus address of slave device or unit identifier (Range: 1 - 255). A value of zero configures the behaviour for broadcasting. |
abstract boolean isOpen | ( | ) | [pure virtual] |
Returns whether the protocol has been opened or not (e.g.
the port is opened or connected)
true | = connected | |
false | = not connected |
Implemented in MbusSerialMasterProtocol, MbusTcpMasterProtocol, and MbusRtuOverTcpMasterProtocol.