Skip to content

RTU Modbus implementation for 8-bit PIC Microchip MCU

License

Notifications You must be signed in to change notification settings

lmartorella/pic-modbus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modbus for PIC16 Microchip microcontroller

This is a ANSI-C portable, small-footprint, serial-line (RTU) client implementation of Modbus for the 8-bit PIC16 family of Microchip microcontrollers, with application limited to holding registries reads/writes.

On a PIC16F1827 device, (with ~7Kb of program memory and 384 bytes of data memory), the library built with the free version of Microchip XC8 compiler, takes roughly 1/4 of the total resources.

Features

  • Implements Modbus functions 0x3 and 0x10 (Read/Write Holding Registries) via custom handlers
  • Minimal memory, code and stack footprint to cope with lowest specs 8-bit MCUs
  • Direct connection to MAX485/MAX3485 level translator, via RX/TX/OE pins
  • Leverage hardware USART and timers for accurate protocol timing
  • Implement system register (check reset/error codes, CRC errors, etc...)
  • Optimized for free XC8 compiler

Samples

In addition to the bare library, the folder samples contains some sample code for simple applications.

More details can be found here.

A small footprint hardware implementation

My current prototype is a small board, made to fit in wall switches, with power regulator (3.3V or 5V), RS-485 adapter, and a micro-switch and LED. It sports a PIC16F1827 with nine general-purpose I/O ports and bus/supply pins available through a 0.1” header.

More details can be found here.

About

RTU Modbus implementation for 8-bit PIC Microchip MCU

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published