AnsweredAssumed Answered

help srf04 stm32f407

Question asked by Duc_Sy.Nguyen on Dec 10, 2016
Latest reply on Dec 10, 2016 by waclawek.jan

hi all

while (1)
{
int time;
int i=0;
GPIO_SetBits(GPIOA,GPIO_Pin_1);
//delay_us(10);
Delay(240);
//Delay01ms(100);
GPIO_ResetBits(GPIOA,GPIO_Pin_1);
while(GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0)==0);
while(GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0))i++;
time = (int)i/9500000;
distance_mm =(int) (time*344)*1000/2;
//delay_us(1000);
//Delay01ms(1000);
Delay(1440000);
}

it stop at "while(GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0)==0);" , and distance_mm=0

i use keil 5.20

Outcomes