2007-09-28 05:37 AM
2007-09-27 10:25 PM
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(); }2007-09-28 05:37 AM
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...'');