no message

This commit is contained in:
起床就犯困 2024-08-05 10:35:10 +08:00
parent d2ae5c3b6d
commit ad8afd3845
25 changed files with 9318 additions and 5961 deletions

View File

@ -35,7 +35,7 @@ typedef enum
FLOAT = 4, /* ¸¡³äģʽ */
}SL_MPPT_MODE;
extern float duty_ratio;
extern float g_duty_ratio;
void mppt_readJust(void);
void MpptMode(void);

View File

@ -12,15 +12,13 @@
#include "timeSliceOffset.h"
#include "uart_dev.h"
#define runled_reloadVal 1000 /* 任务执行间隔 */
#define runled_offset 0 /* 任务执行偏移量 */
extern STR_TimeSliceOffset m_runled;
void Task_RunLED(void);
#define mpptControl_reloadVal 1000 /* 任务执行间隔 */
#define mpptControl_offset 0 /* 任务执行偏移量 */
#define mpptControl_reloadVal 10 /* 任务执行间隔 */
#define mpptControl_offset 0 /* 任务执行偏移量 */
extern STR_TimeSliceOffset m_mpptControl;
void Task_mpptControl(void);
@ -36,7 +34,7 @@ void Task_usart(void);
extern STR_TimeSliceOffset m_wdi;
void Task_wdi(void);
#define refreshRegister_reloadVal 10000 /* 任务执行间隔 */
#define refreshRegister_reloadVal 1000 /* 任务执行间隔 */
#define refreshRegister_offset 0 /* 任务执行偏移量 */
extern STR_TimeSliceOffset m_refreshRegister;
void Task_refreshRegister(void);
@ -49,12 +47,11 @@ extern uint8_t g_recvBroadcastRegisterNumber; /*
extern STR_TimeSliceOffset m_recvbroadcast;
void Task_recvbroadcast(void);
#define CapCharg_reloadVal 3000 /* 任务执行间隔 */
#define CapCharg_reloadVal 500 /* 任务执行间隔 */
#define CapCharg_offset 0 /* 任务执行偏移量 */
extern STR_TimeSliceOffset m_CapCharg;
extern void Task_CapCharg(void);
void task_Init(void);
void hardware_Init(void);

View File

@ -18,7 +18,7 @@
#define MOSFET_Temper ADC_Channel_6
#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));

View File

@ -18,7 +18,11 @@ static void ConstantCurrentCharge(void);
static void ConstantVoltageCharge(void);
static void FloatingCharge(void);
float duty_ratio = 0.5;
/* 占空比 */
float g_duty_ratio = 0.5;
/* 用于确定工作模式 */
static uint8_t modeFlag = 0;
/**
* @brief
* @param
@ -47,7 +51,7 @@ static float Get_OutputPower(void)
*/
/* pwm占空比调节步长 */
const float step1_pwm = 0.01;
const float step2_pwm = 0.001;
const float step2_pwm = 0.005;
//#define array_num 10
void mppt_readJust(void)
{
@ -89,7 +93,7 @@ void mppt_readJust(void)
//
// /* 正负向调节功率均未变大,此时设置功率为原来的点 */
// Set_duty_ratio(last_duty_ratio);
//// step_pwm = step2_pwm;
// step_pwm = step2_pwm;
static float last_duty_ratio = 0.5;
static float last_OutputPower;
@ -101,34 +105,30 @@ void mppt_readJust(void)
printf(" duty_ratio = %d/1000 \r\n", (int)(last_duty_ratio * 1000));
/* 正向调节查看功率是否会变大 */
duty_ratio = last_duty_ratio + step_pwm;
if (duty_ratio > 1) {
duty_ratio = 1;
}
Set_duty_ratio(duty_ratio);
g_duty_ratio = last_duty_ratio + step_pwm;
Set_duty_ratio(&g_duty_ratio);
now_OutputPower = Get_OutputPower();
if (now_OutputPower > last_OutputPower) {
printf(" now_OutputPower > last_OutputPower1 \r\n");
last_duty_ratio = duty_ratio;
last_duty_ratio = g_duty_ratio;
return;
}
/* 负向调节查看功率是否会变大 */
duty_ratio = last_duty_ratio - step_pwm;
if (duty_ratio < 0) {
duty_ratio = 0;
}
Set_duty_ratio(duty_ratio);
g_duty_ratio = last_duty_ratio - step_pwm;
Set_duty_ratio(&g_duty_ratio);
now_OutputPower = Get_OutputPower();
if (now_OutputPower > last_OutputPower) {
printf(" now_OutputPower > last_OutputPower2 \r\n");
last_duty_ratio = duty_ratio;
last_duty_ratio = g_duty_ratio;
return;
}
/* 正负向调节功率均未变大,此时设置功率为原来的点 */
Set_duty_ratio(last_duty_ratio);
// step_pwm = step2_pwm;
g_duty_ratio = last_duty_ratio;
Set_duty_ratio(&g_duty_ratio);
step_pwm = step2_pwm;
}
void printf_data(void)
@ -158,11 +158,11 @@ void mppt_constantVoltage(float InVoltage)
if (ConstantVoltageFlag) {
if (PV1_V > InVoltage) {
duty_ratio += step1_pwm;
Set_duty_ratio(duty_ratio);
g_duty_ratio += step1_pwm;
Set_duty_ratio(&g_duty_ratio);
} else {
duty_ratio -= step1_pwm;
Set_duty_ratio(duty_ratio);
g_duty_ratio -= step1_pwm;
Set_duty_ratio(&g_duty_ratio);
}
if (PV1_V - InVoltage < 0.1) {
@ -170,11 +170,11 @@ void mppt_constantVoltage(float InVoltage)
}
} else {
if (PV1_V > InVoltage) {
duty_ratio += step2_pwm;
Set_duty_ratio(duty_ratio);
g_duty_ratio += step2_pwm;
Set_duty_ratio(&g_duty_ratio);
} else {
duty_ratio -= step2_pwm;
Set_duty_ratio(duty_ratio);
g_duty_ratio -= step2_pwm;
Set_duty_ratio(&g_duty_ratio);
}
if (PV1_V - InVoltage > 0.1) {
@ -184,6 +184,87 @@ void mppt_constantVoltage(float InVoltage)
}
/**
* @brief
* @param
* @retval
*
*/
void mppt_constantVoltageO(float OutVoltage)
{
static uint8_t ConstantVoltageFlag = 1;
float PV1_V = get_PV_VOLT_OUT();
if (ConstantVoltageFlag) {
if (PV1_V > OutVoltage) {
g_duty_ratio -= step1_pwm;
Set_duty_ratio(&g_duty_ratio);
} else {
g_duty_ratio += step1_pwm;
Set_duty_ratio(&g_duty_ratio);
}
if (PV1_V - OutVoltage < 0.1) {
ConstantVoltageFlag = 0;
}
} else {
if (PV1_V > OutVoltage) {
g_duty_ratio -= step2_pwm;
Set_duty_ratio(&g_duty_ratio);
} else {
g_duty_ratio += step2_pwm;
Set_duty_ratio(&g_duty_ratio);
}
if (PV1_V - OutVoltage > 0.1) {
ConstantVoltageFlag = 1;
}
}
}
/**
* @brief
* @param
* @retval
*
*/
void mppt_constantCurrentO(float outCurrent)
{
static uint8_t ConstantCurrent = 1;
float out_I = get_CHG_CURR();
if (ConstantCurrent) {
if (out_I > outCurrent) {
g_duty_ratio -= step1_pwm;
Set_duty_ratio(&g_duty_ratio);
} else {
g_duty_ratio += step1_pwm;
Set_duty_ratio(&g_duty_ratio);
}
if (out_I - outCurrent < 0.1) {
ConstantCurrent = 0;
}
}
else {
if (out_I > outCurrent) {
g_duty_ratio -= step2_pwm;
Set_duty_ratio(&g_duty_ratio);
} else {
g_duty_ratio += step2_pwm;
Set_duty_ratio(&g_duty_ratio);
}
if (out_I - outCurrent > 0.1) {
ConstantCurrent = 1;
}
}
}
/**
* @brief
@ -193,7 +274,7 @@ void mppt_constantVoltage(float InVoltage)
*/
void TrickleCharge(void)
{
mppt_constantCurrentO(0.7);
}
/**
@ -226,11 +307,42 @@ void ConstantVoltageCharge(void)
*/
void FloatingCharge(void)
{
mppt_constantVoltage(16);
static uint8_t run_num;
if (get_CHG_CURR() > 0.1) {
mppt_constantVoltageO(12);
if (run_num++ > 100) {
if ((get_PV_VOLT_OUT()) < 14) {
run_num = 0;
modeFlag = CONSTANTVOLTAGE;
return;
}
}
}
else {
TIM_SetCompare4(TIM4, 0);
if (run_num++) {
if ((get_PV_VOLT_OUT()) < 14) {
run_num = 0;
modeFlag = CONSTANTVOLTAGE;
return;
}
}
if (run_num > 100) {
run_num = 0;
modeFlag = CONSTANTVOLTAGE;
return;
}
}
if (run_num > 200) {
run_num = 100;
}
}
static uint8_t modeFlag = 0;
void MpptContorl(void)
{
switch(modeFlag) {
@ -261,6 +373,7 @@ void MpptMode(void)
static float ConstantCurrentV;
static float ConstantVoltageV;
static float FloatI;
/* 赋值仅执行一次 */
if (temp_flag) {
ConstantCurrentV = (float)g_slConfigInfo.ConstantCurrentV / 100;
ConstantVoltageV = (float)g_slConfigInfo.ConstantVoltageV / 100;
@ -280,8 +393,8 @@ void MpptMode(void)
return;
}
if (!(ConstantVoltageV > g_Mppt_Para.Battery_Voltage) &&
(FloatI > get_CHG_CURR())) {
if ((!(ConstantVoltageV > g_Mppt_Para.Battery_Voltage) &&
(FloatI > get_CHG_CURR())) || modeFlag == FLOAT) {
modeFlag = FLOAT;
return;
}
@ -290,16 +403,44 @@ void MpptMode(void)
return;
}
void findMiNDutyRatio(void)
{
static uint8_t num = 100;
if (0.05 < get_CHG_CURR()) {
num -= 1;
TIM_SetCompare4(TIM4, num);
}
else {
printf("min duty ratio : %d/200 \n", num);
}
}
void test(void)
{
// mppt_readjust();
// Get_OutputPower();
// mppt_constantVoltage(18);
// findMiNDutyRatio();
// MpptContorl();
printf_data();
// printf_data();
// void MpptContorl();
// mppt_constantVoltageO(12);
// FloatingCharge();
mppt_readJust();
// mppt_constantCurrentO(0.7);
// static uint32_t run_num = 0;
// if (1000 < run_num++) {
// FloatingCharge();
// run_num = 1200;
// printf("in floatcharge \n");
// return;
// }
// mppt_readJust();
// mppt_constantCurrentO(1.2);
}

View File

@ -311,7 +311,8 @@ void SL_MsgProcFunc_Registration_request(device_handle device, void *pMsg, uint3
/* 20s内不再接收广播帧 */
run_Broadcast = 0;
TIM2_Init();
TIM2->CNT = 0;
TIM_Cmd(TIM2, ENABLE); //TIM2使能
}
/**
@ -636,6 +637,18 @@ static int uart_read_climate_pack(device_handle uart_handle,uint8_t *buff, uint3
w_Flag = 0;
// continue;
}
else {
if (flag_run < 2) {
flag_run = 2;
}
w_Flag = 0;
log_info("funcode error %x\r\n", pack->function_Code);
memcpy(buff, buff+1, offset-1);
offset--;
// buff_size--;
continue;
}
}
#endif

View File

@ -30,7 +30,7 @@
STR_TimeSliceOffset m_runled;
void Task_RunLED(void)
{
// printf("duty_ratio : %d \n", (int)(duty_ratio * 1000));
printf("duty_ratio : %d \n", (int)(g_duty_ratio * 1000));
static uint8_t flag = RESET;
flag = !flag;
GPIO_WriteBit(RUN_LED_GPIO, RUN_LED_PIN, flag);
@ -46,15 +46,16 @@ void Task_RunLED(void)
STR_TimeSliceOffset m_mpptControl;
void Task_mpptControl(void)
{
// test();
static uint8_t test_flag = 0;
if (5 == ++test_flag) {
test_flag = 0;
printf("in time init \n");
TIM2_Init();
printf("out time init \n");
}
test();
// static uint8_t test_flag = 0;
// if (5 == ++test_flag) {
// test_flag = 0;
// printf("in time init \n");
// TIM2->CNT = 0;
// TIM_Cmd(TIM2, ENABLE); //TIM2使能
// printf("out time init \n");
// }
return;
}
@ -85,8 +86,8 @@ void Task_wdi(void)
temp = 0;
NVIC_SystemReset();
}
// GPIO_WriteBit(WDI_INPUT_GPIO, WDI_INPUT_PIN, SET);
// GPIO_WriteBit(WDI_INPUT_GPIO, WDI_INPUT_PIN, RESET);
GPIO_WriteBit(WDI_INPUT_GPIO, WDI_INPUT_PIN, SET);
GPIO_WriteBit(WDI_INPUT_GPIO, WDI_INPUT_PIN, RESET);
return;
}
@ -95,19 +96,21 @@ void Task_wdi(void)
* @param
* @retval
*/
#define checkRemainingBatteryBower 3 //电池剩余电量30s刷新一次
#define checkSolarOpenCircuitVoltage 180 //太阳能板开路电压30min刷新一次
#define mpptmodedelay 6 //mppt工作模式60s刷新一次小于1000S
#define checkSolarOpenCircuitDelay 500 //检测太阳能板开路电压时,关闭太阳能板的延时时间
#define checkRemainingBatteryBower 30 //电池剩余电量30s刷新一次
#define checkSolarOpenCircuitVoltage 1800 //太阳能板开路电压30min刷新一次
#define mpptmodedelay 60 //mppt工作模式60s刷新一次小于1000S
//#define checkSolarOpenCircuitDelay 500 //检测太阳能板开路电压时,关闭太阳能板的延时时间
STR_TimeSliceOffset m_refreshRegister;
void Task_refreshRegister(void)
{
static uint8_t checkFlagTemp1 = 0;
static uint8_t checkFlagTemp2 = 0;
static uint8_t mpptModeFlag = 0;
static uint32_t checkFlagTemp1 = checkRemainingBatteryBower - 1;
static uint32_t checkFlagTemp2 = checkSolarOpenCircuitVoltage - 1;
/* */
static uint32_t opencheckFlag = 0;
static uint32_t mpptModeFlag = mpptmodedelay -1;
/* 后续可以添加考虑减少放电电流的影响 */
g_Mppt_Para.Battery_Voltage = get_PV_VOLT_OUT();
g_Mppt_Para.Battery_Voltage = 0;
g_Mppt_Para.Battery_temperature = 0;
if (checkRemainingBatteryBower == ++checkFlagTemp1) {
@ -115,27 +118,35 @@ void Task_refreshRegister(void)
checkFlagTemp1 = 0;
}
if (checkSolarOpenCircuitVoltage == ++checkFlagTemp2) {
Set_duty_ratio(0);
Delay_Ms(500);
GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, SET);
GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, SET);
g_Mppt_Para.Solar_Open_Circuit_Voltage1 = get_PV1_VOLT_IN();
g_Mppt_Para.Solar_Open_Circuit_Voltage2 = get_PV2_VOLT_IN();
GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, SET);
GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, SET);
checkFlagTemp2 = 0;
if (checkSolarOpenCircuitVoltage == ++checkFlagTemp2 || (opencheckFlag && ++checkFlagTemp2)) {
if (!opencheckFlag) {
Set_duty_ratio(0);
if ((g_Mppt_Para.Solar_Open_Circuit_Voltage1
> g_slConfigInfo.startSolarOpenCircuitV)
|| (g_Mppt_Para.Solar_Open_Circuit_Voltage2
> g_slConfigInfo.startSolarOpenCircuitV)) {
TimeSliceOffset_Register(&m_mpptControl, Task_mpptControl
, mpptControl_reloadVal, mpptControl_offset);
mpptModeFlag = 0;
} else {
TimeSliceOffset_Unregister(&m_mpptControl);
mpptModeFlag = 100;
opencheckFlag = 1;
checkFlagTemp2 = 0;
}
else {
GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, SET);
GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, SET);
g_Mppt_Para.Solar_Open_Circuit_Voltage1 = get_PV1_VOLT_IN();
g_Mppt_Para.Solar_Open_Circuit_Voltage2 = get_PV2_VOLT_IN();
GPIO_WriteBit(G_FFMOS_CON1_GPIO, G_FFMOS_CON1_PIN, RESET);
GPIO_WriteBit(G_FFMOS_CON2_GPIO, G_FFMOS_CON2_PIN, RESET);
opencheckFlag = 0;
if ((g_Mppt_Para.Solar_Open_Circuit_Voltage1
> g_slConfigInfo.startSolarOpenCircuitV)
|| (g_Mppt_Para.Solar_Open_Circuit_Voltage2
> g_slConfigInfo.startSolarOpenCircuitV)) {
TimeSliceOffset_Register(&m_mpptControl, Task_mpptControl
, mpptControl_reloadVal, mpptControl_offset);
mpptModeFlag = 0;
Set_duty_ratio(&g_duty_ratio);
} else {
TimeSliceOffset_Unregister(&m_mpptControl);
mpptModeFlag = 100;
}
}
}
@ -145,8 +156,6 @@ void Task_refreshRegister(void)
mpptModeFlag = 0;
}
}
return;
}
@ -247,33 +256,25 @@ void Task_recvbroadcast(void)
* @param
* @retval
*/
void CapCharg(void)
{
TIM_SetCompare4(TIM4, 0);
TIM_SetCompare2(TIM4, 50);
Delay_Us(7);
TIM_SetCompare2(TIM4, 0);
TIM_SetCompare4(TIM4, 135);
}
STR_TimeSliceOffset m_CapCharg;
void Task_CapCharg(void)
{
static uint8_t runNum = 0;
if (0.05 > get_CHG_CURR()) {
if (!runNum) {
m_CapCharg.reloadVal = 10;
}
Set_duty_ratio(0);
for (uint8_t var = 0; var < 3; ++var) {
Delay_Us(1);
GPIO_WriteBit(CAPCHARG_GPIO, CAPCHARG_PIN, SET);
Delay_Us(1);
GPIO_WriteBit(CAPCHARG_GPIO, CAPCHARG_PIN, RESET);
}
// duty_ratio = 0.9;
// Set_duty_ratio(duty_ratio);
TIM_SetCompare4(TIM4, 180);
if (3 == ++runNum) {
runNum = 0;
m_CapCharg.reloadVal = CapCharg_reloadVal;
}
if (get_CHG_CURR() > 0.05) {
return;
}
else {
g_duty_ratio = 0.675;
printf("in capcharg \n");
CapCharg();
}
return;
@ -315,21 +316,19 @@ void task_Init(void)
TimeSliceOffset_Register(&m_runled, Task_RunLED, runled_reloadVal, runled_offset);
// m_refreshRegister.runFlag = 1; /* 该启动后立即执行一次 */
// TimeSliceOffset_Register(&m_refreshRegister, Task_refreshRegister
// , refreshRegister_reloadVal, refreshRegister_offset);
//
TimeSliceOffset_Register(&m_mpptControl, Task_mpptControl
, mpptControl_reloadVal, mpptControl_offset);
//
// TimeSliceOffset_Register(&m_usart, Task_usart, usart_reloadVal, usart_offset);
//
// TimeSliceOffset_Register(&m_wdi, Task_wdi, wdi_reloadVal, wdi_offset);
//
// TimeSliceOffset_Register(&m_CapCharg, Task_CapCharg, CapCharg_reloadVal, CapCharg_offset);
m_CapCharg.runFlag = 1; /* 该启动后立即执行一次 */
TimeSliceOffset_Register(&m_CapCharg, Task_CapCharg, CapCharg_reloadVal, CapCharg_offset);
TimeSliceOffset_Start(); /* 启动时间片轮询 */
}
@ -343,6 +342,7 @@ void task_Init(void)
void hardware_Init(void)
{
TIM3_Init();
TIM2_Init();
uart_dev_init();
PWM_TIM_Configuration();
ADC_all_Init();
@ -354,6 +354,13 @@ void hardware_Init(void)
DSG_PROT_Init();
SPI_Flash_Init();
CAPCHARG_Init();
// Set_duty_ratio(0.5);
// TIM_SetCompare4(TIM4, 5000);
Set_duty_ratio(&g_duty_ratio);
// Delay_Ms(100);
// CapCharg();
// TIM_SetCompare2(TIM4, 50);
}

View File

@ -116,6 +116,7 @@ void TimeSliceOffset_Start(void)
}
}
// __WFI();
}
}

View File

@ -54,7 +54,6 @@ void DSG_PROT_Init(void);
/* ¸ø±Ãµç·µçÈݳäµç */
/* CapCharg --> PB7 */
/* 放电过流时为低电平,进入中断处理 */
#define CAPCHARG_GPIO GPIOB
#define CAPCHARG_PIN GPIO_Pin_7
void CAPCHARG_Init(void);

View File

@ -15,9 +15,9 @@
#define Prescaler 0
/* 输出频率为240M */
#define Period 200 - 1
//#define Period 2000 - 1
//#define Period 20000 - 1
void PWM_TIM_Configuration(void);
void Set_duty_ratio(float duty_ratio);
void Set_duty_ratio(float *duty_ratio);
#endif

View File

@ -110,7 +110,7 @@ void CAPCHARG_Init(void)
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(CAPCHARG_GPIO, &GPIO_InitStructure);
GPIO_WriteBit(CAPCHARG_GPIO, CAPCHARG_PIN, RESET);
// GPIO_WriteBit(CAPCHARG_GPIO, CAPCHARG_PIN, RESET);
}

View File

@ -14,6 +14,9 @@ void PWM_GPIO_Configuration(void)
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
//定时器PWM输出配置
@ -43,17 +46,25 @@ void PWM_TIM_Configuration(void)
TIM_OC4Init(TIM4, &TIM_OCInitStructure);
TIM_OC4PreloadConfig(TIM4, TIM_OCPreload_Enable);
TIM_OC2Init(TIM4, &TIM_OCInitStructure);
TIM_OC2PreloadConfig(TIM4, TIM_OCPreload_Disable);
// TIM_OC2PreloadConfig(TIM4, TIM_OCPreload_Enable);
TIM_Cmd(TIM4, ENABLE);
TIM_CtrlPWMOutputs(TIM4, ENABLE);
}
void Set_duty_ratio(float duty_ratio)
void Set_duty_ratio(float *duty_ratio)
{
if (duty_ratio < 0 || duty_ratio > 1) {
if (*duty_ratio < 0) {
*duty_ratio = 0;
return;
} else if (*duty_ratio > 1) {
*duty_ratio = 1;
return;
}
uint16_t pulse = (Period + 1) * duty_ratio;
uint16_t pulse = *duty_ratio * (Period + 1);
TIM_SetCompare4(TIM4, pulse);
}

View File

@ -13,8 +13,9 @@
#define delayms 1
/* 延时时间 */
#define delays 2
#define delays 20
/* 是否接收广播帧标志位 */
uint8_t run_Broadcast = 1;
void TIM3_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
@ -115,7 +116,7 @@ void TIM2_Int_Init(uint16_t arr, uint16_t psc)
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能通道1中断
NVIC_Init(&NVIC_InitStructure); //初始化NVIC
TIM_Cmd(TIM2, ENABLE); //TIM2使能
// TIM_Cmd(TIM2, ENABLE); //TIM2使能
}
void TIM2_IRQHandler(void)
@ -123,8 +124,8 @@ void TIM2_IRQHandler(void)
if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) { //检查TIM2中断是否发生。
TIM_ClearITPendingBit(TIM2, TIM_IT_Update); //清除TIM2的中断挂起位。
TIM_Cmd(TIM2, DISABLE); //TIM2禁止
TIM_ITConfig(TIM2, TIM_IT_Update, DISABLE); //禁止TIM2更新中断
printf("in time it \n");
// TIM_ITConfig(TIM2, TIM_IT_Update, DISABLE); //禁止TIM2更新中断
// printf("in time2 it \n");
run_Broadcast = 1;
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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