[moved] how to reset ATmega32 with code?

Status
Not open for further replies.
Hi,

Please give useful informations: You ask for code, thus we need to know:
* what programming language
* what compiler

*****
Generally there are several options:
* add external hardware to temporarily pull down the RESET line. (This may also reset external devices)
* enable the watchdog and wait for the watchdog timeout ( this just resets the microcontroller)
* jump to the reset vector location (this just restarts the software without resetting periferal registers)

Klaus
 
Reactions: disjk

    disjk

    Points: 2
    Helpful Answer Positive Rating
c language.
with atmel studio app.
but i cant use hardware for reset mcu!
and my code have a few while(1)! so i cant use watchdog!
 

Hi,

my code have a few while(1)! so i cant use watchdog!
You want to reset the microcontroller with code. A watchdog generates a true microcontroller reset. I don't see why this can't be used.
I don't see what this has to do with while(1) loops.

Klaus
 

AVR watchdog can be enabled at any time by control register. It's the preferred way to perform a programmed reset.
 

It is not preferred, it is only one way to do that
Almost agreed. It's a more theoretical option to set all processor register to reset state and jump to reset vector.
 

Hi,

Almost agreed. It's a more theoretical option to set all processor register to reset state and jump to reset vector.
If it's not possible to activate the RESET pin, then it's the only way for a true microcontroller RESET.
Or is there any other solution (that I don't know yet)?

Klaus
 

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