fly_uart.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef __BMS_UART_H
  2. #define __BMS_UART_H
  3. // #include "bms_config.h"
  4. #include "fly_param.h"
  5. // #include "bmu_param.h"
  6. #include "includes.h"
  7. #include "iwdg.h"
  8. #include "uart.h"
  9. typedef unsigned char MODBUS_INT8U;
  10. typedef signed char MODBUS_INT8S;
  11. typedef unsigned short MODBUS_INT16U;
  12. typedef signed short MODBUS_INT16S;
  13. typedef unsigned int MODBUS_INT32U;
  14. typedef signed int MODBUS_INT32S;
  15. typedef void (*txfun_p)(const INT8U *buf, INT16U len);
  16. #define MODBUS_GAIN(VALUE1, VALUE2) ((MODBUS_INT32U)(VALUE1) * (VALUE2))
  17. #define MODBUS_SUBTRACT(VALUE1, VALUE2) ((MODBUS_INT32U)(VALUE1) - (VALUE2))
  18. #define MODBUS_DIVISION(DIVISOR, DIVIDEND) (((MODBUS_INT32U)(DIVISOR) + (DIVIDEND) / 2) / (DIVIDEND))
  19. #define MODBUS_ABS(VALUE1) (((VALUE1) < 0) ? (-(VALUE1)) : (VALUE1))
  20. #define BUF_LEN_128 128
  21. #define BUF_LEN_256 256
  22. #define BUF_LEN_512 512
  23. #define RACK_NUM 1u
  24. #define BUF_LEN_768 768
  25. #define GROUP_NUMBER_MAX 15
  26. #define VOL_TMP_PAGE_NUM 32
  27. #define BUF_LEN_256 256
  28. #define BUF_LEN_512 512
  29. #define RACK_NUM 1u
  30. #define BUF_LEN_768 768
  31. #define GROUP_NUMBER_MAX 15
  32. #define VOL_TMP_PAGE_NUM 32
  33. #define FUNC_03 3
  34. #define FUNC_05 5
  35. #define FUNC_06 6
  36. #define FUNC_10 16
  37. // samkoon COM def
  38. #define COUNT_INDEX_H 4
  39. #define COUNT_INDEX_L 5
  40. #define REGISTER_ADDR_H 2
  41. #define REGISTER_ADDR_L 3
  42. #define FUNCTION_CODE_INDEX 1
  43. // samkoon address def
  44. #define MODBUS_ADDR_SOC 0x4101 // 电池簇SOC寄存器地址
  45. #define MODBUS_ADDR_CELL 0x4301 // 单体电压寄存器地址
  46. #define MODBUS_ADDR_TEMP 0x55c1 // 单体温度寄存器地址
  47. #define MODBUS_ADDR_READ_KA 0x1001 // 继电器状态读地址
  48. #define MODBUS_ADDR_RACK_REMOTE 0xC9 //
  49. #define MODBUS_RACK_END 0x4120 // 电池簇SOC寄存器地址
  50. #define MODBUS_CELL_END 0x4490
  51. #define MODBUS_TEMP_END 0x5750
  52. #define MODBUS_KA_END 0x1009
  53. #define MODBUS_ADDR_RACK_REMOTE_END 0xE7
  54. void fly_uart1_task(void);
  55. // void bms_uart1_task(void);
  56. #endif