$SPACE | $S - Switch memory allocation to RAM or EEPROM

$SPACE | $S - Switch memory allocation to RAM or EEPROM

Language reference ›› Directives ››
Parent Previous Next

space-directive = ( $SPACE | $S ) RAM | EEPROM | DUAL ( CTRL | DATA ) .


Define where the next variables will be allocated, in RAM or in EEPROM.


RAM defines that variables are generated in RAM area after this point (default).

EEPROM defines that the variables are generated in EEPROM area after this point.

NEW! (V2.1):

DUAL CTRL defines that variables are generated in a RAM area declared as $DUAL CTRL.

DUAL DATA defines that variables are generated in a RAM area declared as $DUAL DATA.



Default is RAM.



{$SPACE EEPROM}
VAR
 EE_SAVED_INDEX: BYTE; // in EEPROM
CONST // end of VAR section implies an implicit $SPACE RAM
 EE_VALUE = 0; // constant
VAR
 EE_INDEX: BYTE; // in RAM