学习单片机XDATA-- 单片机官方网站http://www.keil.com/support/man/docs/c51/c51_le_memtypes.htm
2012-04-09 22:58
841 查看
http://www.keil.com/support/man/docs/c51/c51_le_memtypes.htm
The Cx51 Compiler provides access to all 8051 memory areas. Variables may be explicitly assigned to a specific memory space (by including a memory type specifier in the declaration) or implicitly assigned (based on the memory model).
The following table summarizes the memory type specifiers you may use.
As with the signed and unsigned attributes, you may include memory type specifiers in the variable declaration. For example:
![](http://www.keil.com/support/man/docs/images/note.gif)
Note
For compatibility with previous versions of the C51 Compiler, you may specify the memory area before the data type. For example, the following two declarations are equivalent:
Nonetheless, this feature should not be used in new programs because it may not be supported in future versions of the Cx51 Compiler. Be careful when using the old C51 syntax with memory-specific pointers. For example, the following two declarations are equivalent:
Accessing the internal data memory is considerably faster than accessing the external data memory. For this reason, place frequently used variables in internal data memory. Place larger, less frequently used variables in external data memory.
If no memory type is specified for a variable, the compiler implicitly locates the variable in the default memory space determined by the memory model: SMALL, COMPACT, or LARGE. Function arguments and automatic variables that cannot be located in registers are also stored in the default memory area. Refer to Memory Models for more information.
![](http://www.keil.com/iconexp/16x16/plain/lightbulb_on.png)
Related Knowledgebase Articles
C51: INTERRUPTS AND LOCAL VARIABLES
The Cx51 Compiler provides access to all 8051 memory areas. Variables may be explicitly assigned to a specific memory space (by including a memory type specifier in the declaration) or implicitly assigned (based on the memory model).
The following table summarizes the memory type specifiers you may use.
Memory Type | 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; supports mixed bit and byte access (16 bytes). |
xdata | External data memory (64 KBytes); accessed by opcode MOVX @DPTR. |
far | Extended RAM and ROM memory spaces (up to 16MB); accessed by user defined routines or specific chip extensions (Philips 80C51MX, Dallas 390). |
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;
![](http://www.keil.com/support/man/docs/images/note.gif)
Note
For compatibility with previous versions of the C51 Compiler, you may specify the memory area before the data type. For example, the following two declarations are equivalent:
data char x; // Old-Style Memory Type Declaration char data x; // New-Style Memory Type Declaration
Nonetheless, this feature should not be used in new programs because it may not be supported in future versions of the Cx51 Compiler. Be careful when using the old C51 syntax with memory-specific pointers. For example, the following two declarations are equivalent:
data char *x; // Old-Style Memory Type Declaration char *data x; // New-Style Memory Type Declaration
Accessing the internal data memory is considerably faster than accessing the external data memory. For this reason, place frequently used variables in internal data memory. Place larger, less frequently used variables in external data memory.
If no memory type is specified for a variable, the compiler implicitly locates the variable in the default memory space determined by the memory model: SMALL, COMPACT, or LARGE. Function arguments and automatic variables that cannot be located in registers are also stored in the default memory area. Refer to Memory Models for more information.
![](http://www.keil.com/iconexp/16x16/plain/lightbulb_on.png)
Related Knowledgebase Articles
C51: INTERRUPTS AND LOCAL VARIABLES
相关文章推荐
- 一个学习编程技术的好网站-http://www.tutorialspoint.com/index.htm
- swift 苹果开发者cocoachina学习网站 http://www.cocoachina.com/swift/
- openjweb官方网站地址改为http://www.openjweb.com
- openjweb官方网站地址改为http://www.openjweb.com
- 大型网站架构学习笔记(转自http://www.cnblogs.com/xrq730/p/4954152.html)
- memcached 官方网站:http://www.danga.com/memcached/ —c++https://github.com/gwhalin/Memcached-Java-Client/downloads--java
- IntelliJ IDEA 官方网站 http://www.jetbrains.com/idea/
- 给大家推荐一个python的学习网站 http://www.codecademy.com
- 一个不错的Silverlight展示网站反编译后的源码和大家分享一下(http://www.microsoft.com/taiwan/student/Good.htm),很简单的
- (c++/clr 学习网址)http://www.functionx.com/vccli/index.htm
- 一个很好的编程学习网站(电子书,教程,经验分享等等):http://www.ccrun.com/index.asp
- 给大家推荐一个python的学习网站 http://www.codecademy.com
- 给大家推荐一个python的学习网站 http://www.codecademy.com
- 推荐一个WSS学习的好网站:http://wss.collutions.com and Http://www.wssdemo.com,本人决没有做广告的意思,只是觉得上面的东西不错。
- 新建学习娱乐网站 http://www.pnonline.com.cn
- 学习Swing和java不错的网站 强烈推荐http://www.javaworld.com/
- Sublime Text 官方网站 http://www.sublimetext.com
- (最好的多线程学习网站)http://www.yesky.com/20020129/215831.shtml
- Linux下/dev/mem和/dev/kmem的区别 本篇文章来源于 Linux公社网站(www.linuxidc.com) 原文链接:http://www.linuxidc.com/Linux
- http://www.itsoku.com 一个IT技术学习和分享的平台!