#include "VcuCanProtocolFunc.h"
/**
 * @brief : VcuCan淇℃伅瑙ｇ爜鍑芥暟
 * @param {UINT32} ID
 * @param {UINT8} *rawData
 * @return {*}
 */
void VcuDecodeFunction(UINT32 ID, UINT8 *rawData)
{
	switch (ID)
	{
	case 0x1802F3D0:
		Checksum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
		VCU_Life = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xF);
		VCU_HvOnOff = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 4) & 0x3);
		VCU_AuxOnOff = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 6) & 0x3);
		VCU_VehicleSpeed = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
		VCU_HeatOnOff = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0x3);
		VCU_MainPosRlySts = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 2) & 0x3);
		VCU_MainNegRlySts = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 4) & 0x3);
		VCU_PreChgRlySts = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 6) & 0x3);
		VCU_AuxRlySts = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0x3);
		VCU_MainMotRlySts = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 2) & 0x3);
		VCU_MainMotRlyErrSts = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 4) & 0x3);
		VCU_Assist1RlySts = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 6) & 0x3);
		VCU_Assist1RlyErrSts = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0x3);
		VCU_Assist2RlySts = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 2) & 0x3);
		VCU_Assist2RlyErrSts = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 4) & 0x3);
		VCU_Assist3RlySts = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 6) & 0x3);
		VCU_Assist3RlyErrSts = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0x3);
		VCU_Assist4RlySts = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 2) & 0x3);
		VCU_Assist4RlyErrSts = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 4) & 0x3);
		VcuRxFlag[0] = 0x01;
		break;
	case 0x18E1F3D0:
		if (*rawData >= 0x1 && *rawData <= 3)
		{
			for (UINT8 i = 0; i < 7; i++)
			{
				if ((UINT8)(i + ((*rawData) - 1) * 7) < (UINT8)sizeof(VCU_VIN))
				{
					VCU_VIN[i + ((*rawData) - 1) * 7] = *(rawData + i + 1) & 0xFF;
				}
			}
			EBC_VinMsgFlag = EBC_VinMsgFlag | (1 << (*rawData - 1));
		}
		VcuRxFlag[1] = 0x01;
		break;
	case 0x18FEDA17:
		VCU_TotalDistance = (UINT32)(((*(UINT32 *)(rawData + 0))) & 0xFFFFFFFF);
		VcuRxFlag[2] = 0x01;
		break;
	case 0x18FF15F6:
		DrvMotPosRySts = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0x1);
		VcuRxFlag[3] = 0x01;
		break;
	case 0x18FF43A8:
		VehSts = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xF);
		VcuRxFlag[4] = 0x01;
		break;
	case 0x18FF44A8:
		BrakePedal = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
		VcuRxFlag[5] = 0x01;
		break;
	case 0x18FF4617:
		VehSpd = (UINT16)(((*(UINT16 *)(rawData + 0))) & 0xFFFF);
		HandbrakeSts = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0x3);
		VcuRxFlag[6] = 0x01;
		break;
	case 0x18FF48A8:
		GearPos = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 4) & 0xF);
		VcuRxFlag[7] = 0x01;
		break;
	default:
		break;
	}
}
/**
 * @brief : Vcu涓㈠抚淇℃伅璇婃柇
 * @param {*}
 * @return {*}
 */
void VcuRxDiagnose(void)
{
	static UINT16 TimeCounter = 0;//ms
	TimeCounter = TimeCounter + 10;
	/*
	Can涓㈠抚璇婃柇
	*/
	for (UINT8 i = 0; i < sizeof(VcuInTable) / 4; i++)
	{
		if (VcuRxFlag[i] == 1) // received msg, and clear the error counter
		{
			VcuRxErrorCount[i] = 0;
			VcuRxFlag[i] = 0;
			continue;
		}
		if (VcuRxErrorCount[i] < 3)
		{
			VcuRxShortError[i] = 0;
			VcuRxLongError[i] = 0;
		}
		else if (VcuRxErrorCount[i] >= 3 && VcuRxErrorCount[i] < 13)
		{
			VcuRxShortError[i] = 1;
			VcuRxLongError[i] = 0;
		}
		else if (VcuRxErrorCount[i] >= 13)
		{
			VcuRxShortError[i] = 0;
			VcuRxLongError[i] = 1;
			VcuRxMsgSetInvalidValue(VcuInTable[i]);
			VcuRxErrorCount[i] = 0;
		}
		else if (VcuRxErrorCount[i] == 0xFF)
		{
			VcuRxErrorCount[i] = 0xFE;
		}
	}
	/*
	CAN涓㈠抚绱
	*/
	if (TimeCounter % 100 == 0) // period <=100ms
	{
		VcuRxErrorCount[0]++; // can msg 0x1802F3D0
		// if(VcuRxErrorCount[0]>=13)
		VcuRxErrorCount[3]++; // can msg 0x18FF15F6
		// if(VcuRxErrorCount[3]>=13)
		VcuRxErrorCount[6]++; // can msg 0x18FF4617
		// if(VcuRxErrorCount[6]>=13)
		VcuRxErrorCount[7]++; // can msg 0x18FF48A8
							  // if(VcuRxErrorCount[7]>=13)
	}
	if (TimeCounter % 200 == 0) // period ==200ms
	{
	}
	if (TimeCounter % 500 == 0) // period ==500ms
	{
		VcuRxErrorCount[2]++; // can msg 0x18FEDA17
		// if(VcuRxErrorCount[2]>=13)
		// printf("can msg 0x%x lost,cycle time500ms\n",COMInTable[2]);
		VcuRxErrorCount[4]++; // can msg 0x18FF43A8
		// if(VcuRxErrorCount[4]>=13)
		// printf("can msg 0x%x lost,cycle time500ms\n",COMInTable[4]);
		VcuRxErrorCount[5]++; // can msg 0x18FF44A8
							  // if(VcuRxErrorCount[5]>=13)
							  // printf("can msg 0x%x lost,cycle time500ms\n",COMInTable[5]);
	}
	if (TimeCounter % 1000 == 0) // period ==1000ms
	{
		VcuRxErrorCount[1]++; // can msg 0x18E1F3D0
							  // if(VcuRxErrorCount[1]>=13)
							  // printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[1]);
	}
	if (TimeCounter % 2000 == 0) // period ==2000ms
	{
	}
	if (TimeCounter % 3000 == 0) // period ==3000ms
	{
	}
	if (TimeCounter % 5000 == 0) // period ==5000ms
	{
	}
}
/**
 * @brief : VcuCan淇℃伅澶辨晥缃綅
 * @param {UINT32} ID
 * @return {*}
 */
void VcuRxMsgSetInvalidValue(UINT32 ID)
{
	switch (ID)
	{
	case 0x1802F3D0:
		Checksum = 0xFF;
		VCU_Life = 0xFF;
		VCU_HvOnOff = 0xFF;
		VCU_AuxOnOff = 0xFF;
		VCU_VehicleSpeed = 0xFF;
		VCU_HeatOnOff = 0xFF;
		VCU_MainPosRlySts = 0xFF;
		VCU_MainNegRlySts = 0xFF;
		VCU_PreChgRlySts = 0xFF;
		VCU_AuxRlySts = 0xFF;
		VCU_MainMotRlySts = 0xFF;
		VCU_MainMotRlyErrSts = 0xFF;
		VCU_Assist1RlySts = 0xFF;
		VCU_Assist1RlyErrSts = 0xFF;
		VCU_Assist2RlySts = 0xFF;
		VCU_Assist2RlyErrSts = 0xFF;
		VCU_Assist3RlySts = 0xFF;
		VCU_Assist3RlyErrSts = 0xFF;
		VCU_Assist4RlySts = 0xFF;
		VCU_Assist4RlyErrSts = 0xFF;
		break;
	case 0x18E1F3D0:
		break;
	case 0x18FEDA17:
		VCU_TotalDistance = 0xFFFFFFFF;
		break;
	case 0x18FF15F6:
		DrvMotPosRySts = 0xFF;
		break;
	case 0x18FF43A8:
		VehSts = 0xFF;
		break;
	case 0x18FF44A8:
		BrakePedal = 0xFF;
		break;
	case 0x18FF4617:
		VehSpd = 0xFFFF;
		HandbrakeSts = 0xFF;
		break;
	case 0x18FF48A8:
		GearPos = 0xFF;
		break;
	default:
		break;
	}
}

/*
缁勭爜鍑芥暟
*/
void VcuEncodeFunction(UINT32 ID, UINT8 *rawData)
{
	switch (ID)
	{
	case 0x1801D0F3:
		ReqVIN = BMS13_ReqVIN;
		ReqHVOff = BMS2_RqHVPoerOff;
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((ReqVIN << 0) & 0xFF);
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((ReqHVOff << 2) & 0xFF);
		break;
	case 0x1801D8F3:
		// BMS_SoftwareVersion = ;//瀹氫箟涓轰竴鑷�
		// BMS_HardwareVersion = ;
		*(UINT16 *)(rawData + 0) = *(UINT16 *)(rawData + 0) | ((BMS_SoftwareVersion << 0) & 0xFFFF);
		*(UINT16 *)(rawData + 2) = *(UINT16 *)(rawData + 2) | ((BMS_HardwareVersion << 0) & 0xFFFF);
		break;
	case 0x1880D0F3:
		ChgSysNum = 1; // 瀹氫箟涓�1涓�
		Fult2_MainPosRelayWeldErr = BMS12_Fult2_MainPosRelayWeldErr;
		Fult2_MainNegRelayWeldErr = BMS12_Fult2_MainNegRelayWeldErr;
		Fult2_DCChgPos1RelayWeldErr = BMS12_Fult2_DCChrgPos1RelayWeldErr;
		Fult2_DCChgNeg1RelayWeldErr = BMS12_Fult2_DCChrgNeg1RelayWeldErr;
		Fult2_DCChgPos2RelayWeldErr = BMS12_Fult2_DCChrgPos2RelayWeldErr;
		Fult2_DCChgNeg2RelayWeldErr = BMS12_Fult2_DCChrgNeg2RelayWeldErr;
		HeatPosRelayWeldErr = 0x00;
		HeatNegRelayWeldErr = 0x00;
		MainPosRelaySt = BMS1_MainPosRelaySt;
		MainNegRelaySt = BMS1_MainNegRelaySt;
		PreChgRelaySt = BMS1_PreChgRelaySt;
		DCChrgPos1RelaySt = BMS1_DCChrgPos1RelaySt;
		DCChrgNeg1RelaySt = BMS1_DCChrgNeg1RelaySt;
		DCChrgPos2RelaySt = BMS1_DCChrgPos2RelaySt;
		DCChrgNeg2RelaySt = BMS1_DCChrgNeg2RelaySt;
		AuxRelayWeldErr = 0x00;
		Fult2_BranchBreakErr = BMS12_Fult2_BranchBreakErr;
		Fult2_OverChrgCurrInTheDrive = BMS12_Fult2_OverChrgCurrInTheDrive;
		Fult2_MainPosRelayOpenErr = BMS12_Fult2_MainPosRelayOpenErr;
		Fult2_MainNegRelayOpenErr = BMS12_Fult2_MainNegRelayOpenErr;
		Fult2_DCChgPos1RelayOpenErr = BMS12_Fult2_DCChrgPos1RelayOpenErr;
		Fult2_DCChgPos2RelayOpenErr = BMS12_Fult2_DCChrgNeg1RelayOpenErr;
		Fult2_DCChgNeg1RelayOpenErr = BMS12_Fult2_DCChrgPos2RelayOpenErr;
		Fult2_DCChgNeg2RelayOpenErr = BMS12_Fult2_DCChrgNeg2RelayOpenErr;
		Fult2_HeatRelayWeldErr = BMS12_Fult2_HeatRelayWeldErr;
		Fult2_HeatRelayOpenErr = BMS12_Fult2_HeatRelayOpenErr;
		Fult2_TMSErr = BMS12_Fult2_TMSErr;
		Fult2_PowerSupplyErr = BMS12_Fult2_PowerSupplyErr;
		Fult2_PackSelfProtect = BMS12_Fult2_PackSelfProtect;
		Fult2_ChrgNTCTempOver = BMS12_Fult2_ChrgNTCTempOver;
		BattSysNum = BMS9_BattSysNum;
		BatSysFaultCode = BMS2_FaultCode; // TBD 鏄惁闇�瑕佸鍔燛BC鏁呴殰鐮�
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((ChgSysNum << 0) & 0xFF);
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((Fult2_MainPosRelayWeldErr << 4) & 0xFF);
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((Fult2_MainNegRelayWeldErr << 5) & 0xFF);
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((Fult2_DCChgPos1RelayWeldErr << 6) & 0xFF);
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((Fult2_DCChgNeg1RelayWeldErr << 7) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((Fult2_DCChgPos2RelayWeldErr << 0) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((Fult2_DCChgNeg2RelayWeldErr << 1) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((HeatPosRelayWeldErr << 2) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((HeatNegRelayWeldErr << 3) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((MainPosRelaySt << 4) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((MainNegRelaySt << 6) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((PreChgRelaySt << 0) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((DCChrgPos1RelaySt << 2) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((DCChrgNeg1RelaySt << 4) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((DCChrgPos2RelaySt << 6) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((DCChrgNeg2RelaySt << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((AuxRelayWeldErr << 2) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((Fult2_BranchBreakErr << 3) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((Fult2_OverChrgCurrInTheDrive << 4) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((Fult2_MainPosRelayOpenErr << 6) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((Fult2_MainNegRelayOpenErr << 7) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult2_DCChgPos1RelayOpenErr << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult2_DCChgPos2RelayOpenErr << 1) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult2_DCChgNeg1RelayOpenErr << 2) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult2_DCChgNeg2RelayOpenErr << 3) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult2_HeatRelayWeldErr << 4) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult2_HeatRelayOpenErr << 5) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult2_TMSErr << 6) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult2_PowerSupplyErr << 7) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((Fult2_PackSelfProtect << 0) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((Fult2_ChrgNTCTempOver << 1) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((BattSysNum << 0) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((BatSysFaultCode << 0) & 0xFF);
		break;
	case 0x1881D0F3:
		ST1_Life = ST1_Life + 1;
		if (ST1_Life >= 15)
		{
			ST1_Life = 0;
		}
		if (BMS1_SysSts == 2)
		{
			BMS_SysSts = 1; //楂樺帇涓婄數
		}
		else
		{
			BMS_SysSts = 2; //楂樺帇涓嬬數
		}
		AssisRelaySts = 0x00; // bms涓嶅彂锛屽浐瀹氫负0
		BlanceSts = BMS1_BalanceStatus;
		if (BMS1_DCChrgConnectSt == 1 || BMS1_DCChrgConnectSt == 2)
		{
			DCChrgConnectSt = 1;
		}
		else
		{
			DCChrgConnectSt = 0;
		}
		ChrgMode = BMS1_ChrgMode;
		ChrgStatus = BMS1_ChrgStatus;
		FaultLevel = BMS2_FaultLevel;
		Fult1_DelTemp = BMS11_Fult1_DelTemp;
		Fult1_OverTemp = BMS11_Fult1_OverTemp;
		Fult1_PackOverHVolt = BMS11_Fult1_PackOverHVolt;
		Fult1_PackLowHVolt = BMS11_Fult1_PackLowHVolt;
		Fult1_LowSOC = BMS11_Fult1_LowSOC;
		Fult1_OverUcell = BMS11_Fult1_OverUcell;
		Fult1_LowUcell = BMS11_Fult1_LowUcell;
		Fult1_LowInsRes = BMS11_Fult1_LowInsRes;
		Fult1_UcellUniformity = BMS11_Fult1_UcellUniformity;
		Fult2_CellLowTemp = BMS12_Fult2_CellLowTemp;
		Fult2_OverDischrgCurr = BMS12_Fult2_OverDischrgCurr;
		Fult2_OverChrgCurrInTheChrg = BMS12_Fult2_OverChrgCurrInTheChrg;
		Fult_BranchVolUniformity = 0; // BMS涓嶅彂锛屽畾涔夋棤鏁呴殰
		Fult_BMSHardware = 0;		  // BMS涓嶅彂锛屽畾涔変负鏃犳晠闅�
		Fult1_OverSOC = BMS11_Fult1_OverSOC;
		Fult1_SOCChangeFast = BMS11_Fult1_SOCChangeFast;
		Fult2_InnerCommunicationErr = BMS12_Fult2_InnerCommunicationErr;
		Fult1_BatSysNotMatch = BMS11_Fult1_BatSysNotMatch;
		Fult1_HVILFault = BMS11_Fult1_HVILFault;
		Fult2_FireDetectorEr = BMS12_Fult2_FireDetectorEr;
		Fult2_PackFireWarning = BMS12_Fult2_PackFireWarning;
		Fult2_FaultNum = BMS12_Fult2_FaultNum;
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((ST1_Life << 0) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((BMS_SysSts << 4) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((AssisRelaySts << 6) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((BlanceSts << 7) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((DCChrgConnectSt << 0) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((ChrgMode << 1) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((ChrgStatus << 3) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((FaultLevel << 5) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((Fult1_DelTemp << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((Fult1_OverTemp << 2) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((Fult1_PackOverHVolt << 4) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((Fult1_PackLowHVolt << 6) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult1_LowSOC << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult1_OverUcell << 2) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult1_LowUcell << 4) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((Fult1_LowInsRes << 6) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((Fult1_UcellUniformity << 0) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((Fult2_CellLowTemp << 2) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((Fult2_OverDischrgCurr << 4) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((Fult2_OverChrgCurrInTheChrg << 6) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((Fult_BranchVolUniformity << 0) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((Fult_BMSHardware << 2) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((Fult1_OverSOC << 4) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((Fult1_SOCChangeFast << 5) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((Fult2_InnerCommunicationErr << 6) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((Fult1_BatSysNotMatch << 7) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((Fult1_HVILFault << 0) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((Fult2_FireDetectorEr << 1) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((Fult2_PackFireWarning << 2) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((Fult2_FaultNum << 3) & 0xFF);
		ST1_CheckSum = 0x00;
		for (UINT8 i = 1; i < 8; i++)
		{
			ST1_CheckSum = ST1_CheckSum ^ (*(UINT8 *)(rawData + i));
		}
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((ST1_CheckSum << 0) & 0xFF);
		break;
	case 0x1882D0F3:
		SOC = BMS2_SOC;
		SOH = BMS2_SOH;
		PackCurrent = BMS2_PackCurrent;
		InstChrgCurMaxAllw = BMS5_InstChrgCurMaxAllw;
		InstDischrgCurMaxAllw = BMS5_InstDischrgCurMaxAllw;
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((SOC << 0) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((SOH << 0) & 0xFF);
		*(UINT16 *)(rawData + 2) = *(UINT16 *)(rawData + 2) | ((PackCurrent << 0) & 0xFFFF);
		*(UINT16 *)(rawData + 4) = *(UINT16 *)(rawData + 4) | ((InstChrgCurMaxAllw << 0) & 0xFFFF);
		*(UINT16 *)(rawData + 6) = *(UINT16 *)(rawData + 6) | ((InstDischrgCurMaxAllw << 0) & 0xFFFF);
		break;
	case 0x1883D0F3:
		PosIsolation = BMS4_PosIsolation;
		NegIsolation = BMS4_NegIsolation;
		PackInsideVolt = BMS2_PackInsideVolt;
		PackOutsideVolt = 0xFFFF;
		*(UINT16 *)(rawData + 0) = *(UINT16 *)(rawData + 0) | ((PosIsolation << 0) & 0xFFFF);
		*(UINT16 *)(rawData + 2) = *(UINT16 *)(rawData + 2) | ((NegIsolation << 0) & 0xFFFF);
		*(UINT16 *)(rawData + 4) = *(UINT16 *)(rawData + 4) | ((PackInsideVolt << 0) & 0xFFFF);
		*(UINT16 *)(rawData + 6) = *(UINT16 *)(rawData + 6) | ((PackOutsideVolt << 0) & 0xFFFF);
		break;
	case 0x1884D0F3:
		Max_Temp = (UINT8)(BMS8_Max_Temp + 10);
		Min_Temp = (UINT8)(BMS8_Min_Temp + 10);
		Avg_Temp = (UINT8)(BMS8_Avg_Temp + 10);
		MaxTempSysNr = BMS8_MaxTempSysNr;
		MaxTempNr = BMS8_MaxTempNr;
		MinTempSysNr = BMS8_MinTempSysNr;
		MinTempNr = BMS8_MinTempNr;
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((Max_Temp << 0) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((Min_Temp << 0) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((Avg_Temp << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((MaxTempSysNr << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((MaxTempNr << 0) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((MinTempSysNr << 0) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((MinTempNr << 0) & 0xFF);
		break;
	case 0x1885D0F3:
		Max_Ucell = BMS6_Max_Ucell;
		MaxUcellSysNr = BMS7_MaxUcellSysNr;
		MaxUcellNr = BMS7_MaxUcellNr;
		Avg_Ucell = BMS6_Avg_Ucell;
		*(UINT16 *)(rawData + 0) = *(UINT16 *)(rawData + 0) | ((Max_Ucell << 0) & 0xFFFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((MaxUcellSysNr << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((MaxUcellNr << 0) & 0xFF);
		*(UINT16 *)(rawData + 4) = *(UINT16 *)(rawData + 4) | ((Avg_Ucell << 0) & 0xFFFF);
		break;
	case 0x1886D0F3:
		Min_Ucell = BMS6_Min_Ucell;
		MinUcellSysNr = BMS7_MinUcellSysNr;
		MinUcellNr = BMS7_MinUcellNr;
		if (BMS5_ChrgCurMaxAllw < 10000)
		{
			ChrgCurMaxAllw = 10000 - BMS5_ChrgCurMaxAllw;
		}
		else
		{
			ChrgCurMaxAllw = 0;
		}
		*(UINT16 *)(rawData + 0) = *(UINT16 *)(rawData + 0) | ((Min_Ucell << 0) & 0xFFFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((MinUcellSysNr << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((MinUcellNr << 0) & 0xFF);
		*(UINT16 *)(rawData + 4) = *(UINT16 *)(rawData + 4) | ((ChrgCurMaxAllw << 0) & 0xFFFF);
		break;
	case 0x1887D0F3:
		Gun1DCNegTemp = BMS23_Gun1DCNegTemp;
		Gun1DCPosTemp = BMS23_Gun1DCPosTemp;
		Gun2DCNegTemp = BMS23_Gun2DCNegTemp;
		Gun2DCPosTemp = BMS23_Gun2DCPosTemp;
		if (BMS1_HeatPosRelaySt == 1)
		{
			HeatPosRelaySt = 0;
		}
		else if (BMS1_HeatPosRelaySt == 2)
		{
			HeatPosRelaySt = 1;
		}
		if (BMS1_HeatNegRelaySt == 1)
		{
			HeatNegRelaySt = 0;
		}
		else if (BMS1_HeatNegRelaySt == 2)
		{
			HeatNegRelaySt = 1;
		}
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((Gun1DCNegTemp << 0) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((Gun1DCPosTemp << 0) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((Gun2DCNegTemp << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((Gun2DCPosTemp << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((HeatPosRelaySt << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((HeatNegRelaySt << 2) & 0xFF);
		break;
	case 0x18C1D0F3:
	{
		UINT16 BMS_Cell_Volt_Buffer[3] = {0x00};
		UcellCSCNum = 0x01; // 瀹氫箟涓�1
		for (UINT8 i = 0; i < 3; i++)
		{
			if (((UcellFrameNum - 1) * 3 + i) < sizeof(BMS_Cell_Volt) / 2)
			{
				BMS_Cell_Volt_Buffer[i] = BMS_Cell_Volt[(UcellFrameNum - 1) * 3 + i];
			}
			else
			{
				UcellFrameNum = 1;
				break;
			}
		}
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((UcellFrameNum << 0) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((UcellCSCNum << 0) & 0xFF);
		*(UINT16 *)(rawData + 2) = *(UINT16 *)(rawData + 2) | ((BMS_Cell_Volt_Buffer[0] << 0) & 0xFFFF);
		*(UINT16 *)(rawData + 4) = *(UINT16 *)(rawData + 4) | ((BMS_Cell_Volt_Buffer[1] << 0) & 0xFFFF);
		*(UINT16 *)(rawData + 6) = *(UINT16 *)(rawData + 6) | ((BMS_Cell_Volt_Buffer[2] << 0) & 0xFFFF);
		UcellFrameNum = UcellFrameNum + 1;
		break;
	}
	case 0x18C2D0F3:
	{
		UINT8 BMS_Cell_TempN_Buffer[6] = {0x00};
		TempCSCNum = 0x01; // 瀹氫箟涓�1
		for (UINT8 i = 0; i < 6; i++)
		{
			if (((TempFrameNum - 1) * 6 + i) < sizeof(BMS_Cell_TempN))
			{
				BMS_Cell_TempN_Buffer[i] = BMS_Cell_TempN[(TempFrameNum - 1) * 6 + i] + 10;
			}
			else
			{
				TempFrameNum = 1;
				break;
			}
		}
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((TempFrameNum << 0) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((TempCSCNum << 0) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((BMS_Cell_TempN_Buffer[0] << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((BMS_Cell_TempN_Buffer[1] << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((BMS_Cell_TempN_Buffer[2] << 0) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((BMS_Cell_TempN_Buffer[3] << 0) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((BMS_Cell_TempN_Buffer[4] << 0) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((BMS_Cell_TempN_Buffer[5] << 0) & 0xFF);
		TempFrameNum = TempFrameNum + 1;
		break;
	}
	case 0x18E1D0F3:
	{
		UINT8 Sys_chk = 0;
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((0x01 << 0) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((BMS_SN_SysCode[0] << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((BMS_SN_SysCode[1] << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((BMS_SN_SysCode[2] << 0) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((BMS_SN_SysCode[3] << 0) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((BMS_SN_SysCode[4] << 0) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((BMS_SN_SysCode[5] << 0) & 0xFF);
		for (UINT8 i = 0; i < 7; i++)
		{
			Sys_chk = Sys_chk ^ (*(UINT8 *)(rawData + 1 + i));
		}
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((Sys_chk << 0) & 0xFF);
		break;
	}
	case 0x18E2D0F3:
	{
		UINT8 Sys_chk = 0;
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((BMS_SN_SysCode[6] << 0) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((BMS_SN_SysCode[7] << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((BMS_SN_SysCode[8] << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((BMS_SN_SysCode[9] << 0) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((BMS_SN_SysCode[10] << 0) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((BMS_SN_SysCode[11] << 0) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((BMS_SN_SysCode[12] << 0) & 0xFF);
		for (UINT8 i = 0; i < 7; i++)
		{
			Sys_chk = Sys_chk ^ (*(UINT8 *)(rawData + 1 + i));
		}
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((Sys_chk << 0) & 0xFF);
		break;
	}
	case 0x18E3D0F3:
	{
		UINT8 Sys_chk = 0;
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((BMS_SN_SysCode[13] << 0) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((BMS_SN_SysCode[14] << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((BMS_SN_SysCode[15] << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((BMS_SN_SysCode[16] << 0) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((BMS_SN_SysCode[17] << 0) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((BMS_SN_SysCode[18] << 0) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((BMS_SN_SysCode[19] << 0) & 0xFF);
		for (UINT8 i = 0; i < 7; i++)
		{
			Sys_chk = Sys_chk ^ (*(UINT8 *)(rawData + 1 + i));
		}
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((Sys_chk << 0) & 0xFF);
		break;
	}
	case 0x18E4D0F3:
	{
		UINT8 Sys_chk = 0;
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((BMS_SN_SysCode[20] << 0) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((BMS_SN_SysCode[21] << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((BMS_SN_SysCode[22] << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((BMS_SN_SysCode[23] << 0) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((0xFF << 0) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((0XFF << 0) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((0xFF << 0) & 0xFF);
		for (UINT8 i = 0; i < 7; i++)
		{
			Sys_chk = Sys_chk ^ (*(UINT8 *)(rawData + 1 + i));
		}
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((Sys_chk << 0) & 0xFF);
		break;
	}
	case 0x18E5D0F3:
		Pack_RateCap = BMS21_RateCap / 10;
		Pack_RateHVolt = BMS21_RateHVolt;
		Pack_RatePower = BMS21_RatePower;
		BattType = BMS21_BattType;
		CoolType = BMS21_CoolType;
		*(UINT16 *)(rawData + 0) = *(UINT16 *)(rawData + 0) | ((Pack_RateCap << 0) & 0xFFFF);
		*(UINT16 *)(rawData + 2) = *(UINT16 *)(rawData + 2) | ((Pack_RateHVolt << 0) & 0xFFFF);
		*(UINT16 *)(rawData + 4) = *(UINT16 *)(rawData + 4) | ((Pack_RatePower << 0) & 0xFFFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((BattType << 0) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((CoolType << 4) & 0xFF);
		break;
	case 0x18E6D0F3:
		TotCSCNum = BMS9_TotCSCNum;
		PackTotCellNum = BMS9_PackTotCellNum;
		PackTotTempNum = BMS9_PackTotTempNum;
		CellVoltPlat = 0xFF;   // BMS涓嶅彂锛屽畾涔変负鏃犳晥
		MinAvlCellVolt = 0xFF; // BMS涓嶅彂锛屽畾涔変负鏃犳晥
		MaxAvlCellVolt = 0xFF; // BMS涓嶅彂锛屽畾涔変负鏃犳晥
		*(UINT8 *)(rawData + 0) = TotCSCNum;
		*(UINT8 *)(rawData + 1) = PackTotCellNum;
		*(UINT8 *)(rawData + 2) = PackTotCellNum>>8;
		*(UINT8 *)(rawData + 3) = PackTotTempNum;
		*(UINT8 *)(rawData + 4) = PackTotTempNum>>8;
		*(UINT8 *)(rawData + 5) = CellVoltPlat;
		*(UINT8 *)(rawData + 6) = MinAvlCellVolt;
		*(UINT8 *)(rawData + 7) = MaxAvlCellVolt;
		break;
	case 0x18F1D0F3:
		TotalChargeKwh = BMS15_TotalChargeKwh;
		TotalDischargeKwh = BMS15_TotalDischargeKwh;
		SingleChargeKwh = BMS19_SingleChargeKwh;
		*(UINT8 *)(rawData + 0) = TotalChargeKwh;
		*(UINT8 *)(rawData + 1) = TotalChargeKwh>>8;
		*(UINT8 *)(rawData + 2) = TotalChargeKwh>>16;
		*(UINT8 *)(rawData + 3) = TotalDischargeKwh;
		*(UINT8 *)(rawData + 4) = TotalDischargeKwh>>8;
		*(UINT8 *)(rawData + 5) = TotalDischargeKwh>>16;
		*(UINT8 *)(rawData + 6) = SingleChargeKwh;
		*(UINT8 *)(rawData + 7) = SingleChargeKwh>>8;
		break;
	case 0x18F2D0F3:
		TotalEneryECOChargeKwh = BMS16_TotalEneryECOChargeKwh;
		TotalStationChargeKwh = BMS17_TotalStationChargeKwh;
		*(UINT8 *)(rawData + 0) = TotalEneryECOChargeKwh;
		*(UINT8 *)(rawData + 1) = TotalEneryECOChargeKwh>>8;
		*(UINT8 *)(rawData + 2) = TotalEneryECOChargeKwh>>16;
		*(UINT8 *)(rawData + 3) = TotalStationChargeKwh;
		*(UINT8 *)(rawData + 4) = TotalStationChargeKwh>>8;
		*(UINT8 *)(rawData + 5) = TotalStationChargeKwh>>16;
		*(UINT8 *)(rawData + 6) = 0xFF;
		*(UINT8 *)(rawData + 7) = 0xFF;
		break;
	case 0x18F3D0F3:
		TotalPoleChargeKwh = BMS18_TotalPoleChargeKwh;
		*(UINT8 *)(rawData + 0) = BMS18_TotalPoleChargeKwh;
		*(UINT8 *)(rawData + 1) = BMS18_TotalPoleChargeKwh>>8;
		*(UINT8 *)(rawData + 2) = BMS18_TotalPoleChargeKwh>>16;
		*(UINT8 *)(rawData + 3) = 0xFF;
		*(UINT8 *)(rawData + 4) = 0xFF;
		*(UINT8 *)(rawData + 5) = 0xFF;
		*(UINT8 *)(rawData + 6) = 0xFF;
		*(UINT8 *)(rawData + 7) = 0xFF;
		break;
	case 0x18FEF8A7:
		EBC_DchgPos1Temp = ebcd_T_plugin[0];
		EBC_DchgNeg1Temp = ebcd_T_plugin[1];
		EBC_DchgPos2Temp = ebcd_T_plugin[2];
		EBC_DchgNeg2Temp = ebcd_T_plugin[3];
		EBC_ChgPos1Temp = 0xFF; //淇濈暀鍊硷紝瀹氫箟涓烘棤鏁�
		EBC_ChgNeg1Temp = 0xFF; //淇濈暀鍊硷紝瀹氫箟涓烘棤鏁�
		EBC_ChgPos2Temp = 0xFF; //淇濈暀鍊硷紝瀹氫箟涓烘棤鏁�
		EBC_ChgNeg2Temp = 0xFF; //淇濈暀鍊硷紝瀹氫箟涓烘棤鏁�
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((EBC_DchgPos1Temp << 0) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((EBC_DchgNeg1Temp << 0) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((EBC_DchgPos2Temp << 0) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((EBC_DchgNeg2Temp << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((EBC_ChgPos1Temp << 0) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((EBC_ChgNeg1Temp << 0) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((EBC_ChgPos2Temp << 0) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((EBC_ChgNeg2Temp << 0) & 0xFF);
		break;
	case 0x18FF45F4:
		ReqMode = BMS28_ReqMode;
		HVCmd = BMS28_HVCmd;
		ChgSts = BMS1_ChrgStatus;
		HVRelaySts = BMS28_HVRelaySts;
		HVVolt = BMS28_HVVolt;
		SetTemp = BMS28_SetTemp;
		Bms_Life = BMS28_Life;
		CRC = BMS28_CRC;
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((ReqMode << 0) & 0xFF);
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((HVCmd << 2) & 0xFF);
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((ChgSts << 4) & 0xFF);
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((HVRelaySts << 6) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((HVVolt >> 8) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((HVVolt << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((SetTemp << 0) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((Bms_Life << 0) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((CRC << 0) & 0xFF);
		break;
	case 0x18FFC13A:
		// TMS_WorkStatus = ;
		// TMS_HVRelayST = ;
		// TMS_OutletTemp = ;
		// TMS_InletTemp = ;
		// TMS_ReqPow = ;
		// TMS_ErrCode = ;
		// TMS_FaultLevel = ;
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((TMS_WorkStatus << 0) & 0xFF);
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((TMS_HVRelayST << 2) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((TMS_OutletTemp << 0) & 0xFF);
		*(UINT8 *)(rawData + 2) = *(UINT8 *)(rawData + 2) | ((TMS_InletTemp << 0) & 0xFF);
		*(UINT8 *)(rawData + 5) = *(UINT8 *)(rawData + 5) | ((TMS_ReqPow >> 8) & 0xFF);
		*(UINT8 *)(rawData + 6) = *(UINT8 *)(rawData + 6) | ((TMS_ReqPow << 0) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((TMS_ErrCode << 0) & 0xFF);
		*(UINT8 *)(rawData + 7) = *(UINT8 *)(rawData + 7) | ((TMS_FaultLevel << 6) & 0xFF);
		break;
	case 0x18FFF8A7:
	{
		static UINT8 Life = 0;
		Life = Life + 1;
		EBC_LockupSts = ebdc_st_lockUpState;
		EBC_ConnectorSts = ebdc_st_ConnecState;
		EBC_DischgConnectorSts = 2; // 淇濈暀淇″彿锛屽畾涔変负鏃犳晥
		EBC_ChgConnectorSts = 2;	// 淇濈暀淇″彿锛屽畾涔変负鏃犳晥
		EBC_FaultLevel = ebcd_Nr_errMax;
		EBC_FaultCode = ebcd_Num_faultCode;
		*(UINT8 *)(rawData + 0) = *(UINT8 *)(rawData + 0) | ((Life << 0) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((EBC_LockupSts << 0) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((EBC_ConnectorSts << 2) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((EBC_DischgConnectorSts << 4) & 0xFF);
		*(UINT8 *)(rawData + 1) = *(UINT8 *)(rawData + 1) | ((EBC_ChgConnectorSts << 6) & 0xFF);
		*(UINT8 *)(rawData + 3) = *(UINT8 *)(rawData + 3) | ((EBC_FaultLevel << 0) & 0xFF);
		*(UINT8 *)(rawData + 4) = *(UINT8 *)(rawData + 4) | ((EBC_FaultCode << 0) & 0xFF);
		break;
	}
	default:
		break;
	}
}
