Well, when I didn't define the question correctly I got what I asked for. What I should have asked was, do both constants and variables use up memory or resources when programs compile or execute?
According to what I've read in the PBP3 manual, the answer for constants is they don't use memory of the micro-controller. They make substitutions during compile which I would assume uses less program bits.
Variables do use memory and depending how they are defined they can use a goodly portion. I assume that if a variable is defined as a word and you're only using a few bits you'd be wasting space. Better off defining it as a byte or using a small routine to store those bits as part of a larger word/byte. So if you're trying to save memory for other things, and your variable doesn't need to change, then defining it as a constant would free up RAM to be used elsewhere.
I've yet to write a program where I'm concerned about memory but I figure I'd start with good habits. Especially ones that let me program more efficiently.
Thanks for making me read the manual. It really is a wealth of info.
Bookmarks