Question
STM32CO11 DELAYS NOT WORKING
if(Mains>0.1)
{
if((Mains<1) &&(Vbat>0.9))
{
TIM1->CCR4=TIM1->ARR;
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_4);
Set_LED(0);
Batt_Chrge(0);
HAL_Delay(1000);
}
else
{
TIM1->CCR4=0;
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_4);
Batt_Chrge(0);
}
if((Mains<0.1)&&(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_6)==GPIO_PIN_SET))
{
TIM1->CCR4=TIM1->ARR/2;
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_4);
Batt_Chrge(0);
}
else if((Mains<0.1)&&(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_6)==GPIO_PIN_RESET))
{
TIM1->CCR4=TIM1->ARR;
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_4);
Batt_Chrge(0);
}
}
/*REST OF MY CODE*/
if((Mains<0.1)&& (TIM1->CCR4 == 0))
{
count++;
if(count>=50)
{
Enter_sleep();
}
}hi can anyone please let me what is wrong ,these code should be worked only detecting the mains as after Mains>0.1 if interruptions occur it should start again only after mains>0.1.I have also configured SYSTICK but I am not sure why my delay is not working .
