Dear sir,
I am using ADUC842 for my design. I want to set watchdog timer of 2 sec for any errorneous condition.
In my main function, i have enabled all interrupts already...
I need to configure watchdog timer.
But before that i should disable all the interrupts,set the watchdog timer and again enable the interrupts. since i have enabled all interrupts,i cant configure watchdog timer in the main function.
where should i configure the watchdog timer ? pls help.
Regards, Mayuri G
But before that i should disable all the interrupts,set the watchdog timer and again enable the interrupts. since i have enabled all interrupts,i cant configure watchdog timer in the main function EA = 0 watchdog EA = 1
Erik
I have Serial ISR which needs to be executed whenever there is handshaking between my module and host.
For that only i have enabled all the interrupts in my main function... i am supposed to set watchdog timer too... watchdog timer will help the controller to come out of errorneous condition.
for setting watchdog timer,i should disable all the interrupts ,set the watchdog timer and then enable all the interrupts.
I cant do this...hope you have understood my problem...
regards mayuri
No. We have not understood your problem, for the simple reason that we don't see a problem.
1) You can enable the watchdog timer before you enable the other interrupts. 2) You can disable interrupts while playing with the watchdog - and there are multiple ways to do that.
So exactly what is your problem?
CLR EA //disable interrupts while writing
SETB WDWR //allow write to WDCON
MOV WDCON,#72H //enable WDT for 2.0s timeout
SETB EA //enable interrupts again (if rqd)
this is what i am supposed to write in my main function if i am using watchdog.
but if i clear my interrupts,den my ISRs wont be executed.
i need to keep my interrupts on always
CLR EA //disable interrupts while writing SETB WDWR //allow write to WDCON MOV WDCON,#72H //enable WDT for 2.0s timeout SETB EA //enable interrupts again (if rqd)
How long, exactly, do you think that code sequence takes to execute?
You only need to do it once- at startup.
Do you really think that it will make any significant difference if you do this immediately before you enable your other interrupts??
"if i clear my interrupts,den my ISRs wont be executed"
Until you enable them again!!
"i need to keep my interrupts on always"
See above - you only need to do this once, and only at the very start of your code - where is the problem in that?!
ok got it... thnx a lot...
View all questions in Keil forum