Colway Solutions
Modbus Member Logo

Making Calls into MSPL-C APIs

 

Once you have ported the library to your platform, it is time to make calls into its API's. The following table shows a list of API's that may be called by the user's application:

 

API

When to call

Mandatory?

Remarks

MSPL_RunModbus

Periodically for every channel, as soon as some bytes have arrived into the channel.

Yes

->   This is the main entry point into the library, also called as the trigger function.

->   This function triggers the stack which checks if data has arrived on the specified channel and processes it.

->   This function must be called after the communication channel's device driver is queried to see if some data has been received in its buffer.

MSPL_OpenPort

On program start up, once for every communication channel to be opened and initialised.

No (optional)

->   The user is free to perform channel initialisation outside of the library in which case this function need not be implemented and/or called.

MSPL_ClosePort

Once per channel when Modbus communication is no longer required on that channel.

No (optional)

->   In applications where Modbus communication is expected to be active until the device is switched OFF, this function need not be called at all.

->   As for MSPL_OpenPort, user may choose to implement channel de-initialisation code outside the library in which case this function need not be implemented or called.

MSPL_GetMessageCounters

When the value of statistical counters maintained by the stack are required.

No (optional)

->   Details of the counters can be found in the function reference section for MSPL_GetMessageCounters()

 

Back to Index

Privacy Policy Site Map FAQ Contact Us