Skip to main content

Timeline for code not following the procedure

Current License: CC BY-SA 3.0

9 events
when toggle format what by license comment
Sep 14, 2016 at 9:50 comment added Lundin @pranjalkhanduri In 99.9% of all applications, it doesn't make any sense to programmatically disable the watchdog. Instead, if you don't want to use it, never enable it. Professional programmers use debug build vs release build.
Sep 12, 2016 at 12:02 comment added John Burger Once the WDE bit is turned on, it is very difficult to turn it off again (by design) - read your microprocessor manual to find out how. Naïvely turning off the bit won't do it.wdt_disable() is obviously doing the correct "secret magic" to do the right thing - so if you never turn it on, you won't have the problem.
Sep 12, 2016 at 11:57 vote accept pranjal khanduri
Sep 12, 2016 at 11:56 comment added pranjal khanduri The wdt is getting disable correctly with wdt_disable command.i even tried both the line u have told, still was jumping to main function.i really wanna knw the reason why this was happening.
Sep 12, 2016 at 11:46 comment added John Burger Whoops! I wasn't thinking. My line should have been WDTCSR &= ~(1<<WDE|1<<WDIE);
Sep 12, 2016 at 11:41 comment added pranjal khanduri sir i instead of using this command WDTCSR|=0<<WDE|0<<WDIE; i used wdt_disable to disable the wdt.now it not jumping to main function. it is just exiting the inner while loop.(i also omit the bug you talked about) The reason m not getting because in data sheet what i read if we set WDE bit && WDIE bit of WDTCSR to 0(zero),the wdt will stop and no action at the time of timeout.but when i used the predefined command it works why?
Sep 12, 2016 at 11:34 comment added John Burger That is even worse. It does absolutely nothing: you are ORing 0 into a variable, which leaves... exactly the same value. If you want to zero those variables, you need to instead do WDTCSR &= ~(0<<WDE|0<<WDIE); - or not set them in the first place...
Sep 12, 2016 at 11:31 comment added pranjal khanduri sir i instead of using this command WDTCSR|=0<<WDE|0<<WDIE;
Sep 12, 2016 at 10:54 history answered John Burger CC BY-SA 3.0