$VARIABLES | $V - Define the memory region for RAM variables

Language reference ›› Directives ››
Parent Previous Next

variables-directive = ( $VARIABLES | $V ) variable-address-range | DEFAULT .
variable-address-range = address-expression [ ( TO | ".." ) address-expression ] .        

Defines the RAM memory area to use for variables that will be allocated after this point (default is all available RAM).

The first parameter defines only the RAM start address, the optional second parameter defines the RAM top too (last usable address).

A check is made regarding to the processor configuration.

This directive is local to the current module.

Note: The possibility to have several $VARIABLES directives in a module is kept for historical reasons. As of version 2.0, PMP allocates variables at the moment of their first use in the code, not at the moment of their declaration, so if several $VARIABLES directives exist in a module, the last one will override all the previous ones.

{$VARIABLES $20 TO ($6F + SPECIAL_RAM_SIZE - 1) } // Restrict RAM area
{$VARIABLES DEFAULT} // Back to all available RAM