Commit cd38ea54 authored by 王佳伟's avatar 王佳伟

feat:291D老化台第一版程序,完成所有基本功能

parent c4090e9e
...@@ -371,7 +371,7 @@ INT16U time_3s = 0; ...@@ -371,7 +371,7 @@ INT16U time_3s = 0;
Key.PushTime_2++; Key.PushTime_2++;
} }
if(RT_10ms >= 10){ if(RT_10ms >= 10){
if(Key.CAN_Step>9||Key.CAN_Step<1) if(Key.CAN_Step>11||Key.CAN_Step<1)
{ {
Key.CAN_Step = 1; Key.CAN_Step = 1;
} }
......
...@@ -95,24 +95,43 @@ void Set_CAN_CRC(CAN_message * CanMessage){ ...@@ -95,24 +95,43 @@ void Set_CAN_CRC(CAN_message * CanMessage){
void Format_CAN_Msg() void Format_CAN_Msg()
{ {
CanMsg_101.ID = 0x101; CanMsg_101.ID = 0x101;
CanMsg_111.ID = 0x111; CanMsg_067.ID = 0x67;
CanMsg_37B.ID = 0x37B; CanMsg_1023FFA7.ID = 0x1023FFA7;
CanMsg_1023FFA8.ID = 0x1023FFA8;
CanMsg_1020FFA7.ID = 0x1020FFA7;
CanMsg_1020FFA8.ID = 0x1020FFA8;
CanMsg_1028FFA7.ID = 0x1028FFA7;
CanMsg_1028FFA8.ID = 0x1028FFA8;
CanMsg_101.Length = 8; CanMsg_101.Length = 8;
CanMsg_111.Length = 8; CanMsg_067.Length = 8;
CanMsg_37B.Length = 8; CanMsg_1023FFA7.Length = 8;
CanMsg_1023FFA8.Length = 8;
CanMsg_1020FFA7.Length = 8;
CanMsg_1020FFA8.Length = 8;
CanMsg_1028FFA7.Length = 8;
CanMsg_1028FFA8.Length = 8;
CanMsg_101.ID_EN = 1; CanMsg_101.ID_EN = 1;
CanMsg_111.ID_EN = 1; CanMsg_067.ID_EN = 1;
CanMsg_37B.ID_EN = 1; CanMsg_1023FFA7.ID_EN = 1;
CanMsg_1023FFA8.ID_EN = 1;
CanMsg_1020FFA7.ID_EN = 1;
CanMsg_1020FFA8.ID_EN = 1;
CanMsg_1028FFA7.ID_EN = 1;
CanMsg_1028FFA8.ID_EN = 1;
} }
void Disable_CAN_Tx(void){ void Disable_CAN_Tx(void)
{
CanMsg_101.ID_EN = 0; CanMsg_101.ID_EN = 0;
CanMsg_111.ID_EN = 0; CanMsg_067.ID_EN = 0;
CanMsg_37B.ID_EN = 0; CanMsg_1023FFA7.ID_EN = 0;
CanMsg_1023FFA8.ID_EN = 0;
CanMsg_1020FFA7.ID_EN = 0;
CanMsg_1020FFA8.ID_EN = 0;
CanMsg_1028FFA7.ID_EN = 0;
CanMsg_1028FFA8.ID_EN = 0;
} }
void Set_Pin(INT16U pin) void Set_Pin(INT16U pin)
...@@ -142,55 +161,44 @@ void App_Can_Proc(void) ...@@ -142,55 +161,44 @@ void App_Can_Proc(void)
if(GetCtrlTime(CANMsgSend_10ms) >= 10){ if(GetCtrlTime(CANMsgSend_10ms) >= 10){
ClearCtrlTime(CANMsgSend_10ms); ClearCtrlTime(CANMsgSend_10ms);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_101);
Clear_CAN_Msg((CAN_message *)&CanMsg_101);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_111);
Clear_CAN_Msg((CAN_message *)&CanMsg_111);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_37B);
Clear_CAN_Msg((CAN_message *)&CanMsg_37B);
//bReturn = Api_CANSendFrame((CAN_message *)&CanMessageID18FEDCD5);
//bReturn = Api_CANSendFrame((CAN_message *)&CanMessageID18FEDED5);
//Clear_CAN_Msg((CAN_message *)&CanMessageID18FEDCD5);
//Clear_CAN_Msg((CAN_message *)&CanMessageID18FEDED5);
} }
if(GetCtrlTime(CANMsgSend_20ms) >= 20){ if(GetCtrlTime(CANMsgSend_20ms) >= 20){
ClearCtrlTime(CANMsgSend_20ms); ClearCtrlTime(CANMsgSend_20ms);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_101);
Clear_CAN_Msg((CAN_message *)&CanMsg_101);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_067);
Clear_CAN_Msg((CAN_message *)&CanMsg_067);
} }
if(GetCtrlTime(CANMsgSend_50ms) >= 50){ if(GetCtrlTime(CANMsgSend_50ms) >= 50){
ClearCtrlTime(CANMsgSend_50ms); ClearCtrlTime(CANMsgSend_50ms);
// bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_341);
// Clear_CAN_Msg((CAN_message *)&CanMsg_341);
} }
if(GetCtrlTime(CANMsgSend_100ms) >= 100){ if(GetCtrlTime(CANMsgSend_100ms) >= 100){
ClearCtrlTime(CANMsgSend_100ms); ClearCtrlTime(CANMsgSend_100ms);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_1020FFA7);
Clear_CAN_Msg((CAN_message *)&CanMsg_1020FFA7);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_1020FFA8);
Clear_CAN_Msg((CAN_message *)&CanMsg_1020FFA8);
} }
if(GetCtrlTime(CANMsgSend_200ms) >= 200){ if(GetCtrlTime(CANMsgSend_200ms) >= 200){
ClearCtrlTime(CANMsgSend_200ms); ClearCtrlTime(CANMsgSend_200ms);
} }
if(GetCtrlTime(CANMsgSend_500ms) >= 500){ if(GetCtrlTime(CANMsgSend_500ms) >= 500){
flash_1Hz_process(); flash_1Hz_process();
ClearCtrlTime(CANMsgSend_500ms); ClearCtrlTime(CANMsgSend_500ms);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_1023FFA7);
Clear_CAN_Msg((CAN_message *)&CanMsg_1023FFA7);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_1023FFA8);
Clear_CAN_Msg((CAN_message *)&CanMsg_1023FFA8);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_1028FFA7);
Clear_CAN_Msg((CAN_message *)&CanMsg_1028FFA7);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_1028FFA8);
Clear_CAN_Msg((CAN_message *)&CanMsg_1028FFA8);
} }
if(GetCtrlTime(CANMsgSend_1s) >= 1000){ if(GetCtrlTime(CANMsgSend_1s) >= 1000){
...@@ -214,26 +222,38 @@ void App_Can_Proc(void) ...@@ -214,26 +222,38 @@ void App_Can_Proc(void)
//CurValueStr[ENUM_VSpeed ].val = 0; //CurValueStr[ENUM_VSpeed ].val = 0;
CurValueStr[ENUM_RSpeed ].val = 0; CurValueStr[ENUM_VSpeed ].val = 0;
CurValueStr[ENUM_WaterTemp ].val = 0; CurValueStr[GEAR ].val = 0;
CurValueStr[TCS_Warning_Lamp ].val = 0; CurValueStr[ENUM_EleDial1 ].val = 0;
CurValueStr[TCS_Work_Mode ].val = 0; CurValueStr[ENUM_EleDial2 ].val = 0;
CurValueStr[ISG_Power ].val = 0; CurValueStr[ENUM_Current1 ].val = 0;
CurValueStr[ISG_Power_Enable ].val = 0; CurValueStr[ENUM_Current2 ].val = 0;
CurValueStr[Motor_error ].val = 0;
CurValueStr[Battery_error ].val = 0;
CurValueStr[Charge_status ].val = 0;
CurValueStr[Cruise_control ].val = 0;
CurValueStr[Ready ].val = 0;
CurValueStr[ECM_MotorOverTempFaul ].val = 0;
CurValueStr[BMS_ChargeUnderVoltageInd1].val = 0;
CurValueStr[BMS_ChargeUnderVoltageInd2].val = 0;
CurValueStr[BMS_BattryInsulationFault].val = 0;
CurValueStr[ENUM_VSpeed ].fval = Value_Plus; CurValueStr[ENUM_VSpeed ].fval = Value_Plus;
CurValueStr[ENUM_RSpeed ].fval = Value_Plus; CurValueStr[GEAR ].fval = Value_Plus;
CurValueStr[ENUM_WaterTemp ].fval = Value_Plus; CurValueStr[ENUM_EleDial1 ].fval = Value_Plus;
CurValueStr[TCS_Warning_Lamp ].fval = Value_Plus; CurValueStr[ENUM_EleDial2 ].fval = Value_Plus;
CurValueStr[TCS_Work_Mode ].fval = Value_Plus; CurValueStr[ENUM_Current1 ].fval = Value_Plus;
CurValueStr[ISG_Power ].fval = Value_Plus; CurValueStr[ENUM_Current2 ].fval = Value_Plus;
CurValueStr[ISG_Power_Enable ].fval = Value_Plus; CurValueStr[Motor_error ].fval = Value_Plus;
CurValueStr[Battery_error ].fval = Value_Plus;
CurValueStr[Charge_status ].fval = Value_Plus;
CurValueStr[Cruise_control ].fval = Value_Plus;
CurValueStr[Ready ].fval = Value_Plus;
CurValueStr[ECM_MotorOverTempFaul ].fval = Value_Plus;
CurValueStr[BMS_ChargeUnderVoltageInd1].fval = Value_Plus;
CurValueStr[BMS_ChargeUnderVoltageInd2].fval = Value_Plus;
CurValueStr[BMS_BattryInsulationFault].fval = Value_Plus;
// CurVehSpeed = 0; // CurVehSpeed = 0;
//LDW Open //LDW Open
......
This diff is collapsed.
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#define Value_Plus 1 #define Value_Plus 1
typedef struct{ typedef struct{
unsigned int val; int val;
unsigned char fval; unsigned char fval;
}s_CurValue; }s_CurValue;
...@@ -40,31 +40,45 @@ typedef struct{ ...@@ -40,31 +40,45 @@ typedef struct{
enum enum
{ {
ENUM_VSpeed = 0,//���� ENUM_VSpeed = 0,//����
ENUM_RSpeed ,//锟???锟??? GEAR,
ENUM_WaterTemp ,// 娓╁害 ENUM_EleDial1,
TCS_Warning_Lamp ,//鍓嶈疆鑳庡帇 ENUM_EleDial2,
TCS_Work_Mode ,//鍚庤疆鑳庡帇 ENUM_Current1,
ISG_Ready, ENUM_Current2,
ISG_Power, Motor_error,
ISG_Power_Enable, Battery_error,
CAN_List_Num , Charge_status,
Cruise_control,
Ready,
ECM_MotorOverTempFaul,//103
BMS_ChargeUnderVoltageInd1,//200
BMS_ChargeUnderVoltageInd2,//200
BMS_BattryInsulationFault,//205
CAN_List_Num,
}; };
EXTERN_APP_TEST volatile s_CurValue CurValueStr[CAN_List_Num]; EXTERN_APP_TEST volatile s_CurValue CurValueStr[CAN_List_Num];
static const s_CAN_List CAN_List[] = static const s_CAN_List CAN_List[] =
{ {
{&CanMsg_101, 2, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[ENUM_VSpeed ], Motorola}, {&CanMsg_101, 1, 0, 16, 0, Offset_Plus, 1, 1, &CurValueStr[ENUM_VSpeed ], Intel},
{&CanMsg_101, 1, 0, 16, 0, Offset_Plus, 100, 25, &CurValueStr[ENUM_RSpeed ], Motorola}, {&CanMsg_067, 5, 0, 3, 0, Offset_Plus, 1, 1, &CurValueStr[GEAR ], Intel},
{&CanMsg_101, 5, 0, 16, 273, Offset_Minus, 10, 1, &CurValueStr[ENUM_WaterTemp ], Motorola}, {&CanMsg_067, 1, 0, 16, 0, Offset_Plus, 1, 1, &CurValueStr[Motor_error ], Intel},
{&CanMsg_067, 3, 6, 1, 0, Offset_Plus, 1, 1, &CurValueStr[Charge_status ], Intel},
{&CanMsg_37B, 3, 2, 1, 0, Offset_Plus, 1, 1, &CurValueStr[TCS_Warning_Lamp ], Motorola}, {&CanMsg_067, 4, 2, 1, 0, Offset_Plus, 1, 1, &CurValueStr[Cruise_control ], Intel},
{&CanMsg_37B, 3, 4, 4, 0, Offset_Plus, 1, 1, &CurValueStr[TCS_Work_Mode ], Motorola}, {&CanMsg_067, 3, 4, 1, 0, Offset_Plus, 1, 1, &CurValueStr[Ready ], Intel},
{&CanMsg_067, 3, 2, 2, 0, Offset_Plus, 1, 1, &CurValueStr[ECM_MotorOverTempFaul], Intel},
{&CanMsg_111, 4, 1, 1, 0, Offset_Plus, 1, 1, &CurValueStr[ISG_Ready ], Motorola},
{&CanMsg_111, 4, 2, 1, 0, Offset_Plus, 1, 1, &CurValueStr[ISG_Power ], Motorola},
{&CanMsg_111, 4, 4, 2, 0, Offset_Plus, 1, 1, &CurValueStr[ISG_Power_Enable ], Motorola},
{&CanMsg_1023FFA7, 0, 0, 16, 0, Offset_Plus, 10, 1, &CurValueStr[ENUM_EleDial1], Intel},
{&CanMsg_1023FFA8, 0, 0, 16, 0, Offset_Plus, 10, 1, &CurValueStr[ENUM_EleDial2], Intel},
{&CanMsg_1020FFA7, 2, 0, 16, 500, Offset_Minus, 10, 1, &CurValueStr[ENUM_Current1], Intel},
{&CanMsg_1020FFA8, 2, 0, 16, 500, Offset_Minus, 10, 1, &CurValueStr[ENUM_Current2], Intel},
{&CanMsg_1028FFA7, 0, 0, 2, 0, Offset_Plus, 1, 1, &CurValueStr[Battery_error], Intel},
{&CanMsg_1028FFA7, 3, 2, 2, 0, Offset_Plus, 1, 1, &CurValueStr[BMS_BattryInsulationFault], Intel},
{&CanMsg_1028FFA7, 0, 6, 2, 0, Offset_Plus, 1, 1, &CurValueStr[BMS_ChargeUnderVoltageInd1], Intel},
{&CanMsg_1028FFA8, 0, 6, 2, 0, Offset_Plus, 1, 1, &CurValueStr[BMS_ChargeUnderVoltageInd2], Intel},
}; };
......
...@@ -108,17 +108,24 @@ ...@@ -108,17 +108,24 @@
/*zh:*/ /*zh:*/
/*CS08 test*/ /*CS08 test*/
EXTERN_VAR CAN_message CanMessageID0CFF7F03;
EXTERN_VAR CAN_message CanMsg_101; EXTERN_VAR CAN_message CanMsg_101;
EXTERN_VAR CAN_message CanMsg_111; EXTERN_VAR CAN_message CanMsg_067;
EXTERN_VAR CAN_message CanMsg_37B; EXTERN_VAR CAN_message CanMsg_1023FFA7;
EXTERN_VAR CAN_message CanMsg_1023FFA8;
EXTERN_VAR CAN_message CanMsg_1020FFA7;
EXTERN_VAR CAN_message CanMsg_1020FFA8;
EXTERN_VAR CAN_message CanMsg_1028FFA7;
EXTERN_VAR CAN_message CanMsg_1028FFA8;
extern CAN_message CanMsg_101; extern CAN_message CanMsg_101;
extern CAN_message CanMsg_111; extern CAN_message CanMsg_067;
extern CAN_message CanMsg_37B; extern CAN_message CanMsg_1023FFA7;
extern CAN_message CanMsg_1023FFA8;
extern CAN_message CanMsg_1020FFA7;
extern CAN_message CanMsg_1020FFA8;
extern CAN_message CanMsg_1028FFA7;
extern CAN_message CanMsg_1028FFA8;
/**/ /**/
/*:zh*/ /*:zh*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment