注册 登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

碧空雄鹰的博客

人和人相遇,靠的是一种缘;人和人相处,靠的是一份诚;人和人相爱,靠的是一份真

 
 
 

日志

 
 
关于我

人生有三样东西是无法隐瞒的:咳嗽、贫穷和爱,你想隐瞒,却欲盖弥彰。 人生有三样东西是不该挥霍的:身体、金钱和爱,你想挥霍,却得不偿失。 人生有三样东西是无法挽留的:生命、时间和爱,你想挽留,却渐行渐远。 人生五靠: 命运不是靠时间,而是靠勤奋,时间不是靠虚度,而是靠使用,感情不是靠缘分,而是靠珍惜,金钱不是靠使用,而是靠投资,事业不是靠满足,而是靠踏实。 人生三大遗憾 : 不会选择,不坚持选择,不断地选择。

Memory Types  

2013-05-12 16:41:04|  分类: KEIL |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

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 TypeDescription
codeProgram memory (64 KBytes); accessed by opcode MOVC @A+DPTR.
dataDirectly addressable internal data memory; fastest access to variables (128 bytes).
idataIndirectly addressable internal data memory; accessed across the full internal address space (256 bytes).
bdataBit-addressable internal data memory; supports mixed bit and byte access (16 bytes).
xdataExternal data memory (64 KBytes); accessed by opcode MOVX @DPTR.
farExtended RAM and ROM memory spaces (up to 16MB); accessed by user defined routines or specific chip extensions (Philips 80C51MX, Dallas 390).
pdataPaged (256 bytes) external data memory; accessed by opcode MOVX @Rn.

As with the signed and unsigned attributes, you may include memory type specifiers in the variable declaration. For example:

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

  • 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: SMALLCOMPACT, 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.


  评论这张
 
阅读(215)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018