修改泵电路部分充电

This commit is contained in:
起床就犯困 2024-07-22 16:48:34 +08:00
parent e31c80dae6
commit d2a332e4af
11 changed files with 7740 additions and 6827 deletions

View File

@ -44,7 +44,7 @@ extern uint8_t g_recvBroadcastRegisterNumber; /*
extern STR_TimeSliceOffset m_recvbroadcast; extern STR_TimeSliceOffset m_recvbroadcast;
void Task_recvbroadcast(void); void Task_recvbroadcast(void);
#define CapCharg_reloadVal 1000 /* 任务执行间隔 */ #define CapCharg_reloadVal 10000 /* 任务执行间隔 */
#define CapCharg_offset 0 /* 任务执行偏移量 */ #define CapCharg_offset 0 /* 任务执行偏移量 */
extern STR_TimeSliceOffset m_CapCharg; extern STR_TimeSliceOffset m_CapCharg;
extern void Task_CapCharg(void); extern void Task_CapCharg(void);

View File

@ -18,7 +18,7 @@
#define MOSFET_Temper ADC_Channel_6 #define MOSFET_Temper ADC_Channel_6
#define PV2_VOLT_IN ADC_Channel_7 #define PV2_VOLT_IN ADC_Channel_7
#define enable_Printf_VI //#define enable_Printf_VI
/* 光伏充电输出电流比例,放大倍数*电阻 */ /* 光伏充电输出电流比例,放大倍数*电阻 */
const float P_CHG_CURR = (1.0 / (50 * 0.005)); const float P_CHG_CURR = (1.0 / (50 * 0.005));

View File

@ -265,7 +265,7 @@ void test(void)
// mppt_readjust(); // mppt_readjust();
// Get_OutputPower(); // Get_OutputPower();
mppt_constantVoltage(19); mppt_constantVoltage(18);
// printf_data(); // printf_data();
// void MpptContorl(); // void MpptContorl();
} }

View File

@ -30,6 +30,7 @@
STR_TimeSliceOffset m_runled; STR_TimeSliceOffset m_runled;
void Task_RunLED(void) void Task_RunLED(void)
{ {
printf("duty_ratio : %d \n", (int)(duty_ratio * 1000));
static uint8_t flag = RESET; static uint8_t flag = RESET;
flag = !flag; flag = !flag;
GPIO_WriteBit(RUN_LED_GPIO, RUN_LED_PIN, flag); GPIO_WriteBit(RUN_LED_GPIO, RUN_LED_PIN, flag);
@ -184,48 +185,34 @@ void Task_recvbroadcast(void)
STR_TimeSliceOffset m_CapCharg; STR_TimeSliceOffset m_CapCharg;
void Task_CapCharg(void) void Task_CapCharg(void)
{ {
if (0.1 > get_CHG_CURR()) { static uint8_t runNum = 0;
// TIM_Cmd(TIM4, DISABLE); if (0.05 > get_CHG_CURR()) {
// if (!runNum) {
// TIM_OC4PreloadConfig(TIM4, TIM_OCPreload_Disable); m_CapCharg.reloadVal = 10;
// TIM_OC2PreloadConfig(TIM4, TIM_OCPreload_Enable); }
//
// TIM_Cmd(TIM4, ENABLE);
// Delay_Us(200);
//
// TIM_Cmd(TIM4, DISABLE);
// TIM_OC2PreloadConfig(TIM4, TIM_OCPreload_Disable);
// TIM_OC4PreloadConfig(TIM4, TIM_OCPreload_Enable);
// TIM_Cmd(TIM4, ENABLE);
// TIM_Cmd(TIM4, DISABLE);
// TIM_OC4PreloadConfig(TIM4, TIM_OCPreload_Disable);
Set_duty_ratio(0); Set_duty_ratio(0);
// GPIO_WriteBit(GPIOB, GPIO_Pin_9, RESET); for (uint8_t var = 0; var < 2; ++var) {
for (uint8_t var = 0; var < 8; ++var) { Delay_Us(1);
GPIO_WriteBit(CAPCHARG_GPIO, CAPCHARG_PIN, SET); GPIO_WriteBit(CAPCHARG_GPIO, CAPCHARG_PIN, SET);
Delay_Us(1); Delay_Us(1);
GPIO_WriteBit(CAPCHARG_GPIO, CAPCHARG_PIN, RESET); GPIO_WriteBit(CAPCHARG_GPIO, CAPCHARG_PIN, RESET);
Delay_Us(1);
} }
// TIM_Cmd(TIM4, ENABLE);
// TIM_OC4PreloadConfig(TIM4, TIM_OCPreload_Enable);
duty_ratio = 0.9; duty_ratio = 0.9;
Set_duty_ratio(duty_ratio); Set_duty_ratio(duty_ratio);
// Set_duty_ratio(0); if (30 == ++runNum) {
// GPIO_WriteBit(GPIOB, GPIO_Pin_9, SET); runNum = 0;
m_CapCharg.reloadVal = CapCharg_reloadVal;
}
printf("in test \n"); printf("in test \n");
return; return;
} }
// Set_duty_ratio(0);
// GPIO_WriteBit(CAPCHARG_GPIO, CAPCHARG_PIN, SET);
// Delay_Us(1);
// GPIO_WriteBit(CAPCHARG_GPIO, CAPCHARG_PIN, RESET);
// Set_duty_ratio(0.5);
return; return;
} }
/** /**
@ -263,7 +250,7 @@ void task_Init(void)
g_Mppt_Para_Init(); g_Mppt_Para_Init();
// //
TimeSliceOffset_Register(&m_runled, Task_RunLED, runled_reloadVal, runled_offset); TimeSliceOffset_Register(&m_runled, Task_RunLED, runled_reloadVal, runled_offset);
// TimeSliceOffset_Register(&m_mpptControl, Task_mpptControl, mpptControl_reloadVal, mpptControl_offset); TimeSliceOffset_Register(&m_mpptControl, Task_mpptControl, mpptControl_reloadVal, mpptControl_offset);
TimeSliceOffset_Register(&m_usart, Task_usart, usart_reloadVal, usart_offset); TimeSliceOffset_Register(&m_usart, Task_usart, usart_reloadVal, usart_offset);
TimeSliceOffset_Register(&m_wdi, Task_wdi, wdi_reloadVal, wdi_offset); TimeSliceOffset_Register(&m_wdi, Task_wdi, wdi_reloadVal, wdi_offset);
TimeSliceOffset_Register(&m_CapCharg, Task_CapCharg, CapCharg_reloadVal, CapCharg_offset); TimeSliceOffset_Register(&m_CapCharg, Task_CapCharg, CapCharg_reloadVal, CapCharg_offset);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff