Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
haoJin750TFT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
时昊
haoJin750TFT
Commits
64f8d506
Commit
64f8d506
authored
Jul 05, 2024
by
郑萍
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:增加车速转速的can接收
parent
06a627fb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
43 deletions
+29
-43
CAN_CH0_CAN_Communication_Matrix.c
...are/Source/Application/CAN_CH0_CAN_Communication_Matrix.c
+18
-30
CAN_CH0_CAN_Communication_Matrix.h
...are/Source/Application/CAN_CH0_CAN_Communication_Matrix.h
+5
-7
Data_ESpeed.c
Firmware/Source/Application/Data_ESpeed.c
+2
-2
Data_VSpeed.c
Firmware/Source/Application/Data_VSpeed.c
+4
-4
No files found.
Firmware/Source/Application/CAN_CH0_CAN_Communication_Matrix.c
View file @
64f8d506
#include "CAN_CH0_CAN_Communication_Matrix.h"
/* 2024/06/19 19:37:20 */
/* 2024/06/20 16:36:58 */
st_CanMsgOp
CAN_CH0_CanMsgOp
;
st_CanMsgTxOp
CAN_CH0_CanMsgTxOp
;
#define CAN_CH0 &CAN_CH0_CanMsgOp
const
st_CAN_SendAttribute
CAN_CH0_CANSendAttr
[
CAN_CH0_ID_SEND_TOTAL
]
=
{
{
0
}
{
0
}
};
const
st_CANMsgAttribute
CAN_CH0_CAN_MSG_CONST_ARRAY
[
CAN_CH0_ID_TOTAL_MAX
]
=
...
...
@@ -57,7 +56,7 @@ const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] =
{
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
},
{
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
},
5000ul
,
0x
37
Bul
,
0x
12
Bul
,
((
void
*
)
0
),
((
void
*
)
0
),
((
void
*
)
0
),
...
...
@@ -67,7 +66,7 @@ const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] =
{
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
},
{
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
},
5000ul
,
0x
12B
ul
,
0x
450
ul
,
((
void
*
)
0
),
((
void
*
)
0
),
((
void
*
)
0
),
...
...
@@ -77,7 +76,7 @@ const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] =
{
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
},
{
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
},
5000ul
,
0x
450
ul
,
0x
37B
ul
,
((
void
*
)
0
),
((
void
*
)
0
),
((
void
*
)
0
),
...
...
@@ -263,27 +262,6 @@ uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCH1(void)
return
(((
uint8_t
)((
uint8_t
)
CAN_MSG_Read
(
CAN_CH0
,
CAN_CH0_ID_CH0_402_Msg_Count
,
0u
)
>>
0u
)
&
0xFFu
));
}
uint8_t
Get_CAN_CH0_ID_37B_Sig_TCS_37B_Checksum
(
void
)
{
return
(((
uint8_t
)((
uint8_t
)
CAN_MSG_Read
(
CAN_CH0
,
CAN_CH0_ID_CH0_37B_Msg_Count
,
7u
)
>>
0u
)
&
0xFFu
));
}
uint8_t
Get_CAN_CH0_ID_37B_Sig_TCS_37B_Livecounter
(
void
)
{
return
(((
uint8_t
)((
uint8_t
)
CAN_MSG_Read
(
CAN_CH0
,
CAN_CH0_ID_CH0_37B_Msg_Count
,
6u
)
>>
0u
)
&
0x0Fu
));
}
uint8_t
Get_CAN_CH0_ID_37B_Sig_TCS_Control
(
void
)
{
return
(((
uint8_t
)((
uint8_t
)
CAN_MSG_Read
(
CAN_CH0
,
CAN_CH0_ID_CH0_37B_Msg_Count
,
2u
)
>>
7u
)
&
0x01u
));
}
uint16_t
Get_CAN_CH0_ID_37B_Sig_TCS_Target_Torque
(
void
)
{
return
(((
uint16_t
)((
uint16_t
)((
uint16_t
)
CAN_MSG_Read
(
CAN_CH0
,
CAN_CH0_ID_CH0_37B_Msg_Count
,
0u
)
>>
0u
)
&
0xFFu
)
<<
8u
)
+
\
((
uint16_t
)((
uint16_t
)
CAN_MSG_Read
(
CAN_CH0
,
CAN_CH0_ID_CH0_37B_Msg_Count
,
1u
)
>>
0u
)
&
0xFFu
));
}
uint8_t
Get_CAN_CH0_ID_12B_Sig_Abs_warning_lamp
(
void
)
{
return
(((
uint8_t
)((
uint8_t
)
CAN_MSG_Read
(
CAN_CH0
,
CAN_CH0_ID_CH0_12B_Msg_Count
,
4u
)
>>
1u
)
&
0x03u
));
...
...
@@ -299,6 +277,16 @@ uint8_t Get_CAN_CH0_ID_450_Sig_ABSOFF_Selection(void)
return
(((
uint8_t
)((
uint8_t
)
CAN_MSG_Read
(
CAN_CH0
,
CAN_CH0_ID_CH0_450_Msg_Count
,
0u
)
>>
0u
)
&
0x01u
));
}
uint8_t
Get_CAN_CH0_ID_37B_Sig_TCS_Work_Mode
(
void
)
{
return
(((
uint8_t
)((
uint8_t
)
CAN_MSG_Read
(
CAN_CH0
,
CAN_CH0_ID_CH0_37B_Msg_Count
,
3u
)
>>
4u
)
&
0x0Fu
));
}
uint8_t
Get_CAN_CH0_ID_37B_Sig_TCS_Warning_Lamp
(
void
)
{
return
(((
uint8_t
)((
uint8_t
)
CAN_MSG_Read
(
CAN_CH0
,
CAN_CH0_ID_CH0_37B_Msg_Count
,
3u
)
>>
2u
)
&
0x01u
));
}
uint8_t
Co_Can_ConvertSubID_CAN_CH0
(
uint32_t
MsgID
)
{
uint8_t
u8Result
=
CAN_CH0_ID_TOTAL_MAX
;
...
...
@@ -316,15 +304,15 @@ uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID)
case
CAN_CH0_ID_CH0_402_Msg
:
u8Result
=
CAN_CH0_ID_CH0_402_Msg_Count
;
break
;
case
CAN_CH0_ID_CH0_37B_Msg
:
u8Result
=
CAN_CH0_ID_CH0_37B_Msg_Count
;
break
;
case
CAN_CH0_ID_CH0_12B_Msg
:
u8Result
=
CAN_CH0_ID_CH0_12B_Msg_Count
;
break
;
case
CAN_CH0_ID_CH0_450_Msg
:
u8Result
=
CAN_CH0_ID_CH0_450_Msg_Count
;
break
;
case
CAN_CH0_ID_CH0_37B_Msg
:
u8Result
=
CAN_CH0_ID_CH0_37B_Msg_Count
;
break
;
default
:
u8Result
=
CAN_CH0_ID_TOTAL_MAX
;
break
;
...
...
Firmware/Source/Application/CAN_CH0_CAN_Communication_Matrix.h
View file @
64f8d506
...
...
@@ -14,16 +14,16 @@ typedef enum
CAN_CH0_ID_CH0_111_Msg_Count
,
CAN_CH0_ID_CH0_401_Msg_Count
,
CAN_CH0_ID_CH0_402_Msg_Count
,
CAN_CH0_ID_CH0_37B_Msg_Count
,
CAN_CH0_ID_CH0_12B_Msg_Count
,
CAN_CH0_ID_CH0_450_Msg_Count
,
CAN_CH0_ID_CH0_37B_Msg_Count
,
CAN_CH0_ID_TOTAL_MAX
,
}
CAN_CH0_CAN_MSG_ID_t
;
typedef
enum
{
TEST
,
TEST
,
CAN_CH0_ID_SEND_TOTAL
,
}
CAN_CH0_CAN_MSG_SEND_ID_t
;
...
...
@@ -34,9 +34,9 @@ extern const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL]
#define CAN_CH0_ID_CH0_111_Msg 0x111ul
#define CAN_CH0_ID_CH0_401_Msg 0x401ul
#define CAN_CH0_ID_CH0_402_Msg 0x402ul
#define CAN_CH0_ID_CH0_37B_Msg 0x37Bul
#define CAN_CH0_ID_CH0_12B_Msg 0x12Bul
#define CAN_CH0_ID_CH0_450_Msg 0x450ul
#define CAN_CH0_ID_CH0_37B_Msg 0x37Bul
extern
uint8_t
Get_CAN_CH0_ID_101_Sig_ECU_101_Checksum
(
void
);
extern
uint8_t
Get_CAN_CH0_ID_101_Sig_ECU_101_Livecounter
(
void
);
...
...
@@ -73,13 +73,11 @@ extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTC1Amnt(void);
extern
uint8_t
Get_CAN_CH0_ID_402_Sig_ECU_DTCL1
(
void
);
extern
uint8_t
Get_CAN_CH0_ID_402_Sig_ECU_DTCM1
(
void
);
extern
uint8_t
Get_CAN_CH0_ID_402_Sig_ECU_DTCH1
(
void
);
extern
uint8_t
Get_CAN_CH0_ID_37B_Sig_TCS_37B_Checksum
(
void
);
extern
uint8_t
Get_CAN_CH0_ID_37B_Sig_TCS_37B_Livecounter
(
void
);
extern
uint8_t
Get_CAN_CH0_ID_37B_Sig_TCS_Control
(
void
);
extern
uint16_t
Get_CAN_CH0_ID_37B_Sig_TCS_Target_Torque
(
void
);
extern
uint8_t
Get_CAN_CH0_ID_12B_Sig_Abs_warning_lamp
(
void
);
extern
uint8_t
Get_CAN_CH0_ID_450_Sig_Dashboard_TCSFunSwitch
(
void
);
extern
uint8_t
Get_CAN_CH0_ID_450_Sig_ABSOFF_Selection
(
void
);
extern
uint8_t
Get_CAN_CH0_ID_37B_Sig_TCS_Work_Mode
(
void
);
extern
uint8_t
Get_CAN_CH0_ID_37B_Sig_TCS_Warning_Lamp
(
void
);
extern
uint8_t
Co_Can_ConvertSubID_CAN_CH0
(
uint32_t
MsgID
);
...
...
Firmware/Source/Application/Data_ESpeed.c
View file @
64f8d506
#include "Data_ESpeed.h"
#include "Components.h"
#include "CAN_CH0_CAN_Communication_Matrix.h"
/*** 发动机转速 ***/
uint16_t
DataESpeedActual
;
...
...
@@ -50,8 +51,7 @@ void Data_Engine_Speed_Processing_Service ( void )
//第1步:获取实际转速值及转速有效性
if
(
Common_Get_IG_Sts
()
==
COMMON_POWER_ON
)
{
//if((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST)||(Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed() > 0xFFFF))
if
(
1
)
if
((
CAN_MSG_Status
(
&
CAN_CH0_CanMsgOp
,
CAN_CH0_ID_CH0_101_Msg_Count
)
==
CAN_SIG_LOST
)
||
(
Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed
()
>
0xFFFF
))
{
DataESpeedValid
=
0
;
DataESpeedActual
=
0
;
...
...
Firmware/Source/Application/Data_VSpeed.c
View file @
64f8d506
#include "Data_VSpeed.h"
#include "Components.h"
#include "CAN_CH0_CAN_Communication_Matrix.h"
static
uint16_t
DataVSpeedActual
;
static
uint16_t
DataVSpeedDisp
;
...
...
@@ -69,17 +70,16 @@ void Data_Vehicle_Speed_Processing_Service(void)
uint16_t
Delta
;
uint32_t
VSpeed
;
uint32_t
VSpeedCal
;
//uint8_t ESC_VehicleSpeedvalid;
//
uint8_t ESC_VehicleSpeedvalid;
uint32_t
Vehicle_Speed
;
//Vehicle_Speed = Get_CAN_CH0_ID_101_Sig_ECU_Vehicle_Speed(
);
Vehicle_Speed
=
Get_CAN_CH0_ID_101_Sig_ECU_Vehicle_Speed
(
);
//ESC_VehicleSpeedvalid = Get_CAN_CH0_ID_330_Sig_ESC_Vehicle_speed_valid( );
// 第1步:获取实际车速值及车速有效性
if
(
Common_Get_IG_Sts
(
)
==
COMMON_POWER_ON
)
{
//if ((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST) || (Vehicle_Speed > 0XFF))
if
(
1
)
if
((
CAN_MSG_Status
(
&
CAN_CH0_CanMsgOp
,
CAN_CH0_ID_CH0_101_Msg_Count
)
==
CAN_SIG_LOST
)
||
(
Vehicle_Speed
>
0XFF
))
{
/* 先判断掉线 */
//if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment