20m2 slot size?

jims

Senior Member
Does each of the 20m2 slots have 2048 bytes (total of 4096 bytes in the chip)? Thank you, JimS
 

PhilHornby

Senior Member
Yes.

I've never actually used a 20M2 in anger, but I do have one, so I put it in the breadboard and tried loading a slightly modified 14M2 program. Slot 0 + Slot 1 both appeared to load successfully.
 

inglewoodpete

Senior Member
I found the secret hidden away in PE6.pdf. The program flash area in 14M2, 18M2+ and 20M2 can be doubled when PE6 is used with the appropriate code and directives. It may be documented elsewhere but I don't know where.
 

AllyCat

Senior Member
Hi,

PE6 or the Simulator are usually the quickest way to answer such questions. Type #SLOT 0 into the PE, hit the syntax check and it will respond "Compiled successfully. Memory Used = 3 out of 2048 bytes". Change that to #SLOT 1 for the same result, but any other number gives the response "#slot - 20M2 only has slots 0 and 1!".

Each slot also has its own 512 bytes of TABLE memory, but AFAIK they share the 256 bytes of EEPROM/DATA and 512 bytes of RAM. Also, as I discovered recently, there can be effectively rather more than 2048 Program bytes in each slot!

Cheers, Alan.
 

jims

Senior Member
pete...this quote is from the top of page 4 in the PDF...is this what you mean? So, are there really 2048 * 2 (4096) bytes available on a 20m2 using slots? 2048 bytes in each of the 2 slots?? Thank you, JimS
"Second additional program slot for 14M2, 18M2+ and 20M2 parts, effectively doubling their
program capacity."
 

lbenson

Senior Member
Yes, there are two slots of 2048 bytes in the 14M2, 18M2+, and 20M2s. Easy to test, as stated in post 2.
 

inglewoodpete

Senior Member
pete...this quote is from the top of page 4 in the PDF...is this what you mean? So, are there really 2048 * 2 (4096) bytes available on a 20m2 using slots? 2048 bytes in each of the 2 slots?? Thank you, JimS
"Second additional program slot for 14M2, 18M2+ and 20M2 parts, effectively doubling their
program capacity."
Yes 2 x 2048 bytes. If you haven't worked with PICAXE slots before, you'll find that they're not the most convenient things to work with.

If you are using interrupts, you will need to have your interrupt routine code in both slots, since execution does not jump between slots easily. I have only used multi-slot working with 28X2 and 40X2. If the M2s' slot management is the same as the X2s, you will need to structure your code carefully to avoid jumping between slots to often.

I'm not sure what your project does but, since your are using a 20M2, I would suggest you consider switching to a 20X2. It is a more sophisticated chip and, in your case, it has 4096 contiguous bytes in one slot. Practically all of your 20M2 code should port over to the 20X2.
 
Top