Skip to content

microchip-pic-avr-examples/dspic33a-curiosity-modbus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microchip Logo.

dsPIC33A Curiosity Modbus Demo

Board

Summary

This is a basic Modbus demo to show use of the nanoMODBUS library (https://github.com/debevv/nanoMODBUS).

Related Documentation

dsPIC33AK128MC106 datasheet for more information or specifications

Software Used

Hardware Used

Setup

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

Operation

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.

MCC settings for reference

Clock Configuration

  • Clock Configuration is done in MCC Melody User Interface for this demo code
    clock settings

UART Configuration

  • UART Configuration is done in MCC Melody User Interface for this demo code
    uart settings

Timer Configuration

  • Timer Configuration is done in MCC Melody User Interface for this demo code
    timer settings

PIN Configuration

  • UART Pins: RD1 as U1TX and RD3 as U1RX
    pin selection

About

Demo creates basic modbus RTU server using nanoModbus stack

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •