By including a memory type specifier in the variable declaration, you may specify where variables are stored . The following table summarizes the available memory type specifiers.
Description |
|
code |
program memory (64 KBytes); accessed by opcode MOVC @A+DPTR |
data |
directly addressable internal data memory; fastest access to variables (128 bytes) |
idata |
indirectly addressable internal data memory; accessed across the full internal address space (256 bytes) |
bdata |
bit-addressable internal data memory; allows mixed bit and byte access (16 bytes) |
xdata |
external data memory (64 KBytes); accessed by opcode MOVX @DPTR |
pdata |
paged (256 bytes) external data memory; accessed by opcode MOVX @Rn |
char data var1;
char code text[] = "ENTER PARAMETER:";
unsigned long xdata array[100];
float idata x,y,z;
unsigned int pdata dimension;
unsigned char xdata vector[10][4][4];
char bdata flags;
NOTE
C51 allows you to specify the memory type even before the type
declarator. For this reason, the declaration data char x; is
equivalent to the declaration char
data x.