SimpleModbusSlave allows you to communicate to any slave using the Modbus RTU protocol. The crc calculation is based on https://os.mbed.com/users/jpelletier/code/CRC/ The functions implemented are functions 3 and 16. read holding registers and preset multiple registers of the Modbus RTU Protocol. This implementation DOES NOT fully comply with the Modbus specifications.
Diff: lib_crc.h
- Revision:
- 0:7c5265097fd2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib_crc.h Tue Oct 10 12:22:31 2017 +0000 @@ -0,0 +1,12 @@ +#ifndef _LIB_CRC_H_ +#define _LIB_CRC_H_ + +#include <stdint.h> + +#define CRC_VERSION "2.0" + +uint16_t update_crc16_reflected( uint16_t *table, uint16_t crc, char c ); +uint16_t update_crc16_A001( uint16_t crc, char c ); +uint16_t calculate_crc16_Modbus(char *p, unsigned int length); + +#endif /* _LIB_CRC_H_ */