Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I am working with an ATmega128 and need to reset the microcontroller after some 10 seconds has passed and the user has not interacted with microcontroller. As an example when the user has not pressed any key from a keypad for 10 seconds the controller should get reset.

A watchdog timer is available in the ATmega128 but I am able to get a maximum of 2 seconds delay before it resets. But I require 10 seconds.

Maybe I can do it using timers but I don't know how to proceed?

share|improve this question
    
Even I tried with the Header file #include<avr/wdt.h> and used like: wdt_enable(WDTO_8S); wdt_reset(); But not got any response by these functions. I am working in Linux AVR-GCC. –  Sanju Feb 27 '13 at 8:06
    
Do you really need the system reset or could you just re-start the program from the top? –  John U Feb 27 '13 at 9:06
    
For timers - here is a good tutorial: avrfreaks.net/… –  Christoph Feb 27 '13 at 9:12
    
@JohnU: Thanks for your reply and Actually in my project I am asking user for password, if he enters wrong password it will be in that loop only until he gives right password. So what i need is if user not gave any input to the controller it should start from at top of the program. –  Sanju Feb 27 '13 at 11:37
2  
Another idea: Start a timer before accepting inputs from User, Reset that timer everytime user enters something... If user is inactive for given time, Timer will overflow... Set flag in timer and if that flag is set, break out from your "Accept Input" Loop! –  Swanand Feb 28 '13 at 9:11

1 Answer 1

Instead of using Watchdog timer for this purpose,

Start a timer before accepting inputs from User, Reset that timer everytime user enters something... If user is inactive for given time, Timer will overflow... Set flag in timer and if that flag is set, break out from your "Accept Input" Loop!

share|improve this answer
1  
Also note that ten seconds is a long time, and it may not be possible to stretch the hardware timer peripheral that far, of if you can could lock up a valuable timer and not allow it to be used for anything else. Having the timer interrupt perodically, say 1 seconds or less, and decrementing some sort of countdown may be a more optimum way to go. –  Chintalagiri Shashank Mar 5 '13 at 18:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.