Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liyanboy74/modbus
MODBUS RTU library for STM32 STM8 AVR LPC & more
https://github.com/liyanboy74/modbus
c library modbus rtu stm32
Last synced: about 6 hours ago
JSON representation
MODBUS RTU library for STM32 STM8 AVR LPC & more
- Host: GitHub
- URL: https://github.com/liyanboy74/modbus
- Owner: liyanboy74
- License: bsd-3-clause
- Created: 2020-10-20T18:03:35.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-21T04:57:12.000Z (4 months ago)
- Last Synced: 2024-07-21T05:45:20.485Z (4 months ago)
- Topics: c, library, modbus, rtu, stm32
- Language: C
- Homepage:
- Size: 652 KB
- Stars: 35
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# MODBUS
Modbus RTU C library for embedded systems.![MBLib-data-flow](https://user-images.githubusercontent.com/64005694/154830661-b1cc3740-ec50-44c9-9330-b34d01b1224c.svg)
### Requirements
**Memory**
Flash
RAM
Master
~2K
64
Slave
~4K
96 *
* Without database size, default +68 Byte.
### Guide
Follow below steps:
- Select master or slave mode in `mb.h` or in Compiler Defines.
- Send Byte-by-Byte received data to `mb_rx_new_data()` for processing .
- Use `mb_set_tx_handler()` for set callback for transmit data from MODBUS layer.
- In master mode, received packet don't process automatically! so the callback must be set by `mb_set_master_process_handler()` .**Note:** The library don't handle Rx Timout error! the `mb_rx_timeout_handler()` must be call for reset rx buffer index .
### Examples
- [STM32 MODBUS Slave Example](https://github.com/ioelectro/modbus-stm32-slave-example.git)
- [STM8 MODBUS Slave Example](https://github.com/ioelectro/modbus-stm8-slave-example)
- [AVR MODBUS Network Example](https://github.com/ioelectro/modbus-avr-example.git)### File Description
**Common**
- `mb` : Common MODBUS init,functions and types
- `mb-link` : Prepare Packet for send, receive and process
- `mb-crc` : Cyclic redundancy check
- `mb-packet` : Make packets**Slave**
- `mb-check` : Checking received data
- `mb-process` : Process received packets
- `mb-table` : Database### Run Test.c
After installing `GCC` and `Make` , run below command:
```
make test
```