Programatic RESET is not working in atmega32a

Status
Not open for further replies.

veerubiji

Full Member level 2
Joined
Feb 24, 2011
Messages
122
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Activity points
2,301
Hi,

I am trying to reset atmega32a programmatically. It can be done with watchdog timer. In my case i am trying to reset the timer when i send some command from PC.

I have written code like this for that function.

Code:
case(RESET):        
            #asm("CLI");        //Disable global interrupt
            MCUSR = 0x00;
            #asm("WDR");
            WDTCR=0x1B;
            WDTCR=0x0B;
            while(1);           //Wait for reset
            Command = 0;
            break;
but this is not working, can anyone help me what i am doing wrong or how to reset ATmega32A programmatically. When i send "RESET" command from PC then it has to reset micro controller.
 

If watch dog resets these codes doesn't get executed.

WDTCR=0x1B;
WDTCR=0x0B;
while(1); //Wait for reset
Command = 0;

Is Watch Dog Timer enabled?
 

Is Watch Dog Timer enabled?[/QUOTE]

I am trying to enable and reset the controller and disable WDT in the same command. Is it possible? I have looked into the fuse bits about watchdog enabled or not i didn't find anything about.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…