Server Functions common to all Protocol Flavours
Detailed Description
The
FieldTalk Modbus Slave Protocol Library's server engine implements the most commonly used Modbus data functions as well as some control functions. The functions to perform PLC program download and other device specific functions are outside the scope of this library.
All functions of conformance Class 0 and Class 1 have been implemented. In addition the most frequent used functions of conformance Class 2 have been implemented.
The following table lists the functions supported by the slave:
| Function Code | Current Terminology | Classic Terminology |
| Conformance Class 0 |
| 3 (03 hex) | Read Multiple Registers | Read Holding Registers |
| 16 (10 hex) | Write Multiple Registers | Preset Multiple Registers |
| Conformance Class 1 |
| 1 (01 hex) | Read Coils | Read Coil Status |
| 2 (02 hex) | Read Inputs Discretes | Read Input Status |
| 4 (04 hex) | Read Input Registers | Read Input Registers |
| 5 (05 hex) | Write Coil | Force Single Coil |
| 6 (06 hex) | Write Single Register | Preset Single Register |
| 7 (07 hex) | Read Exception Status | Read Exception Status |
| Conformance Class 2 |
| 15 (0F hex) | Force Multiple Coils | Force Multiple Coils |
| 22 (16 hex) | Mask Write Register | Mask Write Register |
| 23 (17 hex) | Read/Write Registers | Read/Write Registers |
Function Documentation
|
|
Associates a protocol object with a Data Provider and a slave address.
- Parameters:
-
| dataTablePtr | Modbus data table pointer. Must point to a Data Provider object derived from the MbusDataTableInterface class. The Data Provider is the interface between your application data and the Modbus network. |
- Returns:
- FTALK_SUCCESS on success or error code. See Protocol Errors and Exceptions for a list of error codes.
|
| long setTimeout |
( |
long |
timeOut |
) |
[inherited] |
|
|
|
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.
- Remarks:
- The time-out value is indicative only and not guaranteed to be maintained. How precise it is followed depends on the operating system used, it's scheduling priority and it's system timer resolution.
- Note:
- The time-out does not check if a master is sending valid frames.
- Parameters:
-
| timeOut | Timeout value in ms (Range: 0 - 100000), 0 disables time-out |
- Return values:
-
| FTALK_SUCCESS | Success |
| FTALK_ILLEGAL_ARGUMENT_ERROR | Argument out of range |
|
| unsigned long getTotalCounter |
( |
|
) |
[inherited] |
|
|
|
Returns how often a message transfer has been executed.
- Returns:
- Counter value
|
| char * getPackageVersion |
( |
|
) |
[static, inherited] |
|
|
|
Returns the package version number.
- Returns:
- Package version string
|
| long getTimeout |
( |
|
) |
[inherited] |
|
|
|
Returns the master time-out supervision value.
- Remarks:
- The time-out value is indicative only and not guaranteed to be maintained. How precise it is followed depends on the operating system used, it's scheduling priority and it's system timer resolution.
- Returns:
- Timeout value in ms
|
| unsigned long getSuccessCounter |
( |
|
) |
[inherited] |
|
|
|
Returns how often a message transfer was successful.
- Returns:
- Counter value
|
| virtual int serverLoop |
( |
|
) |
[pure virtual, inherited] |
|
| void shutdownServer |
( |
|
) |
[virtual, inherited] |
|
| virtual int isStarted |
( |
|
) |
[pure virtual, inherited] |
|