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

General Description

Introduction

This FieldTalk Modbus® Slave Library - C++ Edition is a C++ class library which allows you to incorporate Modbus slave functionality into your device or application.

Typical applications are supervisory control systems, data concentrators and gateways, user interfaces and factory information systems.

Features:

  • Robust design suitable for real-time and industrial applications
  • Full implementation of Class 0 and Class 1 Modbus functions as well as a subset of the most commonly used Class 2 functions
  • Support of Broadcasting
  • Master time-out supervision
  • Failure and transmission counters
  • Multi-platform design
  • Scalable: you can use serial protocols only or TCP/IP or all of them
  • Customized modifications and development of add-ons available

Library Structure

The library is organised in two categories of classes.

One category implements the Server Engines for each Modbus slave protocol flavour. There is one Server Engine class for each protocol flavour and a common Server Engine base class, which applies to all protocol flavours. Because the two serial protocols ASCII and RTU share some common code, an intermediate base class implements the functions specific to serial protocols.

mbusslave_inherit.gif
The second category of classes is Data Providers classes. Data Provider classes represent the interface between the Server Engine and your application.

mbusslave_collab.gif
The base class MbusSlaveServer contains a protocol unspecific Server Engine and the protocol state machine. All protocol flavours inherit from this base class.

The class MbusAsciiSlaveProtocol implements the Modbus ASCII protocol, the class MbusRtuSlaveProtocol implements the Modbus RTU protocol and the class MbusTcpSlaveProtocol implements the MODBUS/TCP protocol.

Before a server can be used, a Data Provider has to be declared. A Data Provider is created by declaring a new class derived from MbusDataTableInterface. The class MbusDataTableInterface is the base class for a Data Provider and implements a set of default methods. An application specific Data Provider simply overrides selected default methods and the Modbus slave is ready.

class MyMbusDataTable: public MbusDataTableInterface
{
   ... // Application specific data interface
} dataTable;

In order to use one of the three slave protocols, the desired protocol flavour class has to be instantiated and associated with the Data Provider:

MbusRtuSlaveProtocol mbusProtocol(&dataTable);

After a protocol object has been declared and started up the server loop has to be executed cyclically. The Modbus slave is ready to accept connections and to reply to master queries.

while (1)
{
   mbusProtocol.serverLoop();
}

Overview

   Back | Top of page Info | Support | Contact | About   
Information in this document is subject to change without notice. Copyright © 2000-2010 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.