MSPM0 Modbus Library User’s Guide¶
1. Introduction¶
The MSPM0 Modbus Library provides a simple way to start development of Modbus applications using MSPM0 devices.
2. Modbus Library Features¶
This Library was developed in compliance with Modbus V1.2 specification
3. Modbus Example Usage¶
Two examples are given in the MSPM0 SDK demonstrating the MSPM0 as a Modbus Controller or Modbus Target
To test the Modbus controller and Modbus target examples, connect the UART pins of controller and target. Refer to code example readme for specefic pin configurations. Load the program to controller device and target device. The example serves the following commands
S.No |
Command |
Code |
Description |
|---|---|---|---|
1 |
Read discrete Inputs |
0x02 |
To read the contents of discrete inputs. |
2 |
Read coils |
0x01 |
To read the contents of coils. |
3 |
Write single coil |
0x05 |
To write the content on a coil. |
4 |
Write multiple coil |
0x0F |
To write the content on multiple coils. |
5 |
Read input registers |
0x04 |
To read the contents of input registers. |
6 |
Read holding registers |
0x03 |
To read the contents of holding registers. |
7 |
Write single register |
0x06 |
To write the content on a holding register. |
8 |
Write multiple registers |
0x10 |
To write the content on multiple holding registers. |
9 |
Read/Write multiple registers |
0x17 |
To simultaneously read and write multiple holding registers, write before read. |
10 |
Mask write register |
0x16 |
To write the content on a holding register based on and/or mask. |
11 |
Read FIFO queue |
0x18 |
Planned for future. |
12 |
Read file record |
0x14 |
Planned for future (example use case is in SDK with 1 file and 10 records). |
13 |
Write file record |
0x15 |
Planned for future (example use case is in SDK with 1 file and 10 records). |
14 |
Read exception status |
0x07 |
To read the exception status (1=exception occurred in last transaction, 0= No exception). |
15 |
Diagnostic |
0x08 |
Working depends on subfunction code. |
16 |
Get comm event counter |
0x0B |
To get the total number of events that have occurred at the target side. |
17 |
Get comm event log |
0x0C |
To get the event logs of all the events. Each event is a byte, with each bit having specific meaning, user can refer the official specification document of Modbus to get the exact matching of each bit. |
18 |
Report Server ID |
0x11 |
To get the server ID of the target, along with its status, whether it is on or it is off. |
3.1 Supported Hardware¶
LP_MSPM0G3507
4. Library Versions¶
Version 1.00.00.00
SDK Release: 2.06.00.xx
Updates:
Initial release.