1
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ Why do you believe that "nothing" happens? \$\endgroup\$ – Ignacio Vazquez-Abrams Jun 11 '15 at 6:14
  • \$\begingroup\$ I had a display which displays the value of variables. \$\endgroup\$ – Yash Jun 11 '15 at 6:15
  • \$\begingroup\$ Check initial pin state, RESET is generated on falling edge, so if your pin is in LOW state, and you set them again to LOW, nothing happen ofcourse. \$\endgroup\$ – user76920 Jun 11 '15 at 6:22
  • 3
    \$\begingroup\$ nRESET only resets the MCU and registers, not the SRAM or external peripherals. \$\endgroup\$ – Ignacio Vazquez-Abrams Jun 11 '15 at 6:23
  • 1
    \$\begingroup\$ @yash: You do not "write a code" (singular reference to a code in a cryptography / coding theory sense). You just "write [source] code". \$\endgroup\$ – Rev1.0 Jun 11 '15 at 8:31
2
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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