FOCUS Software Engineering has a new name: proconX - Professional Fieldbus Connections   

MbusMasterFunctions Class Reference
[Data and Control Functions for all Protocols]

Inheritance diagram for MbusMasterFunctions:

Inheritance graph
Collaboration diagram for MbusMasterFunctions:

Collaboration graph
List of all members.

Detailed Description

This base class implements the Modbus® master functions.

These functions apply to all protocol flavours via inheritance. For a more detailed description see section Data and Control Functions for all Protocols. It provides data and control functions only. The data and control functions are organised in three different conformance classes. This implementation implements all functions of conformance class 0 and class 1. In addition some frequently used funtions of conformance class 2 are also implemented. This rich function set enables a user to solve nearly every Modbus data transfer problem.

All functions have been implemented thread-safe.

Version:
1.2
See also:
MbusMasterFunctions, mbusmaster


Class 0 Modbus Functions

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 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.


Class 1 Modbus Functions

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 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 writeCoil (int slaveAddr, int bitAddr, boolean bitVal) throws IOException, BusProtocolException
 Modbus function 5 (05 hex), Force Single Coil/Write Coil.

synchronized void writeSingleRegister (int slaveAddr, int regAddr, short regVal) throws IOException, BusProtocolException
 Modbus function 6 (06 hex), Preset Single Register/Write Single Register.

synchronized byte readExceptionStatus (int slaveAddr) throws IOException, BusProtocolException
 Modbus function 7 (07 hex), Read Exception Status.


Class 2 Modbus Functions

synchronized void forceMultipleCoils (int slaveAddr, int startRef, boolean[] bitArr) throws IOException, BusProtocolException
 Modbus function 15 (0F hex), Force Multiple Coils.

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.


Vendor Specific Modbus 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.


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).


Member Function Documentation

abstract boolean isOpen  )  [pure virtual]
 

Returns whether the protocol has been opened or not (e.g.

the port is opened or connected)

Return values:
true = connected
false = not connected

Implemented in MbusSerialMasterProtocol, and MbusTcpMasterProtocol.

   Back | Top of page Info | Support | Contact | About   
Information in this document is subject to change without notice. Copyright © 2000-2007 proconX Pty Ltd. All rights reserved.
All product and brand names mentioned on this page may be trademarks or registered trademarks of their respective owners.