Hi Steve,
If you look at the datasheet for the 18F1220, section 4.0 you'll find the following:If you look further into that section you'll find a long a list of the Special Function Registers and what state they are in at POR and other types of resets. But, I hear you say, that's not the RAM where my variables are stored is it? Well, if you look at figure 5-6 (Data Memory Map) you'll see that the SFRs (all the peripheral control registers etc) and the general purpose RAM (where your declared variables are stored) are all just registers within the same block of volatile memory - which then brings as back to the quote from the Reset section: Their status is unknown on POR and unchanged by all other Resets.Most registers are unaffected by a Reset. Their status
is unknown on POR and unchanged by all other
Resets. The other registers are forced to a “Reset
state”, depending on the type of Reset that occurred.
Another useful hint, not directly related to variables in RAM but anyway, which I learned from Darrel (of course) not too long ago is that if you look at any register for any peripheral or what not there's a note above each bit where it says for example R/W-1 this means that that particular bit in that particular register is Readable and Writeable AND that it's POR state is 1. If you look at the CONFIG Words it might say R/P-1 which means it's Readable, Programable (but not writable at runtime) and it's erased state (since this is program memory, not RAM) is 1.
Does that make sense?
/Henrik.
Certainly does make sense. Thanks yet again Henrik.
Steve Earl www.datageo.co.uk
Bookmarks