> > Is that why some people recommend clearing all RAM > > at start time? > > Yes. > > I don't subscribe to this philosophy myself. Any non-trivial PIC > programs I write tend to be composed of various modules I've written. > Each of my modules has its own initialization function, which > initializes all of the variables it uses. Zero isn't often the correct > value for initialization anyhow. snip > This is why some development tools offer a means to deliberately randomize > the RAM contents at reset. This makes it much more likely to find > uninitialized variables. I've used this in all my projects. It's a matter of approach. I also init my variables specifically, but I like the idea that if I ever forget, it will either work (because the init value is right for the app) or break, but it won't get out the door if it's going to break. Filling with randoms means to me, that it might get out the door, and work, then fail in the field... :( The way I do it is like this: After setting up the processor, I fill all ram with zeros. Then I fill various buffers with 1, 2, 3... so I can see them easily in debug. Then I initialize buffer pointers to show empty, and init any ram variables that I'm going to use to their proper values. This way, if I forget, (not happened yet :) the variable is set with a deterministic value, and the routine will either run or crash, and I can live with either outcome.