The role of data, idata, xdata, startup.a51 in the microcontroller

Publisher:brian808090Latest update time:2015-03-24 Source: diangonKeywords:MCU  data  idata  xdata  startup  a51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  data:

  Fixed refers to the first 128 RAMs from 0x00 to 0x7f, which can be read and written directly using acc, with the fastest speed and the smallest generated code.

  idata:

  Fixed refers to the first 256 RAMs from 0x00 to 0xff, of which the first 128 are exactly the same as the 128 of data, but the access method is different. idata is accessed in a similar way to pointers in C. The statement in assembly is: mox ACC, @Rx. (Unimportant supplement: pointer access to idata in C works very well)

  xdata:

  External expansion RAM, generally refers to the external 0x0000-0xffff space, accessed with DPTR. pdata: The lower 256 bytes of external expansion RAM, read and write when the address appears on A0-A7, read and write with movx ACC,@Rx. This is quite special, and C51 seems to have a bug for this, so it is recommended to use it less. But it also has its advantages. The specific usage belongs to the intermediate problem, so it is not mentioned here.

  What startup.a51 does

  Just like assembly, the variables and arrays defined in C are initialized in startup.a51. If you define a global variable with a value, such as unsigned char data xxx="100", there will be a related assignment in startup.a51. If there is no =100, startup.a51 will clear it to 0. (startup.a51 == variable initialization). After these initializations are completed, the SP pointer will also be set. There will be no assignment or clearing of non-variable areas, such as the stack area.

  Some people like to modify startup.a51 to satisfy their own hobbies. This is unnecessary and may be wrong. For example, when power-off protection is activated, you want to save some variables, but modifying startup.a51 is a stupid way to achieve this. In fact, you can just use the characteristics of the non-variable area and define a pointer variable to point to the lower part of the stack: 0xff. Why do you still need to modify it? It can be said that you don't need to modify startup.a51 at any time if you understand its characteristics.

Keywords:MCU  data  idata  xdata  startup  a51 Reference address:The role of data, idata, xdata, startup.a51 in the microcontroller

Previous article:Several difficult concepts to grasp in single chip microcomputer learning
Next article:What is a MCU emulator? Principles of MCU emulator

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号