123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #ifndef __BMS_UART_H
- #define __BMS_UART_H
- // #include "bms_config.h"
- #include "fly_param.h"
- // #include "bmu_param.h"
- #include "includes.h"
- #include "iwdg.h"
- #include "uart.h"
- typedef unsigned char MODBUS_INT8U;
- typedef signed char MODBUS_INT8S;
- typedef unsigned short MODBUS_INT16U;
- typedef signed short MODBUS_INT16S;
- typedef unsigned int MODBUS_INT32U;
- typedef signed int MODBUS_INT32S;
- typedef void (*txfun_p)(const INT8U *buf, INT16U len);
- #define MODBUS_GAIN(VALUE1, VALUE2) ((MODBUS_INT32U)(VALUE1) * (VALUE2))
- #define MODBUS_SUBTRACT(VALUE1, VALUE2) ((MODBUS_INT32U)(VALUE1) - (VALUE2))
- #define MODBUS_DIVISION(DIVISOR, DIVIDEND) (((MODBUS_INT32U)(DIVISOR) + (DIVIDEND) / 2) / (DIVIDEND))
- #define MODBUS_ABS(VALUE1) (((VALUE1) < 0) ? (-(VALUE1)) : (VALUE1))
- #define BUF_LEN_128 128
- #define BUF_LEN_256 256
- #define BUF_LEN_512 512
- #define RACK_NUM 1u
- #define BUF_LEN_768 768
- #define GROUP_NUMBER_MAX 15
- #define VOL_TMP_PAGE_NUM 32
- #define BUF_LEN_256 256
- #define BUF_LEN_512 512
- #define RACK_NUM 1u
- #define BUF_LEN_768 768
- #define GROUP_NUMBER_MAX 15
- #define VOL_TMP_PAGE_NUM 32
- #define FUNC_03 3
- #define FUNC_05 5
- #define FUNC_06 6
- #define FUNC_10 16
- // samkoon COM def
- #define COUNT_INDEX_H 4
- #define COUNT_INDEX_L 5
- #define REGISTER_ADDR_H 2
- #define REGISTER_ADDR_L 3
- #define FUNCTION_CODE_INDEX 1
- // samkoon address def
- #define MODBUS_ADDR_SOC 0x4101 // 电池簇SOC寄存器地址
- #define MODBUS_ADDR_CELL 0x4301 // 单体电压寄存器地址
- #define MODBUS_ADDR_TEMP 0x55c1 // 单体温度寄存器地址
- #define MODBUS_ADDR_READ_KA 0x1001 // 继电器状态读地址
- #define MODBUS_ADDR_RACK_REMOTE 0xC9 //
- #define MODBUS_RACK_END 0x4120 // 电池簇SOC寄存器地址
- #define MODBUS_CELL_END 0x4490
- #define MODBUS_TEMP_END 0x5750
- #define MODBUS_KA_END 0x1009
- #define MODBUS_ADDR_RACK_REMOTE_END 0xE7
- void fly_uart1_task(void);
- void fly_uart3_task(void);
- #endif
|