
This is a basic Modbus demo to show use of the nanoMODBUS library (https://github.com/debevv/nanoMODBUS).
dsPIC33AK128MC106 datasheet for more information or specifications
- MPLAB® X IDE v6.25 or newer
- MPLAB® XC-DSC v3.21 or newer
- Device Family Pack: dsPIC33AK-MC_DFP v1.1.109
- MPLAB® Code Configurator (MCC) 5.1.2 or newer
Hardware Setup
- Connect a USB-C cable to port
J24
of Curiosity board to USB port of PC
MPLAB® X IDE Setup
- Open the
modbus-basic.X
project in MPLAB® X IDE - Build and program the device
helper script
- To test the Modbus communication, run the helper script: python utilities/modbus_tester.py
The modbus_basic.X project was written for the dsPIC33AK128MC106 device running on the dsPIC33A Curiosity Platform Board P/N EV74H48A. The application creates a Modbus RTU server. Custom user callback functions for nanomodbus are created in the modbus.c file. The number of coils and registers used in the application are defined in modbus.h. Data transfer is done over the UART to USB interface of the Curiosity Platform Board. The Python script in the project directory uses the pymodbus library to create a basic client to write and then read some registers and coils.
Clock Configuration
UART Configuration
Timer Configuration
PIN Configuration