Commit 10951c04 authored by 崔立宝's avatar 崔立宝

变更后程序

parent 2484ba45
......@@ -80,7 +80,7 @@ void Api_GetSensorAD(void)
if((AD_STATUS & 0x80) == 0x80)
{
ATDSTAT0_SCF = ClearFlag;
switch(ATDCTL5_Cx)
switch (ATDCTL5_Cx)
{
case CHNAL7:
if(ADEveArry.pKey > ADEveLen -1)
......@@ -88,23 +88,25 @@ void Api_GetSensorAD(void)
ADEveArry.pKey = null;
}
w = ATDDR0;
wVcc= ATDDR0;
wVcc = ATDDR0;
ADEveArry.KeyEven[ADEveArry.pKey] = (INT16U)w;
ADEveArry.pKey ++;
App_SortNByte((INT16U *)ADEveArry.KeyEven,ADEveLen);
if(w > 420) //16.6v
if (w > 184) //6.5V 420) //16.6v
{
ATDCTL5_Cx = CHNAL4;
ADEveArry.KeyOffCn = null;
if(ADEveArry.KeyOnCn < 20)
if (ADEveArry.KeyOnCn < 20)
{
if(Api_ADDelay(Delay1ms))
{
ADEveArry.KeyOnCn ++;
}
}
if(ADEveArry.KeyOnCn >= 0)
if (ADEveArry.KeyOnCn >= 0)
{
Curkeyinput = KeyON;
}
......@@ -112,22 +114,24 @@ void Api_GetSensorAD(void)
else
{
ADEveArry.KeyOnCn = null;
if(ADEveArry.KeyOffCn < 100)
if (ADEveArry.KeyOffCn < 100)
{
if(Api_ADDelay(Delay1ms))
{
ADEveArry.KeyOffCn ++;
}
}
if(ADEveArry.KeyOffCn >= 30)
if (ADEveArry.KeyOffCn >= 30)
{
Curkeyinput = KeyOFF;
}
ATDCTL5_Cx = CHNAL7;
}
break;
case CHNAL4:
if(Curkeyinput == KeyON)
if (Curkeyinput == KeyON)
{
if(ADEveArry.pFuel > ADEveLen-1)
{
......@@ -152,7 +156,7 @@ void Api_GetSensorAD(void)
}
break;
case CHNAL5:
if(Curkeyinput == KeyON)
if (Curkeyinput == KeyON)
{
if(ADEveArry.pQY2 > ADEveLen-1)
{
......
......@@ -190,13 +190,42 @@ interrupt void Api_CAN_Rev_isr(void)
INT8U PF;
INT8U PRIO; //----hyq--20180317
m_dlc = CANRXDLR_DLC;
if (CANRXIDR1_IDE == 0u)
{
ext_id = ((INT16U)(CANRXIDR0 << 3)) | ((INT16U)(CANRXIDR1 >> 5));
if (ext_id == 0x5F2)
{
if (CanMsg5F2.ProceF == empoty)
{
if (m_dlc == 8)
{
if (CanClk.Signal.Exist5F2 == Disable)
{
CanClk.ID5F2Cn++;
}
if (CanClk.ID5F2Cn > 2)
{
CanMsg5F2.ProceF = msg_full;
CanMsg5F2.Data[7].bbyte = CANRXDSR7;
CanClk.Signal.Exist5F2 = Enable;
CanClk.ID5F2Cn = 100;
}
}
}
}
}
else
{
extend_pgn = Api_EXT_ID_TO_PGN((INT8U *)&CANRXIDR0);
ext_id = bsp_GET_EXTEND_ID((INT8U *)&CANRXIDR0);
SA = (INT8U)(ext_id & 0x000000ff);
PS = (INT8U)((ext_id & 0x0000ff00) >> 8);
PRIO = (INT8U)(ext_id >> 26);
m_dlc = CANRXDLR_DLC;
if (Curkeyinput == KeyON)
{
......@@ -952,6 +981,8 @@ interrupt void Api_CAN_Rev_isr(void)
//
default:;
}
}
bCanDropTimes = 30;
/////////////////////////
CANRFLG_RXF = ClearFlag;
......
......@@ -523,6 +523,10 @@ void API_ClockGenerate(void)
if(CanClk.IDFEEFTime < T_100ms)
{
CanClk.IDFEEFTime ++;
}
if(CanClk.ID5F2Time < T_100ms)
{
CanClk.ID5F2Time ++;
}
if(CanClk.IDDropTime < T_100ms)
{
......@@ -587,7 +591,7 @@ void API_ClockGenerate(void)
if( Clock.isFlash>T_500ms)
{
Clock.isFlash =0;
BcmModel.bits.Blinking=!BcmModel.bits.Blinking;
BcmModel.bits.Blinking = !BcmModel.bits.Blinking;
}
else
{
......
......@@ -122,6 +122,10 @@ interrupt void Api_Timer0_isr(void)
{
CanClk.CanCFE6CEETime --;
}
if (CanClk.Can49ETime > null)
{
CanClk.Can49ETime --;
}
if(CanClk.Can18FEF117Time > null)
{
CanClk.Can18FEF117Time --;
......@@ -259,7 +263,7 @@ interrupt void Api_VehCap_isr(void)
{
VehFre.Cycl = CurVehCnt.dw32 - OldVehCnt.dw32;
}
if(VehFre.Cycl > VehFreLimit)
if (VehFre.Cycl > VehFreLimit)
{
AccPulse++;
FreDiv4Pulse++;
......
......@@ -36,6 +36,7 @@ void App_CheckCanDrop(void)
CanMsg18FEFF00.ProceF = empoty; //驾驶员警告灯---潍柴报文---。
// CanMsg18FECA10.ProceF = empoty; //驾驶员警告灯---潍柴报文---。
CanMsg1CFFBE18.ProceF = empoty;
CanMsg5F2.ProceF = empoty;
}
//转速报文
if(CanClk.Signal.ExistF004 == Enable)
......@@ -487,6 +488,25 @@ void App_CheckCanDrop(void)
}
}
} */
//远程清零
if(CanClk.Signal.Exist5F2 == Enable)
{
if(CanClk.ID5F2Time >= T_100ms)
{
CanClk.ID5F2Time = null;
if (CanClk.ID5F2Cn == null)
{
CanMsg5F2.Data[7].bbyte = 0;
CanClk.Signal.Exist5F2 = Disable;
}
if (CanClk.ID5F2Cn > null)
{
CanClk.ID5F2Cn --;
}
}
}
}
/*-------------------------------------------------------------------------
函数名称:App_GetNormalData
......@@ -1083,6 +1103,26 @@ void App_GetNormalData(void)
{
CanMsg1CFFBE18.ProceF = Disable;
}
//变更加远程清零报文
if (CanMsg5F2.ProceF == msg_full)
{
if (CanMsg5F2.Data[7].bbyte == 0x11)
{
if (ClearOdoCanTimes < 10)
{
ClearOdoCanTimes++;
}
}
else
{
if (ClearOdoCanTimes < 10)
{
ClearOdoCanTimes = 0;
}
}
CanMsg5F2.ProceF = Disable;
}
}
/*-------------------------------------------------------------------------
* Function Name : GetConnectInfo
......@@ -1222,12 +1262,57 @@ INT8U bsp_CANSendExtFrame (INT32U id,INT8U priority,INT8U length,INT8U *txdata)
CanClk.BusOffTime = T_100ms;
CanClk.BusOffCn = null;
return success;
}
//return success;
///////////////////////////////////////////////////////////////
}
/*-------------------------------------------------------------------------
* Function Name : bsp_CANSendStdFrame clb--20231115
* Description :
* Input :
* Output : None
* Return : dwPGN
* onther :
--------------------------------------------------------------------------*/
INT8U bsp_CANSendStdFrame (INT32U id, INT8U priority, INT8U length, INT8U *txdata)
{
INT8U txbuffer,index;
INT16U cn = null;
if (!CANTFLG) //Is Transmit Buffer full ? Full ( TXEx=0;)
return failt;
if(id == null)
return failt;
CANTBSEL = CANTFLG; /* Select lowest empty buffer */
txbuffer = CANTBSEL; // Backup selected buffer
//====
CANTXIDR0 = (INT8U)((id & 0x07F8) >> 3);
CANTXIDR1 = (INT8U)((id & 0x0007) << 5);
if(length>8)
length=8;
for ( index=0; index < length; index++) {
*(&CANTXDSR0 + index) = txdata[index]; //Load data to Tx buffer Data Segment Registers
}
CANTXDLR = length; /* Set Data Length Code */
CANTXTBPR = priority; /* Set Priority */
CANTFLG = txbuffer; /* Start transmission */
////////////////glz--20170519 busoff ////////////////////
if ((CANTFLG & txbuffer) != txbuffer)
{
return 2; //failt; lzs--gai
}
else
{
CanClk.BusOffTime = T_100ms;
CanClk.BusOffCn = null;
return success;
}
}
/*-------------------------------------------------------------------------
函数名称:App_SendCANMsg
功 能:
......@@ -1239,7 +1324,7 @@ void App_SendCANMsg(void)
{
INT32U wTemp = null;
if(Curkeyinput == KeyON)
if (Curkeyinput == KeyON)
{
//--------------------------------
if(CanClk.Can18FFB317Time == null)
......@@ -1258,15 +1343,15 @@ void App_SendCANMsg(void)
g_txCanMsg.msg[7] = 0x00;
g_txCanMsg.dlc = 8;
bReturn = bsp_CANSendExtFrame(g_txCanMsg.id,3,g_txCanMsg.dlc,g_txCanMsg.msg);
if(bReturn != 0)
CanClk.Can18FFB317Time = 500;
if (bReturn != 0)
CanClk.Can18FFB317Time = 488;//2.048mS中断计时
}
//燃油外发液位
wTemp = FuelMeter.CurPosition;
wTemp = (wTemp*100) / FuelMeterParamer.DashStep[FuelMeterParamer.bVirtualVal - 1];
if(CanClk.Can18FEF117Time == null)
if (CanClk.Can18FEF117Time == null)
{
g_txCanMsg.id = 0x18FEFC17;
g_txCanMsg.id = 0x18FEFC17; //1000mS
g_txCanMsg.msg[0] = 0x00;
g_txCanMsg.msg[1] = (INT8U)(wTemp*5/2);
g_txCanMsg.msg[2] = 0x00;
......@@ -1277,8 +1362,8 @@ void App_SendCANMsg(void)
g_txCanMsg.msg[7] = 0x00;
g_txCanMsg.dlc = 8;
bReturn = bsp_CANSendExtFrame(g_txCanMsg.id,3,g_txCanMsg.dlc,g_txCanMsg.msg);
if(bReturn != 0)
CanClk.Can18FEF117Time = 500;//T,100ms
if (bReturn != 0)
CanClk.Can18FEF117Time = 488; //T,1000ms/2.048
}
//------------------------------
if(CanClk.Can18FF0D17Time == null)
......@@ -1327,8 +1412,8 @@ void App_SendCANMsg(void)
}
g_txCanMsg.dlc = 8;
bReturn = bsp_CANSendExtFrame(g_txCanMsg.id,3,g_txCanMsg.dlc,g_txCanMsg.msg);
if(bReturn != 0)
CanClk.Can18FF0D17Time = 50;
if (bReturn != 0)
CanClk.Can18FF0D17Time = 49; //100mS
}
//车速
if(CanClk.CanCFE6CEETime == null)
......@@ -1344,8 +1429,59 @@ void App_SendCANMsg(void)
g_txCanMsg.msg[7] = (INT8U)(CansendVeh / 256);
g_txCanMsg.dlc = 8;
bReturn = bsp_CANSendExtFrame(g_txCanMsg.id,3,g_txCanMsg.dlc,g_txCanMsg.msg);
if(bReturn != 0)
CanClk.CanCFE6CEETime = 25;
if (bReturn != 0)
CanClk.CanCFE6CEETime = 25; //50mS
}
//清零外发
if (CanClk.Can49ETime == null)
{
g_txCanMsg.id = 0x49E;
g_txCanMsg.msg[0] = 0;
g_txCanMsg.msg[1] = 0;
g_txCanMsg.msg[2] = 0;
g_txCanMsg.msg[3] = 0;
g_txCanMsg.msg[4] = 0;
g_txCanMsg.msg[5] = 0;
g_txCanMsg.msg[6] = 0;
g_txCanMsg.msg[7] = 0;
if (AccKm.LongAccKm < 20000)
{
if (OUT_2000km_Clear != one)
{
;
}
else
{
if (ClearOdoCanOut)
{
ClearOdoCanOut--;
g_txCanMsg.msg[7] |= 0x90;
}
else
{
g_txCanMsg.msg[7] |= 0x50;
}
}
}
else
{
if (OUT_2000km_Clear != one)
{
g_txCanMsg.msg[7] |= 0x40;
}
else
{
g_txCanMsg.msg[7] |= 0x50;
}
}
g_txCanMsg.dlc = 8;
bReturn = bsp_CANSendStdFrame(g_txCanMsg.id, 3, g_txCanMsg.dlc, g_txCanMsg.msg);
if (bReturn != 0)
CanClk.Can49ETime = 488; //1000mS
//AccPulse+= 250;
}
}
}
......
......@@ -354,11 +354,12 @@ void App_CalAccKm(void)
AccKm.ClrCnt = null;
App_ClearAccStock();
OUT_2000km_Clear = null;
bsp_IIC_WritePage(0xa2, 256,(INT8U*)&OUT_2000km_Clear,Register_Len);
bsp_IIC_WritePage(0xa2, 256,(INT8U *)&OUT_2000km_Clear, Register_Len);
}
}
/*OUT 2000km Clear*/
#if 0
if((G_Button.PushTime >= T_20s)&&(AccKm.LongAccKm < 20000))
{
bsp_IIC_ReadPage(0xa2, 256,(INT8U*) &OUT_2000km_Clear,Register_Len);
......@@ -375,6 +376,7 @@ void App_CalAccKm(void)
CarFlag.FlagBits.AccSaveState = Enable;
}
}
#endif
}
/*-------------------------------------------------------------------------
......
......@@ -1096,6 +1096,27 @@ void GUI_CheckKeyProc(KeyType *KeyMenu)
{
if (Curkeyinput == KeyON)
{
if (((KeyMenu->PushTime >= T_20s) || (ClearOdoCanTimes >= 10)) && (AccKm.LongAccKm < 20000) && (AccKm.LongAccKm > 0))
{
if (OUT_2000km_Clear != one)
{
ClearOdoCanOut = 30;
OUT_2000km_Clear = one;
bsp_IIC_WritePage(0xa2, 256, (INT8U *)&OUT_2000km_Clear, Register_Len);
do
{
App_ClearAccStock();
}
while (CarFlag.FlagBits.AccSaveState == Enable);
CarFlag.FlagBits.AccSaveState = Enable;
ClearOdoCanTimes = 0;
AccPulse = 0;
}
}
////////////////////////D 短按 ///////////////////////////////////////
if (KEY1_IN == HIGH)
{
......
......@@ -150,7 +150,7 @@
EXTERN_VAR volatile __RevCanMsg CanMsg18FEFF00; //驾驶员警告--潍柴报文-----
EXTERN_VAR volatile __RevCanMsg CanMsg1CFFBE18;
// EXTERN_VAR volatile __RevCanMsg CanMsg18FECA10; //驾驶员警告--玉柴报文-----
EXTERN_VAR volatile __RevCanMsg CanMsg5F2;
//
EXTERN_VAR volatile __CanClk CanClk;
EXTERN_VAR volatile _Encode m_Encoded;
......@@ -267,6 +267,8 @@
EXTERN_VAR volatile INT8U g_accTime;
EXTERN_VAR volatile INT8U g_bReturn;
EXTERN_VAR volatile INT8U OUT_2000km_Clear;
EXTERN_VAR volatile INT8U ClearOdoCanTimes;
EXTERN_VAR volatile INT8U ClearOdoCanOut;
//
EXTERN_VAR MULCANMSG MulCanMsg_ECM18EBFF00;
EXTERN_VAR INT8U Engine21_18EBFF00;
......
......@@ -245,8 +245,6 @@
INT8U Seconds;
INT8U Minutes;
INT8U Hours;
}ClockType;
typedef struct
......@@ -486,9 +484,9 @@
INT8U ExistECFF00:1;
INT8U ExistEBFF00:1;
INT8U ExistFECA3D:1;
INT8U ExistFD7C:1;
INT8U ExistE0FF00:1;
INT8U ExistFEF1:1;
INT8U ExistFEF200:1;
INT8U ExistFEEF:1;
......@@ -501,8 +499,9 @@
INT8U Exist18FEFF00:1; //--驾驶员警告--潍柴报文--
// INT8U Exist18FECA10:1; //--驾驶员警告--玉柴报文--
INT8U Exist1CFFBE18:1; //T-BOX
INT8U Exist5F2:1;
} __Signal;
}__Signal;
typedef struct
{
INT8U Can452Time;
......@@ -537,6 +536,7 @@
// INT8U IDFF0ACn; lzs--shan
// INT8U IDFF04Time; lzs--shan
// INT8U IDFF04Cn; lzs--shan
INT8U ID0CF00300Time;
INT8U ID0CF00300Cn;
INT8U IDFEF200Time;
......@@ -549,12 +549,13 @@
INT8U IDFD0700Cn;
//
INT8U Can18FF4AEFTime;
INT8U Can18FEF117Time;
INT16U Can18FEF117Time;
INT8U Can18FEAE17Time;
INT8U Can18FE6C17Time;
INT8U CanCFE6CEETime;
INT8U Can18FF0D17Time;
INT16U Can18FFB317Time;
INT16U Can49ETime;
INT8U IDF001Time;
INT8U IDF001Cn;
......@@ -570,9 +571,11 @@
INT8U ID1CFFBE18Time;
// INT8U ID18FECA10Cn; //驾驶员警告灯--玉柴报文。
// INT8U ID18FECA10Time;
INT8U ID5F2Cn;
INT8U ID5F2Time;
__Signal Signal;
}__CanClk;
} __CanClk;
typedef struct
{
INT8U SetTime;
......@@ -580,7 +583,6 @@
INT8U ClrTripTime;
INT8U ClrAdBlueTime;
}__MeuClk;
typedef union
{
......
......@@ -6,6 +6,8 @@
//20230324 修改E01/F01前面多显示8问题
//20230325 修改驾驶员相关报警逻辑(禅道问题)
//20230403 修改车厂清零,10km以内清后下电上电恢复问题
//20231115 变更:增加远程报文清零功能(接收清零报文0x5F2,发送清零状态报文0x49E)
//20231116 修改IGNON、IGNOFF门槛值,由16.6V改为6.5V
void main(void)
{
......@@ -26,7 +28,7 @@ void main(void)
_FEED_COP();
API_ClockGenerate();
Api_GetSensorAD();
if(Curkeyinput == KeyON)
if (Curkeyinput == KeyON)
{
switch(RunStep)
{
......@@ -36,6 +38,7 @@ void main(void)
OBD_LED_P=0;//lzs--jia
Ht16c23_Init(ON);
App_ReadAccKm();
bsp_IIC_ReadPage(0xa2, 256, (INT8U *)&OUT_2000km_Clear, Register_Len);
CarFlag.FlagBits.SysOffEn = Enable;
GUI_Motor_Start();
RunStep = Out_Proc;
......@@ -53,7 +56,7 @@ void main(void)
RunStep = GUI_DispProc;
break;
case GUI_DispProc:
if(wVcc > 420)
//if(wVcc > 420)
{
GUI_LedNormalDisplay();
}
......
......@@ -10,7 +10,7 @@ Target=TBDML
Layout=C_layout.hwl
LoadDialogOptions=AUTOERASEANDFLASH RUNANDSTOPAFTERLOAD="main"
CPU=HC12
MainFrame=2,3,-1,-1,-1,-1,2328,134,3180,909
MainFrame=2,3,-32000,-32000,-1,-1,2328,134,3180,909
TOOLBAR=57600 57601 32795 0 57635 57634 57637 0 57671 57669 0 32777 32776 32782 32780 32781 32778 0 32806
AEFWarningDialog=FALSE
Configuration=TBDML.hwc
......@@ -42,7 +42,7 @@ CHIPSECURE=CHIPSECURE SETUP 0xFF0F 0x3 0x2
DBG0=DBG GENERAL DISARM_ON PROTECT_OFF ANALYZE_ON STEPATRUN_ON
DBG1=DBG PREDEFINED SELECT 0
DBG2=DBG PREDEFINED DBGENGINE TRACE ENABLE RECORDAFTER PUREPC
NV_PARAMETER_FILE=D:\Program Files (x86)\Freescale\CWS12v5.1\prog\FPP\mcu02F4.fpp
NV_PARAMETER_FILE=C:\Program Files (x86)\Freescale\CWS12v5.1\prog\FPP\mcu02F4.fpp
NV_SAVE_WSP=0
NV_AUTO_ID=1
ISRDISABLEDSTEP=1
......@@ -138,10 +138,10 @@ File3=
[Recent Applications File List]
File0=E:\Edge下载\五征DG01_充电指示灯_20231005.s19
File1=H:\五征DG01\DG01_16C22_20230314.s19
File2=H:\五征DG01\序源码\bin\Project.abs
File3=E:\Git\awesome\程序源码\bin\五征2022.9.05已自测.abs.s19
File0=H:\五征DG01\变\03-程序源码\源\bin\Project.abs
File1=E:\Edge下载\五征DG01_充电指示灯_20231005.s19
File2=H:\五征DG01\DG01_16C22_20230314.s19
File3=H:\五征DG01\程序源码\bin\Project.abs
LoadFlags0=AUTOERASEANDFLASH RUNANDSTOPAFTERLOAD="main"
LoadFlags1=AUTOERASEANDFLASH RUNANDSTOPAFTERLOAD="main"
LoadFlags2=AUTOERASEANDFLASH RUNANDSTOPAFTERLOAD="main"
......@@ -156,9 +156,9 @@ TARGET_FREQUENCY=16000000
[Recent HI-WAVE FindProcedure Search]
Search0=App_CalAccKm
Search1=App_ReadAccKm
Search2=main
Search3=Api_CAN_Rev_isr
Search1=Api_CAN_Rev_isr
Search2=App_ReadAccKm
Search3=main
Search4=GUI_LedNormalDisplay
Search5=App_CheckCanDrop
Search6=GUI_ZAQD_QDDPRG
......
No preview for this file type
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -12,3 +12,5 @@ Data < ADDXPR ONLY_ADD_IF_NEW "OUT_2000km_Clear"
Data < ADDXPR ONLY_ADD_IF_NEW "FuelMeter"
Data < ADDXPR ONLY_ADD_IF_NEW "FuelMeterParamer"
Data < ADDXPR ONLY_ADD_IF_NEW "OBD_CheckTime"
Data < ADDXPR ONLY_ADD_IF_NEW "CanMsg5F2.Data[7].bbyte"
Data < ADDXPR ONLY_ADD_IF_NEW "ClearOdoCanTimes"
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