Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZhongTong-ZR5-A
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
赵康弘
ZhongTong-ZR5-A
Commits
ba4f68a3
Commit
ba4f68a3
authored
Sep 28, 2025
by
赵康弘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: U48,外部信号设置过电流
parent
85379b6e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
70 deletions
+40
-70
PC_Control.c
GHS/App/PC_Control.c
+20
-3
SGM4591Q.h
GHS/App/SGM4591Q.h
+1
-1
Sys_Task_List.c
GHS/System/Sys_Task_List.c
+19
-66
No files found.
GHS/App/PC_Control.c
View file @
ba4f68a3
...
@@ -4,9 +4,10 @@
...
@@ -4,9 +4,10 @@
#include "SGM4591Q.h"
#include "SGM4591Q.h"
#include "Dio.h"
#include "Dio.h"
#include "CAN_CH0_CAN_Communication_Matrix.h"
#include "CAN_CH0_CAN_Communication_Matrix.h"
#include "Simulated_SPI_Master.h"
/*此文件用于上位机控制U16和U48*/
/*此文件用于上位机控制U16和U48*/
uint8_t
state_23
=
1
;
uint8_t
state_23
=
0
;
/*U16*/
/*U16*/
void
PC_Control_U16
(
void
)
void
PC_Control_U16
(
void
)
{
{
...
@@ -45,9 +46,14 @@ void PC_Control_U16(void)
...
@@ -45,9 +46,14 @@ void PC_Control_U16(void)
}
}
/*U48*/
/*U48*/
uint8_t
state_U48_1
=
1
;
uint8_t
state_U48_1
=
0
;
void
PC_Control_U48
(
void
)
void
PC_Control_U48
(
void
)
{
{
static
uint8_t
U48_Overcurrent_Last
=
0
;
uint8_t
U48_Overcurrent
=
0
;
uint8_t
U48_Overcurrent_LOW
=
0
;
uint8_t
U48_Overcurrent_HIGH
=
0
;
state_U48_1
=
Get_ID_18000000_Sig_PC_Control_U48_Power
();
state_U48_1
=
Get_ID_18000000_Sig_PC_Control_U48_Power
();
/*20A_OUT2*/
/*20A_OUT2*/
if
(
state_U48_1
==
1
)
if
(
state_U48_1
==
1
)
...
@@ -62,5 +68,16 @@ void PC_Control_U48(void)
...
@@ -62,5 +68,16 @@ void PC_Control_U48(void)
{
{
;
;
}
}
Get_ID_18000000_Sig_PC_Control_U48_CurrentControlSet
();
U48_Overcurrent_LOW
=
Get_ID_18000000_Sig_PC_Control_U48_LOW
();
U48_Overcurrent_HIGH
=
Get_ID_18000000_Sig_PC_Control_U48_HIGH
();
U48_Overcurrent
=
U48_Overcurrent_LOW
+
U48_Overcurrent_HIGH
<<
3
;
if
(
U48_Overcurrent_Last
!=
U48_Overcurrent
)
{
/*3.过电流高/低选择*/
MC33984EHFK_CS1_Output_Low
();
Sim_SPI_Master_0_Byte_Write
(
MC33984_SOCHLR_0
);
Sim_SPI_Master_0_Byte_Write
(
0x07
);
MC33984EHFK_CS1_Output_High
();
U48_Overcurrent_Last
=
U48_Overcurrent
;
}
}
}
GHS/App/SGM4591Q.h
View file @
ba4f68a3
...
@@ -80,7 +80,7 @@ extern volatile SGM4591Q_Pin_en SGM4591Q_Chip4_3_Segment1;
...
@@ -80,7 +80,7 @@ extern volatile SGM4591Q_Pin_en SGM4591Q_Chip4_3_Segment1;
extern
volatile
SGM4591Q_Pin_en
SGM4591Q_Chip4_4_Segment0
;
extern
volatile
SGM4591Q_Pin_en
SGM4591Q_Chip4_4_Segment0
;
extern
volatile
SGM4591Q_Pin_en
SGM4591Q_Chip4_4_Segment1
;
extern
volatile
SGM4591Q_Pin_en
SGM4591Q_Chip4_4_Segment1
;
extern
uint16_t
ADC_4
;
extern
uint16_t
ADC_4
;
void
SGM4591Q_Init
(
void
);
void
SGM4591Q_Global_Control
(
uint8_t
Chip
,
uint8_t
Segment
);
void
SGM4591Q_Global_Control
(
uint8_t
Chip
,
uint8_t
Segment
);
void
SGM4591Q_Control
(
void
);
void
SGM4591Q_Control
(
void
);
GHS/System/Sys_Task_List.c
View file @
ba4f68a3
...
@@ -38,18 +38,10 @@ void Sys_20ms_Tasks(void)
...
@@ -38,18 +38,10 @@ void Sys_20ms_Tasks(void)
{
{
// Can_MainFunction_Read();
// Can_MainFunction_Read();
}
}
uint32_t
u32IOConvert
;
uint8_t
u8test
;
uint8_t
u8test
;
void
Sys_50ms_Tasks
(
void
)
void
Sys_50ms_Tasks
(
void
)
{
{
u8test
=
Get_ID_18FF30E1_Sig_ECAS_Decrease
();
u8test
=
Get_ID_18FF30E1_Sig_ECAS_Decrease
();
u32IOConvert
++
;
// if (u32IOConvert > 100)
// {
// Port_SetPinDirection(Port_Config_PortGroup24_PortPin13,PORT_PIN_IN);
// Dio_WriteChannel(DioConf_DioChannel_P24_13,STD_LOW);
// }
}
}
uint16_t
g_u16ADCValue
[
16
]
=
{
0
};
uint16_t
g_u16ADCValue
[
16
]
=
{
0
};
uint8_t
g_u8secstatus
=
0U
;
uint8_t
g_u8secstatus
=
0U
;
...
@@ -79,20 +71,11 @@ uint16_t ADC_Input_Voltage_Calc(uint16_t u16ADCSample, uint16_t u16ADCRes, uint1
...
@@ -79,20 +71,11 @@ uint16_t ADC_Input_Voltage_Calc(uint16_t u16ADCSample, uint16_t u16ADCRes, uint1
return
u16Result
;
return
u16Result
;
}
}
uint32_t
time_test
=
0
;
uint32_t
time_test
=
0
;
uint8_t
aaaaaaData
=
0U
;
uint8_t
bcvcb
=
0U
;
// uint8 GaaByteAccfdfss[100] = { 0 };
void
Sys_100ms_Tasks
(
void
)
void
Sys_100ms_Tasks
(
void
)
{
{
time_test
++
;
time_test
++
;
// Dio_FlipChannel(DioConf_DioChannel_P56DioChannel);
// Dio_FlipChannel(DioConf_DioChannel_P24_13);
// g_u8secstatus++;
// Dio_FlipChannel(DioConf_DioChannel_P02_08);
/* Starts the conversion of group */
Adc_StartGroupConversion
(
AdcConf_AdcGroup_AdcGroup_000
);
Adc_StartGroupConversion
(
AdcConf_AdcGroup_AdcGroup_000
);
while
(
ADC_STREAM_COMPLETED
!=
Adc_GetGroupStatus
(
AdcConf_AdcGroup_AdcGroup_000
))
while
(
ADC_STREAM_COMPLETED
!=
Adc_GetGroupStatus
(
AdcConf_AdcGroup_AdcGroup_000
))
...
@@ -103,48 +86,18 @@ void Sys_100ms_Tasks(void)
...
@@ -103,48 +86,18 @@ void Sys_100ms_Tasks(void)
for
(
uint8_t
i
=
0
;
i
<
16
;
i
++
)
for
(
uint8_t
i
=
0
;
i
<
16
;
i
++
)
{
{
g_u16ADCValue
[
i
]
=
ADC_Input_Voltage_Calc
(
g_u16ADCValue
[
i
],
4096
,
5000
);
g_u16ADCValue
[
i
]
=
ADC_Input_Voltage_Calc
(
g_u16ADCValue
[
i
],
4096
,
5000
);
if
(
i
==
4
)
if
(
i
==
4
)
{
{
ADC_4
=
g_u16ADCValue
[
i
];
ADC_U16
=
g_u16ADCValue
[
i
];
}
if
(
i
==
0
)
{
ADC_U48
=
g_u16ADCValue
[
i
];
}
}
}
}
// SGM4591Q_Control();
// Port_SetPinDirection(Port_Config_PortGroup4_PortPin8, PORT_PIN_OUT);
Dio_WriteChannel
(
DioConf_DioChannel_P04_08
,
STD_LOW
);
Dio_WriteChannel
(
DioConf_DioChannel_P04_08
,
STD_LOW
);
MC33984EHFK_Read
();
MC33984EHFK_Read
();
// if (bcvcb == 1)
// {
// Dio_WriteChannel(DioConf_DioChannel_P02_05, STD_HIGH);
// Dio_WriteChannel(DioConf_DioChannel_P02_01, STD_HIGH);
// bcvcb = 0;
// }
// if (bcvcb == 2)
// {
// Dio_WriteChannel(DioConf_DioChannel_P02_05, STD_LOW);
// Dio_WriteChannel(DioConf_DioChannel_P02_01, STD_LOW);
// bcvcb = 0;
// }
// if (aaaaaaData < 99)
// {
// aaaaaaData++;
// }
// else
// {
// aaaaaaData = 0;
// }
// GaaByteAccfdfss[aaaaaaData] = Dio_ReadChannel(Port_Config_PortGroup2_PortPin1);
// abbaaaData= Dio_ReadChannel(Port_Config_PortGroup22_PortPin3);
// Port_SetPinDirection(Port_Config_PortGroup22_PortPin3, PORT_PIN_IN);
// Port_SetPinDirection(Port_Config_PortGroup22_PortPin4, PORT_PIN_IN);
// Port_SetPinDirection(Port_Config_PortGroup22_PortPin4, PORT_PIN_OUT);
// Port_SetPinDirection(Port_Config_PortGroup22_PortPin3, PORT_PIN_OUT);
SGMCD1020Q_MainFunction
();
SGMCD1020Q_MainFunction
();
PC_Control_U16
();
PC_Control_U16
();
PC_Control_U48
();
PC_Control_U48
();
...
...
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