This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

calculate the time between 2 rising edge

hi can anyone help me i need to calculate the time between 2 rising edge of square wave signal the first signal is relayed with pc10 the second with pc11

that is the schematic :

s14.postimg.org/.../counter1.png

Parents
  • Hi. we are working on the project again for now four months. i made many changes to the project and the code is now very good but it is still not working very properly.

    uint8_t ch[10000];
    double timerValue1,timerValue2 ,delta, delta2;

    do { timerValue1 = TIM_GetCounter(TIM2); delta2 = delta1 + timerValue1;
    } while(GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_10)!=1) ; do { timerValue2 = TIM_GetCounter(TIM4);

    delta2 = delta2 + ch[53];
    } while(GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_10)!=1) ;
    delta= timerValue2- timerValue1;

    } sprintf(ch,"%lf seconds", (double)delta); LCD_SetTextColor(LCD_COLOR_WHITE); LCD_SetBackColor(LCD_COLOR_BLACK); LCD_DisplayStringLine(LINE(9),ch);

Reply
  • Hi. we are working on the project again for now four months. i made many changes to the project and the code is now very good but it is still not working very properly.

    uint8_t ch[10000];
    double timerValue1,timerValue2 ,delta, delta2;

    do { timerValue1 = TIM_GetCounter(TIM2); delta2 = delta1 + timerValue1;
    } while(GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_10)!=1) ; do { timerValue2 = TIM_GetCounter(TIM4);

    delta2 = delta2 + ch[53];
    } while(GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_10)!=1) ;
    delta= timerValue2- timerValue1;

    } sprintf(ch,"%lf seconds", (double)delta); LCD_SetTextColor(LCD_COLOR_WHITE); LCD_SetBackColor(LCD_COLOR_BLACK); LCD_DisplayStringLine(LINE(9),ch);

Children
No data