Amin Khorsandi
Member level 2
- Joined
- Oct 12, 2013
- Messages
- 45
- Helped
- 5
- Reputation
- 10
- Reaction score
- 5
- Trophy points
- 8
- Activity points
- 293
Hi everyone. I wrote this program in codevision just for testing WDT (watchdog)
If I put nothing instead of "XXXXXXX" the watchdog works and resets the program.
But if I replace "XXXXXX" by "delay_ms(1);" , watchdog won't work and won't reset the program.
And the funny part, if I replace it by "delay_us(1000)" , watchdog will work and will reset the program.8-O
it means that "delay_ms(1)" and "delay_us(1000) are different :!::!::!:
please give me some recommendations.
Code:
#include <mega64.h>
#include <delay.h>
void main(void)
{
// Watchdog Timer initialization
// Watchdog Timer Prescaler: OSC/16k
#pragma optsize-
WDTCR=0x1F;
WDTCR=0x0F;
#ifdef _OPTIMIZE_SIZE_
#pragma optsize+
#endif
#asm("sei")
while (1)
{
xxxxxx
}
}
If I put nothing instead of "XXXXXXX" the watchdog works and resets the program.
But if I replace "XXXXXX" by "delay_ms(1);" , watchdog won't work and won't reset the program.
And the funny part, if I replace it by "delay_us(1000)" , watchdog will work and will reset the program.8-O
it means that "delay_ms(1)" and "delay_us(1000) are different :!::!::!:
please give me some recommendations.