cancel
Showing results for 
Search instead for 
Did you mean: 

Wait but MCU is unblocked

XooM
Senior

I haven't been able to wait 500ms without affecting the timers for 7 days.
In this block, doesn't PB14 become "0" after 500ms?
Even if I use comment lines, it doesn't work.

Note: volatile uint32_t Counter = 0;
The "Counter" variable is incremented every 1ms with Timer16.

 

** STM32F030C6T6 I'm using.

** Own PCB board..

*** Note: Card of a working system.. There is no card design error.

 

 

if(htim->Instance==TIM16)
		{
		 Counter++;

		if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13)==0)
		  {
			  if(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_2)==0)
					 {
				         if(PA10_On==0)
				         {
                         HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12,GPIO_PIN_RESET);
                         HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14,GPIO_PIN_SET);
                         Counter=0;
                         PA10_On=1;

                         // Tick_PA10_On= HAL_GetTick();
                         // PA10_On=1;
				         }
				         else
				         {
				          if(Counter>500) // if((HAL_GetTick()-Tick_PA10_On)>=500)
							{
				        	 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14,GPIO_PIN_RESET);
				        	 Counter=501;
							}
				         }



				   	}
				else
					  {

					  	 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12,GPIO_PIN_SET);
					  }

		  }
		  else
		  {
			  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12,GPIO_PIN_RESET);

		  }
}

 

 

60 REPLIES 60

Yes