FieldTalk Modbus® Slave Library C++ Editions |
![]() |
All Bit Access and 16 Bits Access Modbus Function Codes have been implemented. In addition the most frequently used Diagnostics Function Codes have been implemented.
The following table lists the functions supported by the slave:
Modbus Function Code | Current Terminology | Classic Terminology
|
16-bit Access | ||
3 | Read Multiple Registers | Read Holding Registers |
4 | Read Input Registers | Read Input Registers |
6 | Write Single Register | Preset Single Register |
16 (10 Hex) | Write Multiple Registers | Preset Multiple Registers |
22 (16 Hex) | Mask Write Register | Mask Write Register |
23 (17 Hex) | Read/Write Registers | Read/Write Registers
|
Bit access | ||
1 | Read Coils | Read Coil Status |
2 | Read Inputs Discretes | Read Input Status |
5 | Write Coil | Force Single Coil |
15 (0F Hex) | Force Multiple Coils | Force Multiple Coils
|
Diagnostics | ||
7 | Read Exception Status | Read Exception Status |
8 sub code 00 | Diagnostics - Return Query Data | Diagnostics - Return Query Data |
Server Management Functions | |
int | MbusSlaveServer::addDataTable (int slaveAddr, MbusDataTableInterface *dataTablePtr) |
Associates a protocol object with a Data Provider and a slave address. | |
virtual int | MbusSlaveServer::serverLoop ()=0 |
Modbus slave server loop. | |
virtual void | MbusSlaveServer::shutdownServer () |
Shuts down the Modbus Server. | |
virtual int | MbusSlaveServer::isStarted ()=0 |
Returns if server has been started up. | |
virtual int | MbusSlaveServer::getConnectionStatus ()=0 |
Associates a protocol object with a Data Provider and a slave address. | |
Protocol Configuration | |
long | MbusSlaveServer::setTimeout (long timeOut) |
Configures master transmit time-out supervision. | |
long | MbusSlaveServer::getTimeout () |
Returns the master time-out supervision value. | |
Transmission Statistic Functions | |
unsigned long | MbusSlaveServer::getTotalCounter () |
Returns how often a message transfer has been executed. | |
void | MbusSlaveServer::resetTotalCounter () |
Resets total message transfer counter. | |
unsigned long | MbusSlaveServer::getSuccessCounter () |
Returns how often a message transfer was successful. | |
void | MbusSlaveServer::resetSuccessCounter () |
Resets successful message transfer counter. | |
Utility Functions | |
static char * | MbusSlaveServer::getPackageVersion () |
Returns the package version number. |
|
Associates a protocol object with a Data Provider and a slave address.
|
|
Configures master transmit time-out supervision. The slave can monitor whether a master is actually transmitting characters or not. This function sets the transmit time-out to the specified value. A value of 0 disables the time-out, which stops time-out notifications being sent to the Data Provider.
|
|
Returns how often a message transfer has been executed.
|
|
Returns the package version number.
|
|
Returns the master time-out supervision value.
|
|
Returns how often a message transfer was successful.
|
|
Modbus slave server loop. This server loop must be called continuously. It must not be blocked. The server has to be started before calling the serverLoop() method. In most cases the server loop is executed in an endless loop: while (1) { mbusProtocol.serverLoop(); doOtherStuff(); }
Implemented in MbusRtuSlaveProtocol, MbusAsciiSlaveProtocol, and MbusTcpSlaveProtocol. |
|
Shuts down the Modbus Server. This function also closes any associated serial ports or sockets. Reimplemented in MbusSerialSlaveProtocol, and MbusTcpSlaveProtocol. |
|
Returns if server has been started up.
Implemented in MbusSerialSlaveProtocol, and MbusTcpSlaveProtocol. |
|
Associates a protocol object with a Data Provider and a slave address.
Implemented in MbusSerialSlaveProtocol, and MbusTcpSlaveProtocol. |
Copyright © 2002-2006
FOCUS Software Engineering Pty Ltd, Australia.
All rights reserved.
Please see the Notices page for trademark notices. Last updated: 20 Oct 2006 |