ALGO_CRC_ATY.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * @file ALGO_CRC_ATY.h
  3. *
  4. * @param Project ALGO_Algorithm_ATY_LIB
  5. *
  6. * @author ATY
  7. *
  8. * @copyright
  9. * - Copyright 2017 - 2026 MZ-ATY
  10. * - This code follows:
  11. * - MZ-ATY Various Contents Joint Statement -
  12. * <a href="https://mengze.top/MZ-ATY_VCJS">
  13. * https://mengze.top/MZ-ATY_VCJS</a>
  14. * - CC 4.0 BY-NC-SA -
  15. * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
  16. * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
  17. * - Your use will be deemed to have accepted the terms of this statement.
  18. *
  19. * @brief functions of CRC16 Modbus(others to be supplemented) for all codes
  20. *
  21. * @version
  22. * - 1_01_200318 > ATY
  23. * -# Preliminary version, first Release
  24. * - 1_03_200318 > ATY
  25. * -# Add Conditional Compilation
  26. * -# Add user port
  27. * - 1_05_200722 > ATY
  28. * -# Change parameters
  29. **********************************************************************************
  30. */
  31. #ifndef __ALGO_CRC_ATY_H
  32. #define __ALGO_CRC_ATY_H
  33. #include "INCLUDE_ATY.h"
  34. #include "ALGO_AlgorithmBase_ATY.h"
  35. /******************************* For user *************************************/
  36. #define __CRC_CALC_ATY // define to calculate, otherwise use look-up table
  37. /******************************************************************************/
  38. uint16_t GenCrc16Modbus(uint8_t* buf, uint8_t size);
  39. uint8_t GenCrc16ModbusHL(uint8_t* buf, uint8_t size, uint8_t highLow);
  40. uint8_t CheckCrc16Modbus(uint8_t* buf, uint8_t size);
  41. // #define ALGO_CRC_ATY_Test_ATY
  42. #ifdef ALGO_CRC_ATY_Test_ATY
  43. void Crc16Modbus_Test_ATY(void);
  44. #endif /* ALGO_CRC_ATY_Test_ATY */
  45. // http://api.ip33.com/ss/crc/c?data=12+32&width=16&poly=8005&init=FFFF&xor=0000&refin=true&refout=true
  46. // {
  47. // "code": 0,
  48. // "hex": "C58C",
  49. // "bin": "1100010110001100"
  50. // }
  51. #endif /* __ALGO_CRC_ATY_H */
  52. /******************************** End Of File *********************************/