51单片机中data、idata、xdata、pdata数据存储控制关键字之间区别

mac2024-12-14  26

data

The data memory type may be used to declare variables only. You may not declare data functions. This memory is directly accessed using 8-bit addresses and is the on-chip RAM of the 8051. It has the shortest (fastest) access time but the amount of data is limited in size (to 128 bytes or less).

Variables declared data are located in the DATA memory class.

Declare data variables as follows:

unsigned char data fast_variable;

idata

The idata memory type may be used to declare variables only. You may not declare idata functions. This memory is indirectly accessed using 8-bit addresses and is the on-chip RAM of the 8051. The amount of idata is limited in size (to 256 bytes or less). The lower addresses of idata overlap the corresponding addresses of data memory.

Variables declared idata are located in the IDATA memory class.

Declare idata variables as follows:

unsigned char idata variable;

xdata

The xdata memory type may be used to declare variables only. You may not declare xdata functions. This memory is indirectly accessed using 16-bit addresses and is the external data RAM of the 8051. The amount of xdata is limited in size (to 64K or less).

Variables declared xdata are located in the XDATA memory class.

Declare xdata variables as follows:

unsigned char xdata variable;

pdata

The pdata memory type may be used to declare variables only. You may not declare pdata functions. This memory is indirectly accessed using 8-bit addresses and is one 256-byte page of external data RAM of the 8051. The amount of pdata is limited in size (to 256 bytes).

Variables declared pdata are located in the PDATA memory class.

Declare pdata variables as follows:

unsigned char pdata variable;

 

最新回复(0)