18M2 bytes used calculation?

ncoplin

Member
Hi, If I understand it correctly, given the 18M2 "shares" the eeprom memory with the code memory, shouldn't the following program report 259bytes used and not 3?

===============
eeprom 0,(1)
eeprom 255,(2)
===============

Presently it is a bit deceptive when the program code gets close to the (2048-256) bytes used and yet the PE and compilers report you have more space than really available.

Would be nice to fix in both PE and the command-line compilers please :)
Cheers, Nick
 

westaust55

Moderator
The reported 3 bytes is the “hidden” END command included by default at the end of all programs even if empty (unless the #NO_END directive is used).

With respect to your specific question and not having an M2 part in front of me at the moment,
What is the total space reported.

PICAXE manual 2 states:
PICAXE- 08M2 / 18M2
Program 1792 up to 2048 is EEPROM 255 to 0
So on 08M2/18M2 all bytes are available if program is shorter than 1792 bytes long.

But in the older M2 briefing note[/QUOTE] we see:
Code:
[B]PICAXE Feature       BASIC command   08M2  08M      08[/B]
Data EEPROM (bytes)  read / write    256   256-P   128-P
Suggesting that for the 08M2 (and by inference other M2 parts) that the EEPROM is no longer part of the program space but separate memory area.

Additionally the M2 briefing sheet addenda states:
Memory Capacity
The M2 parts now have up to 2048 bytes of program memory, which is 8x larger than the older M parts.
They also contain 256 bytes of data memory (read/write/eeprom commands).
But clarifications follows with:
On the 14M2 and 20M2 the program memory and data memory are separate (2048 + 256).
Due to more limited silicon resources on the 08M2/18M2 the upper 256 bytes are shared between program and
data (2048 in total). Therefore with programs that are under 1792 bytes long all 256 bytes of data memory are
available. Very long programs (over 1792 bytes) start to reduce the amount of data memory available.
See: eeprom, read, write
So, in summary, the 18M2 does share EEPROM and program space as does the 08M2.
 
Last edited:
Top