Electronic – RESET(bar) Pin of ATmega16

atmegaavrreset

The datasheet says that an External Reset is generated by a low level on the RESET pin. And after reset all my conditions and values will be set to initial values.
I have connected the Reset(bar) pin to ground via a switch. After running the code for some time, I press the switch and give ground to Reset. But, nothing happens.

Can anyone tell me why this occured ?? Do I have to write a code?

Best Answer

Not everything gets cleared on a reset, only the specified bits in the specified registers get set to the initial values given in the data sheet.

You can detect what kind of reset just happened (power on, external, watchdog, etc) by checking the reset flag bits in the MCUCSR register at the very start of your program. Pulling the RESET pin low will generate an "external" reset, so the EXTRF flag will be set when your code starts executing after the RESET pin is released.