Colway Solutions
Modbus Member Logo

Glue MMPL-C to application and database

Glue library to Application

The library handles the task of framing and de-framing Modbus messages. The data within the messages are supplied by respective application programs. The library encapsulates this data as per Modbus framing rules and transmits it to the recipient.

 

Using the functions Read Coil and Write Coil to illustrate.

  • Read Coil: In response to the Read Coil command, the application program running on the slave will supply data to the library. The library will frame the data in accordance to Modbus framing rules and send it to the master, completing the transaction.
  • Write Coil: The application running on the master supplies the data to the library. The library encapsulates the data in the right frames and forwards the framed message to the slave program, which executes the command.

  •  

    One function in the Main.c file facilitate the interface between the library and your application and database.

  • DoModbusTransaction: Called by MMPL-C that drives Modbus communication on a network.
  •  

    This function present a well defined interface that is fully documented in this manual.

     

    Please refer to sample Win32 port for a complete reference.

     

    Glue library to Simulated Database

    A simulated database forms part of the library supplied. It has a few variables of all the data types supported by the library.

    Use this database as a first step to get the library working on your platform. This exercise will assist in integrating the library with the application's database.

     

    The database is created at the beginning of the Main.c file and contains the following data elements:


    S.No.

    Data Element

    Associated Modbus Data Type

    Number of Arrays

    Memory Address

    1

    CSPL_U8 (single byte)

    Coils, Discrete Inputs

    2

    0000 to 0015 (16 items)

     

    2

    CSPL_U16 (two byte)

    Holding and Input Registers

    2

    0000 to 0010 (10 items)

     

    The interface functions in the Main.c file operate upon this simulated database.

    After testing with this database, you may replace it with your own. Modify the interface functions to operate on your database.

     

    Back to Index

    Privacy Policy Site Map FAQ Contact Us