Many modern microcontrollers have on-chip debug modules which can be accessed via JTAG - these debug modules let you do stuff like stop a program in execution, examine registers/memory, single-step through the code etc.
It seems the working of the Atmega16 on-chip debug module is not completely documented - but Atmel has done one […]