hardware constants reset?

Hi all,
Before I start to mess around with timers and counters and such, I would like to know if Mega2560 resets the constants I change in hardware … or if I have to keep track of exactly what is changed. I’m hessitant on going to it as I don’t know initial values. I’ve downloaded the Atmel datasheet … it’s a lengthy story, so I’m not left all alone on my own devices. But I’ll skip it if Mega2560 resets itself.

Hi,

What is an example of these hardware constants, as you phrase it?

Geoff

The Arduino cookbook (Michael Margolis) has an example of changing a Timer's PWM frequency. It changes the value of TCCR0B, TCCR1B, TCCR2B & TCCR1A Other examples toggles TCNT1, TIMSK1, ICIE1, ADCSRA & PORTD

All registers of that ilk are stored in RAM.

When power is lost and reapplied the contents of the registers are placed into a default known state (see the data sheet).

If you press the reset button, then the default power-on states are loaded.

If you reset the device using the watchdog timer, then the same default power-on states are loaded.

If you restart your program by calling

asm("goto 0");

then the states are not affected (as this isn't a true reset - just a "go to the beginning" instruction).

When power is lost and reapplied the contents of the registers are placed into a default known state (see the data sheet).

Just what I would like to hear. Thanks majenko.

Carsten53T: The Arduino cookbook (Michael Margolis) has an example of changing a Timer's PWM frequency. It changes the value of TCCR0B, TCCR1B, TCCR2B & TCCR1A Other examples toggles TCNT1, TIMSK1, ICIE1, ADCSRA & PORTD

You got your answer, but just to be clear. Those are not "constants." They are registers, which are mapped into the memory space. They are physical hardware inside the microprocessor. Not variables.