forked from luguangmeng/BAIYI
514 lines
14 KiB
C
514 lines
14 KiB
C
|
#ifndef __CAN_H
|
|||
|
#define __CAN_H
|
|||
|
#include "sys.h"
|
|||
|
|
|||
|
#include "stm32f10x.h"
|
|||
|
#include "stm32f10x_can.h"
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#define CAN_MAX_PACKET 20
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
uint8_t head;
|
|||
|
uint8_t tail;
|
|||
|
CanRxMsg Msgbody[CAN_MAX_PACKET];
|
|||
|
}CAN_REV_Mutli_t;
|
|||
|
|
|||
|
|
|||
|
//<2F><><EFBFBD>ֽ<D6BD>
|
|||
|
#define CanCHMID 0x1826f456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CanBHMID 0x182756f4 //BMS<4D><53><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><>ʶ<EFBFBD><EFBFBD>
|
|||
|
#define CanCRMID 0x1801f456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6>
|
|||
|
#define CanBRMID 0x1C0256f4 //BMS <20>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD> //<2F><><EFBFBD>ȼ<EFBFBD> 06 0x180256f4 07 0x1C0256f4
|
|||
|
#define CanBRMID1 0x1CEC56f4 //BMS <20>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD> // EC<45><43>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><D7AE>Ҫ<EFBFBD><D2AA><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CanBRMID2 0x1CEB56f4 //BMS <20>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD> // EB<45><42>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><D7AE>ʼ<EFBFBD><CABC><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD>ý<C3BD>
|
|||
|
#define CanBCPID 0x180656f4 //<2F><><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // <20><><EFBFBD>ȼ<EFBFBD> 06 0x180656f4 07 0x1C0656f4
|
|||
|
#define CanBCPID1 0x1C0656f4 //<2F><><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CanCTSID 0x1807f456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>Ϣ
|
|||
|
#define CanCMLID 0x1808f456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CanBROID 0x100956f4 //<2F><><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CanCROID 0x100af456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CanBCLID 0x181056f4 //<2F><><EFBFBD>س<EFBFBD><D8B3>缶<EFBFBD><E7BCB6>
|
|||
|
#define CanBCSID 0x181156f4 //<2F><><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>״̬ // 06 0x181156f4 07 0x1C1156f4
|
|||
|
#define CanCCSID 0x1812f456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|||
|
#define CanBSMID 0x181356f4 //
|
|||
|
#define CanBMVID 0x1C1556f4 //<2F><><EFBFBD>ظ<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ѹ // 06 CanBMVID 0x181556f4 //<2F><><EFBFBD>ظ<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ѹ
|
|||
|
#define CanBMTID 0x1C1656f4 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD> //06 0x181656f4 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
|||
|
#define CanBSOCID 0x181756f4 //<2F><><EFBFBD><EFBFBD>SOC<4F><43><EFBFBD><EFBFBD>
|
|||
|
#define CanBAVID 0x181856f4 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD>ѹ
|
|||
|
#define CanBSTID 0x101956f4 //BMS<4D><53>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
|||
|
#define CanBSTID1 0x181956f4 //BMS<4D><53>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
|||
|
#define CanCSTID 0x101af456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
|||
|
#define CanCSTID1 0x181af456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CanBSDID 0x181c56f4 //BMS<4D><53><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>
|
|||
|
#define CanCSDID 0x181df456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CanBEMID 0x081e56f4 //BMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CanCEMID 0x081ff456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>ID
|
|||
|
#define CAN_CM_CTRL_ID 0x1CEC0000 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CAN_CM_DATA_ID 0x1CEB0000 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>ID <09><><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
#define CAN_CM_CTRL_ID1 0x1cecf456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
|||
|
#define CAN_CM_DATA_ID1 0x1cebf456 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>ID
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>ֱ<EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD>
|
|||
|
#define CM_RTS_CTRL_CODE 0x10
|
|||
|
#define CM_CTS_CTRL_CODE 0x11
|
|||
|
#define CM_EMA_CTRL_CODE 0x13
|
|||
|
#define CM_ABORT_CTRL_CODE 0xFF
|
|||
|
|
|||
|
|
|||
|
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>PGN<47><4E><EFBFBD><EFBFBD>
|
|||
|
#define CM_BRM_PGN 0x000200 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
#define CM_BMV_PGN 0x001500 //<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ѹ
|
|||
|
#define CM_BMT_PGN 0x001600 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
|||
|
#define CM_BSOC_PGN 0x001700 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD>SOC
|
|||
|
#define CM_BAV_PGN 0x001800 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ѹ
|
|||
|
#define CM_BCP_PGN 0x000600 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CM_BCS_PGN 0x001100 //<2F><><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>״̬
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#pragma pack (1) /*ָ<><D6B8><EFBFBD><EFBFBD>1<EFBFBD>ֽڶ<D6BD><DAB6><EFBFBD>*/
|
|||
|
|
|||
|
typedef union
|
|||
|
{
|
|||
|
uint8_t stats[14];
|
|||
|
struct
|
|||
|
{
|
|||
|
|
|||
|
uint8_t ChrgPlAtvStpChrg :2; //<2F><><EFBFBD><EFBFBD><EFBFBD><D7AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ
|
|||
|
uint8_t Pnt2VltDtnErr :2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32>ѹ<EFBFBD>쳣
|
|||
|
uint8_t ChrgConcetErr :2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t ChrgReserve1 :2; //Ԥ<><D4A4>
|
|||
|
|
|||
|
uint8_t ChrgPlStpChrgRsn1 :2; //<2F><><EFBFBD><EFBFBD><EFBFBD>趨<EFBFBD><E8B6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ
|
|||
|
uint8_t ChrgPlStpChrgRsn2 :2; //<2F>˹<EFBFBD><CBB9><EFBFBD>ֹ
|
|||
|
uint8_t ChrgPlStpChrgRsn3 :2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ
|
|||
|
uint8_t ChrgPlStpChrgRsn4 :2; //bms<6D><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ
|
|||
|
|
|||
|
uint8_t ChrgPlStpChrgFltRsn1 :2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t ChrgPlStpChrgFltRsn2 :2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t ChrgPlStpChrgFltRsn3 :2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t ChrgPlStpChrgFltRsn4 :2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>
|
|||
|
|
|||
|
uint8_t ChrgPlStpChrgFltRsn5 :2; //<2F><><EFBFBD><EFBFBD><EFBFBD><D7AE>ͣ
|
|||
|
uint8_t ChrgPlStpChrgFltRsn6 :2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t ChrgPlStpChrgFltRsn7 :2; //Ԥ<><D4A4>1
|
|||
|
uint8_t ChrgPlStpChrgFltRsn8 :2; //Ԥ<><D4A4>2
|
|||
|
|
|||
|
uint8_t ChrgPlStpChrgErrRsn1 :2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>
|
|||
|
uint8_t ChrgPlStpChrgErrRsn2 :2; //<2F><>ѹ<EFBFBD>쳣
|
|||
|
uint8_t ChrgPlStpChrgErrRsn3 :2; //Ԥ<><D4A4>1
|
|||
|
uint8_t ChrgPlStpChrgErrRsn4 :2; //Ԥ<><D4A4>2
|
|||
|
|
|||
|
//bem bms ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD> 4
|
|||
|
uint8_t RcvChrgPlMsgTmt1 :2; //<2F><><EFBFBD><EFBFBD>bms<6D><73>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>00<30><30>ʱ
|
|||
|
uint8_t RcvChrgPlMsgTmt2 :2; //<2F><><EFBFBD><EFBFBD>bms<6D><73>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>aa<61><61>ʱ
|
|||
|
uint8_t RcvChrgPlMsgTmt_1 :2; //Ԥ<><D4A4>1
|
|||
|
uint8_t RcvChrgPlMsgTmt_2 :2; //Ԥ<><D4A4>1
|
|||
|
|
|||
|
uint8_t RcvChrgPlMsgTmt3 :2;// <20><><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD>ʱ<D7AE><CAB1>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvChrgPlMsgTmt4 :2; // <20><><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><D7AE><D7BC><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvChrgPlMsgTmt_3 :2; //Ԥ<><D4A4>1
|
|||
|
uint8_t RcvChrgPlMsgTmt_4 :2; //Ԥ<><D4A4>1
|
|||
|
|
|||
|
//6
|
|||
|
uint8_t RcvChrgPlMsgTmt5 :2; // <20><><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><D7AE><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvChrgPlMsgTmt6 :2; // <20><><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><D7AE>ֹ<EFBFBD><D6B9><EFBFBD>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvChrgPlMsgTmt_5 :2; //Ԥ<><D4A4>1
|
|||
|
uint8_t RcvChrgPlMsgTmt_6 :2; //Ԥ<><D4A4>1
|
|||
|
//7
|
|||
|
uint8_t RcvChrgPlMsgTmt7 :2; //<2F><><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD>ͳ<D7AE>Ʊ<EFBFBD><C6B1>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvChrgPlMsgTmt_7 :6; //Ԥ<><D4A4>
|
|||
|
|
|||
|
|
|||
|
//bms<6D><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD>ʱ
|
|||
|
uint8_t RcvBMSMsgTmt1 :2; //<2F><><EFBFBD><EFBFBD>bms<6D><73>ʶ<EFBFBD><CAB6><EFBFBD>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvBMSMsgTmt_1 :6; //
|
|||
|
|
|||
|
|
|||
|
uint8_t RcvBMSMsgTmt2 :2; //<2F><><EFBFBD>յ<EFBFBD><D5B5>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvBMSMsgTmt3 :2; //<2F><><EFBFBD><EFBFBD>bms<73><D7BC><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvBMSMsgTmt_2 :2; //Ԥ<><D4A4>
|
|||
|
uint8_t RcvBMSMsgTmt_3 :2; //Ԥ<><D4A4>
|
|||
|
|
|||
|
uint8_t RcvBMSMsgTmt4 :2; //<2F><><EFBFBD><EFBFBD>bms<6D><73><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvBMSMsgTmt5 :2; //<2F><><EFBFBD>յ<EFBFBD><D5B5>س<EFBFBD><D8B3><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvBMSMsgTmt6 :2; // <20><><EFBFBD><EFBFBD>bms<6D><73>ֹ<EFBFBD><D6B9><EFBFBD>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvBMSMsgTmt_6:2; //Ԥ<><D4A4>
|
|||
|
uint8_t RcvBMSMsgTmt7 :2; //<2F><><EFBFBD><EFBFBD>bmsͳ<73>Ʊ<EFBFBD><C6B1>ij<EFBFBD>ʱ
|
|||
|
uint8_t RcvBMSMsgTmt_7 :6; //Ԥ<><D4A4>
|
|||
|
uint8_t reserve7:8;
|
|||
|
}bits;
|
|||
|
}stop_t;
|
|||
|
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
|
|||
|
uint8_t VersionNo[3]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>Э<EFBFBD><D0AD><EFBFBD>汾<EFBFBD><E6B1BE>
|
|||
|
uint8_t identify; //<2F><>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD> CRM
|
|||
|
uint8_t SerialNo[4]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t RegionalCode[3]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/վ<><D5BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ASCII<49><49>
|
|||
|
uint8_t date[7]; //CTS
|
|||
|
// CML
|
|||
|
uint16_t ChargeOutMaxVoltage; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ 1λС<CEBB><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|||
|
uint16_t ChargeOutMinVoltage; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ
|
|||
|
uint16_t ChargeOutMaxCurrent; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint16_t ChargeOutMinCurrent;
|
|||
|
// CRO
|
|||
|
uint8_t ready; //<><D7BC><EFBFBD><EFBFBD>
|
|||
|
// CCS <20><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
|||
|
uint16_t ChargeOutVoltage; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ 1λС<CEBB><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|||
|
uint16_t ChargeOutCurrent; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint16_t ChargeTime; //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
uint8_t ChargeAllow; // 00<30><30>ͣ 01<30><31><EFBFBD><EFBFBD>
|
|||
|
// CST <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
stop_t end;
|
|||
|
// uint8_t StopReason; // 00<30><30>ͣ 01<30><31><EFBFBD><EFBFBD>
|
|||
|
// uint16_t ChargeEndFaultCode; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
|||
|
// uint8_t ChargeEndErrCode; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
|||
|
// CSD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>
|
|||
|
uint16_t ChargeTimeTotal; // <20>ܵij<DCB5><C4B3><EFBFBD>ʱ<EFBFBD><CAB1> 0-600min
|
|||
|
uint16_t ChargeEnergyTotal; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0.1kwh 0-1000kwh
|
|||
|
uint8_t SerialNumber[4]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// CEM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
int32_t BmsRcvCode; //<2F><><EFBFBD>յı<D5B5><C4B1><EFBFBD>
|
|||
|
uint8_t REV_CML_FLAG;
|
|||
|
}ChargeParam_t;
|
|||
|
#pragma pack() /*ȡ<><C8A1>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD>ָ<EFBFBD>ȱʡ<C8B1><CAA1><EFBFBD><EFBFBD>*/
|
|||
|
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
extern ChargeParam_t CDZ_ChargeInfo;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BMS<4D><53>ͨѶ<CDA8><D1B6><EFBFBD>̶<EFBFBD><CCB6><EFBFBD> */
|
|||
|
enum
|
|||
|
{
|
|||
|
CDZ_CHARGE_HAND_PROCESS = 0, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<D6BD>
|
|||
|
CDZ_CHARGE_CONFIG_PROCESS, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ý<C3BD>
|
|||
|
CDZ_CHARGE_CHARGING_PROCESS, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
CDZ_CHARGE_END_PROCESS, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
CDZ_CHARGE_ERROR_PROCESS //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
};
|
|||
|
/* <20><><EFBFBD>ֽ<D6BD> BHM */
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
uint8_t ChargeAllowMaxVoltage; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>ѹ 0.1V
|
|||
|
} Battery_PackInfo_t;
|
|||
|
/* <20><>ʶ<EFBFBD><EFBFBD> BRM */
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD><EFBFBD><EFBFBD>Ϣ */
|
|||
|
#pragma pack (1)
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
uint8_t ucBmsVersion[3]; //<2F><><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD>汾<EFBFBD><E6B1BE>
|
|||
|
uint8_t ucBatType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint16_t TotalCapacity; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0.1 AH
|
|||
|
uint16_t TotalVoltage; //<2F>ܵ<EFBFBD>ѹ 0.1V
|
|||
|
uint8_t ucProductName[4]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint32_t uBatIndex; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t uProductYear; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD> BCD
|
|||
|
uint8_t uProductMonth; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD> BCD
|
|||
|
uint8_t uProductDay; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD> bcd
|
|||
|
|
|||
|
uint8_t uChargeCountTotal[3]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t ucBatOwnerFlag; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>Ȩ<EFBFBD><C8A8>Ϣ<EFBFBD><CFA2>0-<2D><><EFBFBD><EFBFBD>;1-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t ucReserved; //Ԥ<><D4A4>
|
|||
|
uint8_t ucVehichleInfo[17]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6>Ϣ VIN<49><4E>
|
|||
|
uint8_t ucSoftwareVersion[8]; //bms<6D><73><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><E6B1BE>
|
|||
|
} Bms_BatInfo_t;
|
|||
|
//Bms_BatInfo_t Bms_BatInfo;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD> */
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
uint16_t BatMaxChargeVol; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ(0.00~24.00V) 0.01V
|
|||
|
uint16_t BatMaxChargeCur; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(-400.0A~0A) 0.1A
|
|||
|
uint16_t uBatMaxEnergy; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0~1000ah 1% 0.1kw
|
|||
|
uint16_t BatMaxTotalChargeVol; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD>ѹ(0.0~800.0V) 0.1V
|
|||
|
uint8_t uBatMaxTempPlus50; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>(-50~200<30><30>)
|
|||
|
|
|||
|
uint16_t uTotalBatSOC; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غɵ<D8BA>״̬(0.0~100.0%) <20><>λ0.1%
|
|||
|
uint16_t fTotalBatVol; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ǰ<EFBFBD><C7B0>ѹ(0.0~750.0V) 0.1V
|
|||
|
}CDZ_BAT_CONFIG_PARAM_t;
|
|||
|
//CDZ_BAT_CONFIG_PARAM_t Bms_BatCfgParam;
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
/* <20><><EFBFBD>ֽ<D6BD> BHM */
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
uint8_t BMS_ChargeReady; //<2F><><EFBFBD><EFBFBD><EFBFBD><D7BC> 00 δ<CEB4><D7BC><EFBFBD><EFBFBD> AA<41><D7BC><EFBFBD><EFBFBD> FF <20><>Ч
|
|||
|
} Battery_Pack_Ready_t;
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD>β<D7B6><CEB2><EFBFBD><EFBFBD><EFBFBD>Ϣ*/
|
|||
|
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
uint16_t BatRequireVoltage; //<2F><><EFBFBD>ص<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
|
|||
|
uint16_t BatRequireCurrent; //<2F><><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t uChargeMode; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ģʽ<C4A3><CABD>CHARGE_FIX_VOLTAGE--<2D><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
|
|||
|
// CHARGE_FIX_CURRENT--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
uint16_t BatRealVol; //<2F><><EFBFBD>ص<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>ֵ
|
|||
|
uint16_t BatRealCur; //<2F><><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
|
|||
|
uint16_t nBayMaxVolInfo; //<2F><><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>ѹ
|
|||
|
uint8_t uBatCurSOC; //<2F><>ǰ<EFBFBD>ɵ<EFBFBD>״̬
|
|||
|
uint16_t uEvalChargeFinTime; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
uint16_t uChargeEnergy; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t uChargeEnable; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t contactorState; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint8_t DC_300V_ContactorState; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// uint8_t uBatMinTempPlus50; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
|||
|
// uint8_t uBatMaxTempPlus50; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
|||
|
}Bms_BatRealInfo_t;
|
|||
|
|
|||
|
#pragma pack() /*ȡ<><C8A1>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD>ָ<EFBFBD>ȱʡ<C8B1><CAA1><EFBFBD><EFBFBD>*/
|
|||
|
|
|||
|
//Bms_BatRealInfo_t Bms_BatRealInfo;
|
|||
|
|
|||
|
//extern uint16_t Plc_RequireVoltage;
|
|||
|
//extern uint16_t Plc_RequireCurrent;
|
|||
|
|
|||
|
typedef union
|
|||
|
{
|
|||
|
uint16_t flag;
|
|||
|
struct
|
|||
|
{
|
|||
|
uint16_t cellVolF : 2;
|
|||
|
uint16_t socFlag : 2;
|
|||
|
uint16_t curFlag : 2;
|
|||
|
uint16_t tempFlag : 2;
|
|||
|
uint16_t resFlag : 2;
|
|||
|
uint16_t contFlag : 2;
|
|||
|
uint16_t chgFlag : 2;
|
|||
|
}bits;
|
|||
|
}Bms_BATSTATUS;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ε<D7B6><CEB5>ص<EFBFBD>ʵʱ״̬ BSM */
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
uint8_t uBatMaxVolSerialNo; //<2F><><EFBFBD>ߵ<EFBFBD><DFB5>嶯<EFBFBD><E5B6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD>
|
|||
|
uint8_t uBatMaxTemp; //<2F><><EFBFBD>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
|||
|
uint8_t uBatMaxTempPosition; //<2F><><EFBFBD><EFBFBD><EFBFBD>¶ȼ<C2B6><C8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
/*add*/
|
|||
|
uint8_t uBatMinTemp; //<2F><><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5>¶<EFBFBD>
|
|||
|
uint8_t uBatMinTemPosition; //<2F><><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5>¶ȼ<C2B6><C8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
Bms_BATSTATUS BAT_STATUS; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|||
|
} Bms_BatRealStatus_t;
|
|||
|
//Bms_BatRealStatus_t Bms_BatRealStatus;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ε<D7B6><CEB5><EFBFBD><EFBFBD>¶<EFBFBD> BMT*/
|
|||
|
typedef struct __Bms_BatChargeInfo___
|
|||
|
{
|
|||
|
uint16_t fBatCellVol[256]; //#1~256 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA>ѹ
|
|||
|
int8_t uBatCellTemp[128]; //1~128<32>¶<EFBFBD>
|
|||
|
} Bms_BatChargeInfo;
|
|||
|
|
|||
|
|
|||
|
/* BMS<4D><53>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD> BST*/
|
|||
|
typedef struct __CDZ_BMS_END_CHARGE_INFO__
|
|||
|
{
|
|||
|
int8_t uBmsEndChargeReason; //BMS<4D><53>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
|||
|
int8_t uBmsEndFaultCode[2]; //BMS<4D><53>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
|||
|
int8_t uBmsEndErrCode; //BMS<4D><53>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
|||
|
|
|||
|
}Bms_EndChargeInfo;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD>BMSͳ<53><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSD*/
|
|||
|
typedef struct __CDZ_BMS_STAT_DATA__
|
|||
|
{
|
|||
|
uint8_t EndSOC; //<2F><>ֹ<EFBFBD>ɵ<EFBFBD>״̬
|
|||
|
uint16_t BatCellMinVol; //<2F><><EFBFBD>嶯<EFBFBD><E5B6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>ѹ
|
|||
|
uint16_t BatCellMaxVol; //<2F><><EFBFBD>嶯<EFBFBD><E5B6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>ѹ
|
|||
|
int8_t cBatMinTempPlus50; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD> -50 ƫ<><C6AB><EFBFBD><EFBFBD>
|
|||
|
int8_t cBatMaxTempPlus50; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD> -50 ƫ<><C6AB><EFBFBD><EFBFBD>
|
|||
|
}Bms_StatInfo;
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BEM*/
|
|||
|
typedef struct __Bms_StatusInfo_
|
|||
|
{
|
|||
|
int32_t BmsErrCode; //bms<6D><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int8_t bBmsFaultCode[4]; //Bms<6D><73><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>
|
|||
|
}Bms_StatusInfo;
|
|||
|
|
|||
|
typedef struct _Bms_TaskManager_
|
|||
|
{
|
|||
|
int8_t bBmsTaskStep;
|
|||
|
int8_t bBmsProcRes; // 01 <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7> 02 <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7> 04 <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
|||
|
int8_t bBmsConmand; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
} Bms_TaskManger;
|
|||
|
void bms_SendCRM(uint8_t uIdentyFlag);
|
|||
|
|
|||
|
#define CC_CHARGE_INIT 0x00 //<2F><><EFBFBD><EFBFBD>
|
|||
|
#define CC_CHARGE_IDLE 0x01 //<2F><><EFBFBD><EFBFBD>
|
|||
|
#define CC_CHARGE_READY 0x02 //<><D7BC>
|
|||
|
#define CC_CHARGE_START 0x03 //<2F><>ʼ
|
|||
|
#define CC_CHARGE_ING 0x04 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CC_CHARGE_END 0x05 //ֹͣ
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#define CC_CHARGE1_ING 0x01 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CC_CHARGE2_ING 0x02 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CC_CHARGE3_ING 0x03 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CC_CHARGE4_ING 0x04 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define CC_CHARGE5_ING 0x05 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
extern uint8_t g_ChargeStep;
|
|||
|
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
#define D_CDZ_HANDING_CHM 0x00004000
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<D6BD> */
|
|||
|
#define D_CDZ_HANDING_CRM 0x00000001
|
|||
|
|
|||
|
/*<2A><><EFBFBD>ý<C3BD><D7B6>յ<EFBFBD><D5B5>ı<EFBFBD><C4B1><EFBFBD>*/
|
|||
|
#define D_CDZ_CONFIG_CTS 0x00000002
|
|||
|
#define D_CDZ_CONFIG_CML 0x00000004
|
|||
|
#define D_CDZ_CONFIG_CRO 0x00000008
|
|||
|
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7B6>յ<EFBFBD><D5B5>ı<EFBFBD><C4B1><EFBFBD>*/
|
|||
|
#define D_CDZ_CHARGE_CCS 0x00000010
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD>յ<EFBFBD><D5B5>ı<EFBFBD><C4B1><EFBFBD>*/
|
|||
|
#define D_CDZ_END_CST 0x00000020
|
|||
|
#define D_CDZ_END_CSD 0x00000040
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
#define D_CDZ_END_CEM 0x00000080
|
|||
|
extern void AppCtrOnoffHandle(void);
|
|||
|
void BmsParaDataInit(void);
|
|||
|
extern ChargeParam_t CDZ_ChargeInfo;
|
|||
|
extern Bms_BatRealInfo_t Bms_BatChargeRealInfo ;
|
|||
|
|
|||
|
/***************CAN2 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bms<6D><73><EFBFBD><EFBFBD>************************/
|
|||
|
|
|||
|
#define MAX_TEMP_BAT 46 //<2F><><EFBFBD><EFBFBD>
|
|||
|
#define MAX_TEMP2_BAT 48 //<2F><><EFBFBD><EFBFBD>
|
|||
|
#define MAX_TEMP3_BAT 50 //<2F><><EFBFBD><EFBFBD>
|
|||
|
#define MAX_TEMP4_BAT 52 //<2F><><EFBFBD><EFBFBD>
|
|||
|
#define MAX_TEMP5_BAT 55 //<2F><><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
#define MAX_CURENT_TEMP 400
|
|||
|
|
|||
|
#define LOW_CURENT_TEMP 400 //<2F><><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#define LOW_TEMP1_BAT 2 //<2F><><EFBFBD><EFBFBD>
|
|||
|
#define LOW_TEMP2_BAT 3 //<2F><><EFBFBD><EFBFBD>
|
|||
|
#define LOW_TEMP3_BAT 5 //<2F><><EFBFBD><EFBFBD>
|
|||
|
extern int8_t CheckQiruiBMSWarningState(void);
|
|||
|
extern uint8_t Bms_BatChargeRealObdBatCurSOC ;
|
|||
|
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> bms0 <20><>Ϣ */
|
|||
|
#pragma pack (1) /*ָ<><D6B8><EFBFBD><EFBFBD>1<EFBFBD>ֽڶ<D6BD><DAB6><EFBFBD>*/
|
|||
|
|
|||
|
|
|||
|
|
|||
|
typedef union
|
|||
|
{
|
|||
|
uint8_t stats[8];
|
|||
|
struct
|
|||
|
{
|
|||
|
uint16_t bmsChrgCurRqst:13;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint16_t bmsChrgCurRqstV:1;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
|||
|
uint16_t reserv:2;
|
|||
|
|
|||
|
//byte2 3 <20><><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5>ֽ<EFBFBD>
|
|||
|
uint16_t bmsChrgVolRqst:13;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
|
|||
|
uint16_t bmsChrgVolRqstV:1;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
|||
|
uint16_t reserve:2;
|
|||
|
uint16_t reserve4:8;
|
|||
|
uint16_t reserve5:8;
|
|||
|
uint16_t reserve6:8;
|
|||
|
uint16_t reserve7:8;
|
|||
|
}bits;
|
|||
|
}bms284_sts_t;
|
|||
|
|
|||
|
//----------------------------------------------------------
|
|||
|
typedef struct{
|
|||
|
uint16_t communicationflag;
|
|||
|
uint16_t maxchargcur; //<2F><><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD>
|
|||
|
|
|||
|
//---------bms284-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ-----------------
|
|||
|
bms284_sts_t bms284;
|
|||
|
|
|||
|
|
|||
|
//=======================================
|
|||
|
uint8_t Long_TEST; //<2F>ϻ<EFBFBD><CFBB><EFBFBD><EFBFBD>Ա<EFBFBD>־
|
|||
|
}wulingbat_info_t;
|
|||
|
|
|||
|
#pragma pack() /*ȡ<><C8A1>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD>ָ<EFBFBD>ȱʡ<C8B1><CAA1><EFBFBD><EFBFBD>*/
|
|||
|
|
|||
|
|
|||
|
extern wulingbat_info_t WuLingBatteryInfo;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#define CANILONG_TESTINFOID 0x100 //<2F>ϻ<EFBFBD><CFBB><EFBFBD><EFBFBD><EFBFBD>ģʽ<C4A3><CABD>־
|
|||
|
|
|||
|
#define CANBMS284INFOID_WULING 0x284
|
|||
|
|
|||
|
|
|||
|
//----------------ģ<><C4A3>VIN-------------
|
|||
|
#define GD_OK 1
|
|||
|
#define GD_ERR -1
|
|||
|
int VinCalc(char *Vin,char *reslt);
|
|||
|
char VinTest(void);
|
|||
|
char VinTest2(void);
|
|||
|
int VinCalc(char *Vin,char *reslt);
|
|||
|
//----------------END-----------------
|
|||
|
|
|||
|
int8_t WULING_DCDCSendBms2(void); //<2F><><EFBFBD><EFBFBD>can<61><6E><EFBFBD><EFBFBD>
|
|||
|
int8_t wulingbms_check_status(void); //bms״̬
|
|||
|
int8_t CheckWuLingBMSFaultState(void); //<2F><><EFBFBD>ذ<EFBFBD><D8B0><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int8_t CheckWuLingBMSWarningState(void);//bms<6D><73><EFBFBD>潵<EFBFBD><E6BDB5>
|
|||
|
|
|||
|
/******<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̱<EFBFBD>¶<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>****/
|
|||
|
void bms_SendBHM(uint16_t MaxVoltage);
|
|||
|
void bms_SendBRM(uint16_t step);
|
|||
|
void bms_SendBCP(uint16_t step);
|
|||
|
void bms_SendBRO(uint8_t Ready);
|
|||
|
void bms_SendBCL(void);
|
|||
|
void bms_SendBCS(uint16_t step);
|
|||
|
void bms_SendBSM(uint16_t step);
|
|||
|
void bms_SendBSD(uint16_t step);
|
|||
|
void bms_SendBST(uint16_t step);
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|