cancel
Showing results for 
Search instead for 
Did you mean: 

System timer and ADC

aeolia_amha
Associate II
Posted on June 10, 2010 at 10:04

System timer and ADC

1 REPLY 1
aeolia_amha
Associate II
Posted on May 17, 2011 at 13:54

I think the problem occurs because The time show function has an infinite loop which is while(1), because it is infinite, I cannot go to other functions below it. I need to get the current time and display it using USART and at the same time do other functions like getting data from ADC and outputting high or low from GPIO pins. What is your suggestion for this?

Here is a summary of my code

int main()

{

//configuration set up and others

  /* Display time in infinite loop */

  Time_Show();

//ADC data or any function

}

void Time_Show(void)

{

  printf(''\n\r'');

 

  /* Infinite loop */

  while (1)

  {

    /* If 1s has paased */

    if(TimeDisplay == 1)

    {   

      /* Display current time */

      Time_Display(RTC_GetCounter());

      TimeDisplay = 0;

    }

  }

}