PDA

View Full Version : "Debug" pushing my modest program space over the edge



HankMcSpank
- 22nd May 2011, 23:07
At the minute I'm using a lowly 12lf1822...beucase it has the features I need.......with the small footprint.

I'm right on the edge of filling up the available 4096 kbytes, but I've noticed something peculiar (to me at least)

Consider the following...



debug dec temp ' output the contents of a variable

with the above enabled, my program compiles at 2010 words.

versus



debug "t" ' output the letter t.

but with the above enabled, my program compiles at just 1945 words.

so the former uses up 65 more 'words' of program space?!!!



Why would asking for the debug contents of a word variable apparently use up so much more program space?

HenrikOlsson
- 23rd May 2011, 06:08
Hi Hank,
When you Debug "t" the ASCII code for t is hardcoded into the PICs program memory and sent when the program execution reaches the Debug line.

When you do Debug DEC temp the debug routine first needs to convert the value stored in temp into ten-thousands, thousands, hundreds, tens and ones 'entities' and then convert the value of each of those 'entities' into its ASCII representation. When we are at this point it starts to be comparable to Debug "t".

/Henrik.

HankMcSpank
- 23rd May 2011, 21:06
Thanks Henrik...that explains it (where do pick all this stuff?!!)