TABLE and slots

John Geddes

New Member
FAQs say:

"The PICAXE X2 parts include 256 bytes of table data, similar to EEPROM data memory but read-only."

Slot-users beware. The TABLE data is stored in Program memory. And if you are using multiple slots that means that TABLE data written in one slot cannot be accessed using READTABLE in a different slot.

By contrast, EEPROM data is shared across all slots, and can be written to in one slot, and read in another.

Not so "similar" then!

Has anyone found (or produced) a comprehensive table that shows what data is shared across slots and what is slot-specific?

John Geddes
 

hippy

Ex-Staff (retired)
Variables, Data/Eeprom, RAM (@bPtr), scratchpad (@ptr) and on-chip SFR are shared between slots.

Program Code and Table are slot specific.
 

westaust55

Moderator
A suggest that I am sure that Rev Ed can tweak the FAQ under the heading:
What is the memory capacity of a PICAXE?

to read:
The PICAXE X2 parts include 256 bytes of table data per program slot, similar to EEPROM data memory but read-only.

also the line:
The PICAXE X2 parts have 4096 bytes of program per program slot and a total of 256 bytes of EEPROM data memory which is accessible from all program slots.


and in the on-line manual at: http://www.picaxe.com/BASIC-Commands/Variables/table/

change:
X1 parts have 256 locations (0-255). X2 parts have 256 locations (0-255) per program slot. When table is used these reduce the overall program memory capacity of these parts (4096 - 256)
 

techElder

Well-known member
Wow! I'm going to start putting 10 slots in all of my programs! I could probably start sharing program bytes after awhile! <GRIN>

also the line: The PICAXE X2 parts have 4096 bytes of program per program slot and a total of 256 bytes of EEPROM data memory which is accessible from all program slots.

PS. Reminds me of the feller that got such good gas mileage on his new car that every 100 miles his gas tank overflowed!
 

Simmicht

Senior Member
Is it true that when you wish to put say, 4090 bytes of code into a slot ( and you have to remove any #NO_TABLE directives to do it) that the 256 of table data is used for code?
In other words can I program a slot with 4095 bytes of code AND use 256 bytes of table data as well?
I guess NO.
PS, I have an picaxe28X2 application that has all 4 slots full to the brim.... one mean program.
 

srnet

Senior Member
I have an picaxe28X2 application that has all 4 slots full to the brim.... one mean program.
Although there was answer in the on-line manual, if the slots are 'full to the brim', then you could of just added a table to one of these slots to see what happened.
 

Grogster

Senior Member
Am I correct in my assumption that slots are separate programs, but only ONE of them can be running at one time?

Lets say you have two programs(slot 0 and slot 1), and if you issue a run 1 from slot 0, the core jumps to slot 1 and starts executing that code from the start, and the execution of code in slot 0 stops until you execute run 0 from slot 1, whereby the code in slot 0 starts running from the start again - correct?
 

BeanieBots

Moderator
That's about right with the memory caveats already mentioned.
With a little trickery it is possible to jump around between slots to make them appear like one big program but only one slot at any one time.
 

Eclectica

Member
With a little trickery it is possible to jump around between slots to make them appear like one big program but only one slot at any one time.
:p reminds me of a page boundary nightmare in the old days of programming PIC16C57 in C back in 1997 (can't remember which compiler I was using): but if we overlapped a page boundary with an 'if' statement and the code jumped to the address on the wrong code page!

Bet this is sorted with the PICaxe compilers! Good work chaps!
E.
 

srnet

Senior Member
Its not that difficult to run a program in another slot in the same way as would a GOSUB, I just used some of the bit variables as flags, and checked for the flag as the first command in the program you are returning slot you are returning to. If the flag is set do a GOTO to the location just after the original RUN.

What would be useful is a form of GOSUBSLOT command, which would do this for you, useful even if the GOSUB\RETURN stack is not preserved when jumping between slots.
 
Top