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
bc7e0a4c
Commit
bc7e0a4c
authored
Apr 11, 2025
by
baizhengyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:五码合一初版
parent
03539293
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
5 deletions
+127
-5
Barcode_Scanner.c
YueJin_test_bench/source/Appliciation/Barcode_Scanner.c
+2
-2
Task.c
YueJin_test_bench/source/Appliciation/Task.c
+122
-3
Task.h
YueJin_test_bench/source/Appliciation/Task.h
+3
-0
No files found.
YueJin_test_bench/source/Appliciation/Barcode_Scanner.c
View file @
bc7e0a4c
...
...
@@ -214,7 +214,7 @@ void datacheck(void)
RS485_TX_finish
=
0
;
}
}
else
if
(
zhenduanflag
==
1
)
else
if
(
zhenduanflag
==
1
)
//五码合一写入
{
if
(
BarCode
[
0
]
==
0x59
&&
BarCode
[
1
]
==
0x44
)
{
...
...
@@ -309,7 +309,7 @@ void datacheck(void)
}
}
}
else
if
(
zhenduanflag
==
2
)
else
if
(
zhenduanflag
==
2
)
//五码合一校验
{
if
(
BarCode
[
0
]
==
0x59
&&
BarCode
[
1
]
==
0x44
)
{
...
...
YueJin_test_bench/source/Appliciation/Task.c
View file @
bc7e0a4c
...
...
@@ -104,7 +104,7 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
if
(
RS485_TX_finish
==
0
)
{
LINE_OUT_NEG_09
=
1
;
if
(
LINE_OUT_NEG_09
==
1
)
if
(
LINE_OUT_NEG_09
==
1
)
//等于0 不发送485
{
if
(
connectbleFlag
==
0
)
{
...
...
@@ -225,6 +225,29 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
}
}
else
{
if
(
zhenduanflag
==
0
)
{
// R485_Send_Line_0x47(MENU_CHECK_STEP);
// RS485_User_Tx_Data();
// comparestart = 0;
}
else
if
(
zhenduanflag
==
1
)
{
// R485_Send_0x47();
// comparestart = 0;
Can_Send_0x794
();
}
else
if
(
zhenduanflag
==
2
)
{
R485_Sendcheck_0x47
();
}
else
{
;
}
}
// else
// {
...
...
@@ -374,7 +397,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
}
Display_PageNum
();
can_submit
();
//
can_submit();
// Freln_Duty_HZ_Service();
if
(
RS485_send_time
<
0xFFFFFFFF
)
...
...
@@ -794,6 +817,11 @@ void can_submit(void)
data9
[
4
]
=
2
;
init_CAN_Frame
(
&
m_msg9
,
0x0C11FFD1
,
8
,
1
,
data9
);
// 总电池电量
// data9[0] = 0x03;
// data9[1] = 0x22;
// data9[2] = 0xF1;
// data9[3] = 0x87;
// init_CAN_Frame(&m_msg9, 0x794, 8, 0, data9); // 总电池电量
data5
[
4
]
=
1500
&
0xFF
;
data5
[
5
]
=
(
1500
>>
8
)
&
0xFF
;
...
...
@@ -1426,7 +1454,7 @@ void can_submit(void)
data19
[
0
]
=
1
<<
4
;
init_CAN_Frame
(
&
m_msg19
,
0x0C21FFD3
,
8
,
1
,
data19
);
//密码
init_CAN_Frame
(
&
m_msg1
,
0x0C20FFD2
,
8
,
1
,
data1
);
// 车速
init_CAN_Frame
(
&
m_msg2
,
0x0C10FFD3
,
8
,
1
,
data2
);
// 报警器报警状态 整车状态 free
init_CAN_Frame
(
&
m_msg3
,
0x0C22FFD2
,
8
,
1
,
data3
);
// 整车操作状态反馈
...
...
@@ -1515,3 +1543,94 @@ void can_submit(void)
can_mid
(
m_msg18
);
}
}
//诊断
CAN_Frame_st_t
m_msg20
;
uint8_t
data20
[
8
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
//0x794
uint32_t
Can_Send_0x794
(
void
)
{
uint32_t
u32sendendflag
=
0
;
switch
(
zhenduansendStep
)
{
case
0
:
data20
[
0
]
=
0x02
;
data20
[
1
]
=
0x10
;
data20
[
2
]
=
0x03
;
init_CAN_Frame
(
&
m_msg20
,
0x794
,
8
,
0
,
data20
);
//诊断
can_mid
(
m_msg20
);
break
;
case
1
:
data20
[
0
]
=
0x2
;
data20
[
1
]
=
0x27
;
data20
[
2
]
=
0x01
;
init_CAN_Frame
(
&
m_msg20
,
0x794
,
8
,
0
,
data20
);
//诊断
can_mid
(
m_msg20
);
break
;
case
2
:
data20
[
0
]
=
0x06
;
data20
[
1
]
=
0x27
;
data20
[
2
]
=
0x02
;
data20
[
3
]
=
key_array
[
0
];
data20
[
4
]
=
key_array
[
1
];
data20
[
5
]
=
key_array
[
2
];
data20
[
6
]
=
key_array
[
3
];
init_CAN_Frame
(
&
m_msg20
,
0x794
,
8
,
0
,
data20
);
//诊断
can_mid
(
m_msg20
);
break
;
case
3
:
// 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);
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
4
:
LINE_OUT_NEG_01
=
0
;
LINE_OUT_NEG_02
=
0
;
LINE_OUT_NEG_03
=
0
;
LINE_OUT_NEG_04
=
0
;
break
;
default:
break
;
}
// if(zhenduansendStep != 4)
// {
// u32sendendflag = can_mid(m_msg20);
// }
//return u32sendendflag;
}
void
sendCANMessage
(
uint8_t
*
data20
,
uint8_t
*
barcode_Msg
,
uint8_t
msgType
,
uint8_t
offset
,
uint8_t
length
)
{
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
YueJin_test_bench/source/Appliciation/Task.h
View file @
bc7e0a4c
...
...
@@ -27,4 +27,7 @@ uint16_t Sys_Get_ms_Rolling_Counter(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
);
#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