Program size changes between PE 5.5.5 and 6

cpedw

Senior Member
I have a long program using an 18M2. When I syntax check with PE 6 it reports 2037 bytes used but 5.5.5 says 2048, which is a shame since I'm also using 2 bytes of EEPROM to read and write a word.

Both editors refuse to program the chip, Error: Data EEPROM memory location already used!

From reading other threads, I get the impression that PE6 works on the basis that it's an 18M2+ even though the program includes #picaxe 18M2. Is that right?

And does the + really squeeze the program into fewer bytes?

Thanks,
Derek
 

hippy

Technical Support
Staff member
There is only one compiler for the 18M2 and 18M2+, so it syntax checks as if for an 18M2+ and then sorts out whether it is an 18M2 or 18M2+ when it downloads. The discrepancies in the bytes used count is probably a result of slightly different compilers being used for PE5 and PE6. It could be that the compilers are generating slightly different code.

The older 18M2 has 2048 bytes of program memory but that is shared with EEPROM. Using EEPROM will take away bytes from program memory. That is possibly the issue with the Data EEPROM memory location already used error you see.
 

AllyCat

Senior Member
Hi,

There are usually plenty of ways to reduce code size. Both the PEs insert "macros" which can be quite large, so using subroutines can help. In particular PWMDUTY and BINTOASCII, etc. can be particularly greedy of program memory. It depends what your program actually does.

Cheers, Alan.
 

bpowell

Senior Member
Serial output is a real space hog as well.

I've made subroutines to SerOut the parts of a message that are repeated...for instance, I had:

Inside Temp: xx C
Outside Temp: xx C

And I made a subroutine to SerOut "side Temp: " so I didn't have to store those same 11 bytes in my code twice!

Also, you could preload serial strings into the EEPROM, and just stream them out from there...that would be a great way to save space.
 
Top