Skip to main content
Visitor II
September 28, 2007
Question

WDG, free runing timer

  • September 28, 2007
  • 2 replies
  • 834 views
Posted on September 28, 2007 at 14:37

WDG, free runing timer

    This topic has been closed for replies.

    2 replies

    popov2004Author
    Visitor II
    September 28, 2007
    Posted on September 28, 2007 at 07:25

    Hi All,

    I am using the WDG free runing timer mode in order to make the couter counting 5s.

    I would like to print (begining) continue executing the programm, after 5 second print( END ).

    with out stopping executing the program.

    here is the code, could any one tell me where is the problem ?

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

    WDG_ECITConfig (ENABLE);

    WDG_CntOnOffConfig (ENABLE);

    WDG_PeriodValueConfig (5000000); /* 5 s*/

    /* EIC peripheral configuration -------------------------------------------*/

    EIC_IRQChannelPriorityConfig(WDG_IRQChannel, 1);

    EIC_IRQChannelConfig(WDG_IRQChannel, ENABLE);

    EIC_IRQConfig(ENABLE);

    hStatus = WDG_ECStatus();

    if (hStatus==1){

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

    WDG_ECFlagClear();

    }

    Visitor II
    September 28, 2007
    Posted on September 28, 2007 at 14:37

    Without trying to check if initialization sequence is correct, I can point out two things. First, do you need the watchdog interrupt for this? Seems not. Second, surely you should use a loop to check if the timer has expired, rather than an 'if' statement?

    while (WDG_ECStatus() != 1) { /* empty */ }

    printf(''whatever...'');