Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiancetai
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
陈家乐
jiancetai
Commits
d0ae6c86
Commit
d0ae6c86
authored
Apr 17, 2025
by
baizhengyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:debug
parent
bc7e0a4c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
406 additions
and
49 deletions
+406
-49
Barcode_Scanner.c
YueJin_test_bench/source/Appliciation/Barcode_Scanner.c
+2
-0
Barcode_Scanner.h
YueJin_test_bench/source/Appliciation/Barcode_Scanner.h
+2
-1
CAN_Communication_Matrix.c
...test_bench/source/Appliciation/CAN_Communication_Matrix.c
+14
-0
CAN_Communication_Matrix.h
...test_bench/source/Appliciation/CAN_Communication_Matrix.h
+3
-0
Task.c
YueJin_test_bench/source/Appliciation/Task.c
+381
-46
Task.h
YueJin_test_bench/source/Appliciation/Task.h
+4
-2
No files found.
YueJin_test_bench/source/Appliciation/Barcode_Scanner.c
View file @
d0ae6c86
...
...
@@ -19,6 +19,7 @@ static uint8_t mDataBufPtr[1024] = {0};
static
uint32_t
mDataBufLen
=
0
;
static
uint8_t
mDataBufPtr1
[
1024
]
=
{
0
};
static
uint32_t
mDataBufLen1
=
0
;
uint8_t
can_judge
[
100
]
=
{
0
};
uint8_t
BarCode
[
256
]
=
{
0
};
uint8_t
BarCode1
[
256
]
=
{
0
};
uint32_t
readNum
=
0
;
...
...
@@ -40,6 +41,7 @@ uint8_t clearOdoFlag = 0;
uint8_t
connectbleFlag
=
0
;
uint8_t
Auto_ONOFF
=
0
;
uint32_t
key_value
;
uint32_t
key_value_all
;
uint8_t
key_array
[
4
];
uint8_t
seed_value
[
4
];
uint8_t
zhenduansendStep
=
0
;
...
...
YueJin_test_bench/source/Appliciation/Barcode_Scanner.h
View file @
d0ae6c86
...
...
@@ -12,6 +12,7 @@ void Recv_Byte1(void);
void
Recv_Byte2
(
void
);
extern
uint8_t
GetDataCompare
(
void
);
extern
uint32_t
readNum
;
extern
uint8_t
can_judge
[
100
];
extern
uint8_t
BarCode
[
256
];
extern
uint32_t
readNum1
;
extern
uint8_t
BarCode1
[
256
];
...
...
@@ -21,7 +22,7 @@ extern uint8_t lastdata[4];
extern
uint8_t
checkresult
;
extern
uint8_t
firstflag
;
extern
uint8_t
zhenduanflag
;
extern
uint32_t
key_value
;
extern
uint32_t
key_value
_all
;
extern
uint8_t
key_array
[
4
];
extern
uint8_t
seed_value
[
4
];
extern
uint8_t
zhenduansendStep
;
...
...
YueJin_test_bench/source/Appliciation/CAN_Communication_Matrix.c
View file @
d0ae6c86
...
...
@@ -134,6 +134,17 @@ const st_CANMsgAttribute CAN_MSG_CONST_ARRAY [ CAN_CH0_ID_TOTAL_MAX ] =
((
void
*
)
0
),
},
{
{
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
},
{
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
},
{
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
,
0x00u
},
5000ul
,
0x794ul
,
//诊断接受ID
((
void
*
)
0
),
((
void
*
)
0
),
((
void
*
)
0
),
},
};
...
...
@@ -312,6 +323,9 @@ uint8_t Co_Can_ConvertSubID(uint32_t MsgID)
case
CAN_CH0_ID_gm_esp_ee_Msg
:
u8Result
=
CAN_CH0_ID_gm_esp_ee_Msg_Count
;
break
;
case
CAN_CH0_ID_UDS_REC_Msg
:
u8Result
=
CAN_CH0_ID_UDS_REC_Msg_Count
;
break
;
default
:
u8Result
=
CAN_CH0_ID_TOTAL_MAX
;
break
;
...
...
YueJin_test_bench/source/Appliciation/CAN_Communication_Matrix.h
View file @
d0ae6c86
...
...
@@ -20,6 +20,8 @@ typedef enum
CAN_CH0_ID_esp32_soft_Msg_Count
,
CAN_CH0_ID_gm_esp_ee_Msg_Count
,
CAN_CH0_ID_UDS_REC_Msg_Count
,
CAN_CH0_ID_TOTAL_MAX
,
}
CAN_MSG_ID_t
;
...
...
@@ -47,6 +49,7 @@ extern const st_CAN_SendAttribute st_CANSendAttr[ID_SEND_TOTAL] ;
#define CAN_CH0_ID_esp32_soft_Msg 0x0C70FFD4ul
#define CAN_CH0_ID_gm_esp_ee_Msg 0x0C87FFD4ul
#define CAN_CH0_ID_UDS_REC_Msg 0x794ul
extern
uint32_t
Get_ID_ODO
(
void
);
...
...
YueJin_test_bench/source/Appliciation/Task.c
View file @
d0ae6c86
...
...
@@ -41,6 +41,7 @@ uint8_t compareresult;
extern
uint8_t
keyopenble
;
const
unsigned
char
gImage_cuo1
[]
=
{
24
,
24
,
0X00
,
0X00
,
0X00
,
0X00
,
0X30
,
0X70
,
0XE0
,
0XC0
,
0X80
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X80
,
0XC0
,
0X70
,
0X30
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X01
,
0X83
,
0XC7
,
0X66
,
0X38
,
0X38
,
0X7C
,
0XE6
,
0XC3
,
0X81
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X0C
,
0X0C
,
0X06
,
0X03
,
0X01
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X01
,
0X03
,
0X07
,
0X0E
,
0X0C
,
0X00
,
0X00
,
0X00
,
0X00
,};
const
unsigned
char
gImage_dui1
[]
=
{
24
,
24
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X80
,
0XC0
,
0XE0
,
0X40
,
0X00
,
0X00
,
0X00
,
0X00
,
0X08
,
0X18
,
0X30
,
0X70
,
0XC0
,
0X80
,
0X00
,
0X00
,
0X80
,
0XC0
,
0XE0
,
0X70
,
0X38
,
0X1C
,
0X0E
,
0X07
,
0X03
,
0X01
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X01
,
0X03
,
0X07
,
0X03
,
0X01
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,
0X00
,};
void
Sys_Run_Mode_Pseudo_Real_Time_Tasks
(
void
)
{
SD_FMQ
=
1
;
...
...
@@ -103,8 +104,8 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
// RS485_TX_finish = 0;
if
(
RS485_TX_finish
==
0
)
{
LINE_OUT_NEG_09
=
1
;
if
(
LINE_OUT_NEG_09
==
1
)
//等于0 不发送485
LINE_OUT_NEG_09
=
0
;
if
(
LINE_OUT_NEG_09
==
1
)
//
/////////////////////////
等于0 不发送485
{
if
(
connectbleFlag
==
0
)
{
...
...
@@ -230,6 +231,7 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
{
if
(
zhenduanflag
==
0
)
{
;
// R485_Send_Line_0x47(MENU_CHECK_STEP);
// RS485_User_Tx_Data();
// comparestart = 0;
...
...
@@ -238,11 +240,12 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
{
// R485_Send_0x47();
// comparestart = 0;
Can_Send_0x79
4
();
Can_Send_0x71
4
();
}
else
if
(
zhenduanflag
==
2
)
{
R485_Sendcheck_0x47
();
//R485_Sendcheck_0x47();
Can_Send_0x714_CHECK
();
}
else
{
...
...
@@ -397,7 +400,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
}
Display_PageNum
();
//
can_submit();
can_submit
();
// Freln_Duty_HZ_Service();
if
(
RS485_send_time
<
0xFFFFFFFF
)
...
...
@@ -821,7 +824,7 @@ void can_submit(void)
// data9[1] = 0x22;
// data9[2] = 0xF1;
// data9[3] = 0x87;
// init_CAN_Frame(&m_msg9, 0x7
9
4, 8, 0, data9); // 总电池电量
// init_CAN_Frame(&m_msg9, 0x7
1
4, 8, 0, data9); // 总电池电量
data5
[
4
]
=
1500
&
0xFF
;
data5
[
5
]
=
(
1500
>>
8
)
&
0xFF
;
...
...
@@ -1546,30 +1549,63 @@ void can_submit(void)
//诊断
CAN_Frame_st_t
m_msg20
;
uint8_t
data20
[
8
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
//0x7
9
4
uint8_t
data20
[
8
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
//0x7
1
4
uint32_t
Can_Send_0x79
4
(
void
)
void
Can_Send_0x71
4
(
void
)
{
uint32_t
u32sendendflag
=
0
;
switch
(
zhenduansendStep
)
{
case
0
:
if
(
barcode_Msg
[
0
]
!=
51
&&
barcode_Msg
[
1
]
!=
55
)
{
zhenduansendStep
=
0
;
break
;
}
data20
[
0
]
=
0x02
;
data20
[
1
]
=
0x10
;
data20
[
2
]
=
0x03
;
init_CAN_Frame
(
&
m_msg20
,
0x794
,
8
,
0
,
data20
);
//诊断
data20
[
3
]
=
0xAA
;
data20
[
4
]
=
0xAA
;
data20
[
5
]
=
0xAA
;
data20
[
6
]
=
0xAA
;
data20
[
7
]
=
0xAA
;
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
//诊断
can_mid
(
m_msg20
);
zhenduansendStep
++
;
break
;
case
1
:
data20
[
0
]
=
0x2
;
data20
[
0
]
=
0x
0
2
;
data20
[
1
]
=
0x27
;
data20
[
2
]
=
0x01
;
init_CAN_Frame
(
&
m_msg20
,
0x794
,
8
,
0
,
data20
);
//诊断
data20
[
3
]
=
0xAA
;
data20
[
4
]
=
0xAA
;
data20
[
5
]
=
0xAA
;
data20
[
6
]
=
0xAA
;
data20
[
7
]
=
0xAA
;
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
//诊断
can_mid
(
m_msg20
);
zhenduansendStep
++
;
break
;
case
2
:
seed_value
[
0
]
=
CAN_MSG_Read
(
11
,
3
);
seed_value
[
1
]
=
CAN_MSG_Read
(
11
,
4
);
seed_value
[
2
]
=
CAN_MSG_Read
(
11
,
5
);
seed_value
[
3
]
=
CAN_MSG_Read
(
11
,
6
);
if
(
CAN_MSG_Read
(
11
,
1
)
==
0x67
&&
CAN_MSG_Read
(
11
,
2
)
==
0x01
)
{
get_key_value
();
zhenduansendStep
++
;
}
else
{
return
;
}
//Gen_TimeDelay(10000, 50);
case
3
:
//Gen_TimeDelay(10000, 50);
data20
[
0
]
=
0x06
;
data20
[
1
]
=
0x27
;
data20
[
2
]
=
0x02
;
...
...
@@ -1577,42 +1613,190 @@ uint32_t Can_Send_0x794(void)
data20
[
4
]
=
key_array
[
1
];
data20
[
5
]
=
key_array
[
2
];
data20
[
6
]
=
key_array
[
3
];
init_CAN_Frame
(
&
m_msg20
,
0x794
,
8
,
0
,
data20
);
//诊断
data20
[
7
]
=
0xAA
;
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
//诊断
can_mid
(
m_msg20
);
zhenduansendStep
++
;
//Gen_TimeDelay(10000, 50);
break
;
case
3
:
case
4
:
if
(
CAN_MSG_Read
(
11
,
1
)
==
0x67
&&
CAN_MSG_Read
(
11
,
2
)
==
0x02
)
{
zhenduansendStep
++
;
}
else
{
return
;
}
// data20[0] = 0x2E;
// data20[1] = 0xF1;
// data20[2] = 0x8A;//1 供应商名称
// memcpy(data20+3,barcode_Msg,5);
// init_CAN_Frame(&m_msg20, 0x794, 8, 0, data20); //诊断
// can_mid(m_msg20);
case
5
:
data20
[
0
]
=
0x10
;
data20
[
1
]
=
0x12
;
data20
[
2
]
=
0x2E
;
data20
[
3
]
=
0xF1
;
data20
[
4
]
=
0x87
;
data20
[
5
]
=
barcode_Msg
[
0
];
data20
[
6
]
=
barcode_Msg
[
1
];
data20
[
7
]
=
barcode_Msg
[
2
];
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
can_mid
(
m_msg20
);
Gen_TimeDelay
(
10000
,
50
);
zhenduansendStep
++
;
//Gen_TimeDelay(10000, 50);
struct
{
uint8_t
msgType
;
uint8_t
offset
;
uint8_t
length
;
}
messages
[]
=
{
{
0x8A
,
0
,
5
},
// 供应商名称
{
0x87
,
6
,
15
},
// 物料
{
0x8A
,
21
,
5
},
// 供应商编码
{
0x99
,
26
,
8
},
// 软件编程日期
{
0x8C
,
34
,
6
}
// 序列号
};
int
numMessages
=
sizeof
(
messages
)
/
sizeof
(
messages
[
0
]);
for
(
int
i
=
0
;
i
<
numMessages
;
i
++
)
{
sendCANMessage
(
data20
,
barcode_Msg
,
messages
[
i
].
msgType
,
messages
[
i
].
offset
,
messages
[
i
].
length
);
case
6
:
data20
[
0
]
=
0x21
;
data20
[
1
]
=
barcode_Msg
[
3
];
data20
[
2
]
=
barcode_Msg
[
4
];
data20
[
3
]
=
barcode_Msg
[
5
];
data20
[
4
]
=
barcode_Msg
[
6
];
data20
[
5
]
=
barcode_Msg
[
7
];
data20
[
6
]
=
barcode_Msg
[
8
];
data20
[
7
]
=
barcode_Msg
[
9
];
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
can_mid
(
m_msg20
);
zhenduansendStep
++
;
case
7
:
data20
[
0
]
=
0x22
;
data20
[
1
]
=
barcode_Msg
[
10
];
data20
[
2
]
=
barcode_Msg
[
11
];
data20
[
3
]
=
barcode_Msg
[
12
];
data20
[
4
]
=
barcode_Msg
[
13
];
data20
[
5
]
=
barcode_Msg
[
14
];
data20
[
6
]
=
0xAA
;
data20
[
7
]
=
0xAA
;
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
can_mid
(
m_msg20
);
zhenduansendStep
++
;
Gen_TimeDelay
(
10000
,
50
);
case
8
:
if
(
CAN_MSG_Read
(
11
,
0
)
==
0x03
&&
CAN_MSG_Read
(
11
,
1
)
==
0x6E
)
{
zhenduansendStep
++
;
}
else
{
return
;
}
case
9
:
data20
[
0
]
=
0x10
;
data20
[
1
]
=
0x08
;
data20
[
2
]
=
0x2E
;
data20
[
3
]
=
0xF1
;
data20
[
4
]
=
0x8A
;
data20
[
5
]
=
barcode_Msg
[
15
];
data20
[
6
]
=
barcode_Msg
[
16
];
data20
[
7
]
=
barcode_Msg
[
17
];
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
can_mid
(
m_msg20
);
Gen_TimeDelay
(
10000
,
50
);
zhenduansendStep
++
;
case
10
:
data20
[
0
]
=
0x21
;
data20
[
1
]
=
barcode_Msg
[
18
];
data20
[
2
]
=
barcode_Msg
[
19
];
data20
[
3
]
=
0xAA
;
data20
[
4
]
=
0xAA
;
data20
[
5
]
=
0xAA
;
data20
[
6
]
=
0xAA
;
data20
[
7
]
=
0xAA
;
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
can_mid
(
m_msg20
);
Gen_TimeDelay
(
10000
,
50
);
zhenduansendStep
++
;
case
11
:
if
(
CAN_MSG_Read
(
11
,
0
)
==
0x03
&&
CAN_MSG_Read
(
11
,
1
)
==
0x6E
&&
CAN_MSG_Read
(
11
,
3
)
==
0x8A
)
{
zhenduansendStep
++
;
}
else
{
return
;
}
case
12
:
// Gen_TimeDelay(20000, 50);
Gen_TimeDelay
(
10000
,
50
);
zhenduansendStep
++
;
// if(CAN_MSG_Read(11,0) == 0x03 && CAN_MSG_Read(11,1) == 0x7F && CAN_MSG_Read(11,1) == 0x2E)
// {
// zhenduansendStep++;
// }
// else
// {
// return;
// }
case
13
:
data20
[
0
]
=
0x07
;
data20
[
1
]
=
0x2E
;
data20
[
2
]
=
0xF1
;
data20
[
3
]
=
0x99
;
data20
[
4
]
=
(
barcode_Msg
[
20
]
-
0x30
)
>>
8
|
(
barcode_Msg
[
21
]
-
0x30
);
data20
[
5
]
=
(
barcode_Msg
[
22
]
-
0x30
)
>>
8
|
(
barcode_Msg
[
23
]
-
0x30
);
data20
[
6
]
=
(
barcode_Msg
[
24
]
-
0x30
)
>>
8
|
(
barcode_Msg
[
25
]
-
0x30
);
data20
[
7
]
=
(
barcode_Msg
[
26
]
-
0x30
)
>>
8
|
(
barcode_Msg
[
27
]
-
0x30
);
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
can_mid
(
m_msg20
);
Gen_TimeDelay
(
10000
,
50
);
zhenduansendStep
++
;
case
14
:
Gen_TimeDelay
(
10000
,
50
);
if
(
CAN_MSG_Read
(
11
,
0
)
==
0x03
&&
CAN_MSG_Read
(
11
,
1
)
==
0x6E
&&
CAN_MSG_Read
(
11
,
3
)
==
0x99
)
{
zhenduansendStep
++
;
}
else
{
return
;
}
case
15
:
data20
[
0
]
=
0x10
;
data20
[
1
]
=
0x09
;
data20
[
2
]
=
0x2E
;
data20
[
3
]
=
0xF1
;
data20
[
4
]
=
0x8C
;
data20
[
5
]
=
barcode_Msg
[
28
]
-
0x30
;
data20
[
6
]
=
barcode_Msg
[
29
]
-
0x30
;
data20
[
7
]
=
barcode_Msg
[
30
]
-
0x30
;
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
can_mid
(
m_msg20
);
Gen_TimeDelay
(
10000
,
50
);
zhenduansendStep
++
;
case
16
:
data20
[
0
]
=
0x21
;
data20
[
1
]
=
barcode_Msg
[
31
]
-
0x30
;
data20
[
2
]
=
barcode_Msg
[
32
]
-
0x30
;
data20
[
3
]
=
barcode_Msg
[
33
]
-
0x30
;
data20
[
4
]
=
0xAA
;
data20
[
5
]
=
0xAA
;
data20
[
6
]
=
0xAA
;
data20
[
7
]
=
0xAA
;
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
can_mid
(
m_msg20
);
Gen_TimeDelay
(
10000
,
50
);
zhenduansendStep
++
;
case
17
:
Gen_TimeDelay
(
10000
,
50
);
if
(
CAN_MSG_Read
(
11
,
0
)
==
0x03
&&
CAN_MSG_Read
(
11
,
1
)
==
0x6E
&&
CAN_MSG_Read
(
11
,
3
)
==
0x8C
)
{
zhenduansendStep
++
;
}
else
{
return
;
}
case
4
:
case
18
:
LINE_OUT_NEG_01
=
0
;
LINE_OUT_NEG_02
=
0
;
LINE_OUT_NEG_03
=
0
;
LINE_OUT_NEG_04
=
0
;
zhenduansendStep
=
0
;
break
;
default:
break
;
...
...
@@ -1625,12 +1809,163 @@ uint32_t Can_Send_0x794(void)
//return u32sendendflag;
}
void
sendCANMessage
(
uint8_t
*
data20
,
uint8_t
*
barcode_Msg
,
uint8_t
msgType
,
uint8_t
offset
,
uint8_t
length
)
void
get_key_value
(
void
)
{
uint8_t
i
=
0
;
uint32_t
SeedValue
=
0
;
SeedValue
=
(
uint32_t
)
seed_value
[
0
];
SeedValue
=
(
SeedValue
<<
8u
)
|
((
uint32_t
)
seed_value
[
1
]);
SeedValue
=
(
SeedValue
<<
8u
)
|
((
uint32_t
)
seed_value
[
2
]);
SeedValue
=
(
SeedValue
<<
8u
)
|
((
uint32_t
)
seed_value
[
3
]);
if
(
SeedValue
!=
0
)
{
for
(
i
=
0
;
i
<
47
;
i
++
)
{
if
(
SeedValue
&
0x80000000
)
{
SeedValue
=
SeedValue
<<
1
;
SeedValue
=
SeedValue
^
0x1A2B3C06
;
}
else
if
(
SeedValue
&
0x40000000
)
{
SeedValue
=
SeedValue
<<
2
;
SeedValue
=
SeedValue
^
0x1A2B3C06
;
}
else
if
(
SeedValue
&
0x20000000
)
{
SeedValue
=
SeedValue
<<
3
;
SeedValue
=
SeedValue
^
0x1A2B3C06
;
}
else
if
(
SeedValue
&
0x10000000
)
{
SeedValue
=
SeedValue
<<
4
;
SeedValue
=
SeedValue
^
0x1A2B3C06
;
}
else
{
SeedValue
=
~
SeedValue
;
}
}
SeedValue
=
SeedValue
^
(
~
0x1A2B3C06
);
key_array
[
0
]
=
(
uint8_t
)(
SeedValue
>>
24
);
key_array
[
1
]
=
(
uint8_t
)(
SeedValue
>>
16
);
key_array
[
2
]
=
(
uint8_t
)(
SeedValue
>>
8
);
key_array
[
3
]
=
(
uint8_t
)
SeedValue
;
key_value_all
=
SeedValue
;
}
}
void
Can_Send_0x714_CHECK
(
void
)
{
data20
[
0
]
=
0x2E
;
data20
[
1
]
=
0xF1
;
data20
[
2
]
=
msgType
;
memcpy
(
data20
+
3
,
barcode_Msg
+
offset
,
length
);
init_CAN_Frame
(
&
m_msg20
,
0x794
,
8
,
0
,
data20
);
// 初始化CAN帧
can_mid
(
m_msg20
);
// 发送CAN消息
}
\ No newline at end of file
switch
(
zhenduansendStep
)
{
case
0
:
if
(
barcode_Msg1
[
0
]
!=
51
&&
barcode_Msg1
[
1
]
!=
55
)
{
zhenduansendStep
=
0
;
break
;
}
data20
[
0
]
=
0x03
;
data20
[
1
]
=
0x22
;
data20
[
2
]
=
0xF1
;
data20
[
3
]
=
0x87
;
data20
[
4
]
=
0xAA
;
data20
[
5
]
=
0xAA
;
data20
[
6
]
=
0xAA
;
data20
[
7
]
=
0xAA
;
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
//诊断
can_mid
(
m_msg20
);
zhenduansendStep
++
;
break
;
case
1
:
get_num_buf
[
0
]
=
CAN_MSG_Read
(
11
,
5
);
get_num_buf
[
1
]
=
CAN_MSG_Read
(
11
,
6
);
get_num_buf
[
2
]
=
CAN_MSG_Read
(
11
,
7
);
zhenduansendStep
++
;
case
2
:
data20
[
0
]
=
0x30
;
data20
[
1
]
=
0x00
;
data20
[
2
]
=
0x00
;
data20
[
3
]
=
0xAA
;
data20
[
4
]
=
0xAA
;
data20
[
5
]
=
0xAA
;
data20
[
6
]
=
0xAA
;
data20
[
7
]
=
0xAA
;
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
//诊断
can_mid
(
m_msg20
);
zhenduansendStep
++
;
break
;
case
3
:
if
(
CAN_MSG_Read
(
11
,
0
)
==
0x21
)
{
get_num_buf
[
3
]
=
CAN_MSG_Read
(
11
,
1
);
get_num_buf
[
4
]
=
CAN_MSG_Read
(
11
,
2
);
get_num_buf
[
5
]
=
CAN_MSG_Read
(
11
,
3
);
get_num_buf
[
6
]
=
CAN_MSG_Read
(
11
,
4
);
get_num_buf
[
7
]
=
CAN_MSG_Read
(
11
,
5
);
get_num_buf
[
8
]
=
CAN_MSG_Read
(
11
,
6
);
get_num_buf
[
9
]
=
CAN_MSG_Read
(
11
,
7
);
zhenduansendStep
++
;
}
else
{
return
;
}
case
4
:
if
(
CAN_MSG_Read
(
11
,
0
)
==
0x22
)
{
get_num_buf
[
10
]
=
CAN_MSG_Read
(
11
,
5
);
get_num_buf
[
11
]
=
CAN_MSG_Read
(
11
,
6
);
get_num_buf
[
12
]
=
CAN_MSG_Read
(
11
,
7
);
get_num_buf
[
13
]
=
CAN_MSG_Read
(
11
,
5
);
get_num_buf
[
14
]
=
CAN_MSG_Read
(
11
,
6
);
get_num_buf
[
15
]
=
CAN_MSG_Read
(
11
,
7
);
get_num_buf
[
16
]
=
CAN_MSG_Read
(
11
,
7
);
zhenduansendStep
++
;
}
else
{
return
;
}
case
5
:
zhenduansendStep
++
;
zhenduansendStep
=
0
;
case
15
:
data20
[
0
]
=
0x02
;
data20
[
1
]
=
0x27
;
data20
[
2
]
=
0x01
;
data20
[
3
]
=
0xAA
;
data20
[
4
]
=
0xAA
;
data20
[
5
]
=
0xAA
;
data20
[
6
]
=
0xAA
;
data20
[
7
]
=
0xAA
;
init_CAN_Frame
(
&
m_msg20
,
0x714
,
8
,
0
,
data20
);
//诊断
can_mid
(
m_msg20
);
zhenduansendStep
++
;
break
;
memcpy
(
get_num_buf
,
BarCode
+
7
,
34
);
comparestart
=
1
;
zhenduanflag
=
3
;
}
}
YueJin_test_bench/source/Appliciation/Task.h
View file @
d0ae6c86
...
...
@@ -24,10 +24,12 @@ void Sys_Exact_100ms_Tasks(void);
void
Sys_Enter_Sleep_Mode
(
void
);
uint16_t
Sys_Get_ms_Rolling_Counter
(
void
);
void
get_key_value
(
void
);
void
init_CAN_Frame
(
CAN_Frame_st_t
*
msg
,
uint32_t
can_id
,
uint8_t
can_len
,
uint8_t
can_frame_ide
,
const
uint8_t
*
data
);
void
can_mid
(
CAN_Frame_st_t
Msg
);
void
can_submit
(
void
);
void
sendCANMessage
(
uint8_t
*
data20
,
uint8_t
*
barcode_Msg
,
uint8_t
msgType
,
uint8_t
offset
,
uint8_t
length
);
uint32_t
Can_Send_0x794
(
void
);
void
Can_Send_0x714
(
void
);
void
Can_Send_0x714_CHECK
(
void
);
#endif
\ No newline at end of file
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