18M2 shared data and programme memory

roho

Member
Hi all,

Can I check that I understand the rules on memory usage for an 18M2? The compiler reports that the programme uses 2025 bytes, and this contains instructions to write to EEPROM addresses 0x00 to 0x0B inclusive (as well as READ and WRITE instructions for the same addresses). According to the user manual for the EEPROM command, I should still have 2048 - 2025 = 23 bytes of data memory available, of which I'm using the bottom 12 bytes. This shouldn't be a conflict: am I correct?

The reason I'm asking is that the programme isn't behaving as expected and debugging is proving difficult due to its size (I cannot add too many SERTXD commands) and I want to eliminate this as a potential problem.
 

hippy

Technical Support
Staff member
Sounds right. You can test the theory by creating an artificially large program which uses part of the shared EEPROM, and check to see if you can alter location 0 etc. For example -
Code:
#Picaxe 18M2
#Terminal 4800

Eeprom 0, (0)

#Define TEXT "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"

LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9
LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9
LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9
LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9
LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9
LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9 : LookUp b9,(TEXT,TEXT),b9

Do
  Read 0, b0
  If b0 = b1 Then
    SerTxd( #b0, " " )
  Else
    SerTxd( "FAIL " )
  End If
  b1 = b1 + 1
  Write 0, b1
Loop
 

roho

Member
Thanks Hippy, it seems that I do not have a problem. After some more debugging, it looks like I've got to the root of the problem.
 
Top