增加采集电池电压

This commit is contained in:
2025-12-08 22:19:02 +08:00
parent f40bb7707b
commit 083d062792
8 changed files with 98 additions and 34 deletions

View File

@@ -124,18 +124,12 @@ typedef union _UnMotorTempInput
// 接收BMS输入
typedef struct _StrBmsInput
{
//----接收0x100----------------------------------
//----接收0x301----------------------------------
// 多字节数据,高位在前,低位在后
unsigned int bus_voltage : 16; // 母线电压 单位为10mV
unsigned int bus_current : 16; // 母线电流 单位为10mA
unsigned int remainder_capacity : 16; // 剩余容量 单位为10mAh 充电为正,放电为负
unsigned int crc1 : 16; //crc
//----接收0x101----------------------------------
// 多字节数据,高位在前,低位在后
unsigned int full_capacity : 16; // 充满容量 单位为10mAh
unsigned int Discharge_times : 16; // 放电循环次数 单位为1次
unsigned int soc : 16; // soc 1%
unsigned int crc2 : 16; //crc
uint16_t bus_voltage ; // 母线电压 单位为0.01V
uint16_t low_voltage ; // 母线电流 单位为0.01V
uint16_t channel3 ; // 保留通道
uint16_t crc1 ; //
} StrBmsInput;
typedef union _UnBmsInput
@@ -667,6 +661,37 @@ typedef union _UnComputerOutput
} UnComputerOutput;
// BMS数据请求结构体
typedef struct _StrBMSRequest
{
uint16_t reserved1;
uint16_t reserved2;
uint16_t reserved3;
uint16_t reserved4;
} StrBMSRequest;
typedef union _UnBMSRequest
{
StrBMSRequest bit_data; // 使用定义的结构体变量名
uint8_t arr[sizeof(StrBMSRequest)]; // 通过结构体类型确定大小
} UnBMSRequest;
//// BMS数据输入结构体
//typedef struct _StrBMSIntput
//{
// uint16_t reserved1;
// uint16_t reserved2;
// uint16_t reserved3;
// uint16_t reserved4;
//} StrBMSIntput;
//
//typedef union _UnBMSRequest
//{
// StrBMSIntput bit_data; // 使用定义的结构体变量名
// uint8_t arr[sizeof(StrBMSIntput)]; // 通过结构体类型确定大小
//} UnBMSIntput;
// 车辆信息,输出给上位机
@@ -886,6 +911,13 @@ typedef union _UnAutoControlOutput
//-----IO口---------------------------------------------------------------
// 电压信号输出,到遥控器
typedef struct _StrVoltageSignalOutput
@@ -942,6 +974,7 @@ extern UnSdoOutput un_sdo_output6 ;//设定右
extern UnSdoOutput un_sdo_output7 ;//使能右电机
extern UnSdoOutput un_sdo_output8 ;//设定右电机模式
extern UnBMSRequest un_bms_request ;//BMS 请求
//串口
extern UnRemoteControlInput un_remote_control_input; //遥控器输入