Differences between keywords data, idata, xdata, and pdata in Single-Chip Microcomputer

Source: Internet
Author: User
Data:
Fixed refers to the first 128 Ram records of 0x00-0x7f, which can be directly read and written using ACC, with the fastest speed and generated CodeMinimum.

Idata:
It is fixed that the first 256 Ram records of 0x00-0xff are identical to the first 128 records of data, but the access method is different. Idata is accessed using pointers similar to those in C. The statement in the Assembly is mox acc, @ Rx. (It is not important to add: idata in C performs pointer access well)

Xdata:
External extended RAM refers to the external 0x0000-0xffff space, which is accessed by dptr. Pdata: The External extended RAM's 256-byte-low, read-write when the address appears on the A0-A7, read-write with movx ACC, @ Rx. This is special, and the C51 seems to have this bug. We recommend that you use it less. But it also has its advantages. The specific usage is an intermediate issue, which is not mentioned here.

Role of startup. A51
Like assembly, the variables and arrays defined in C are initialized at startup. a51. If you have a numerical value when defining a global variable, such as unsigned char data xxx = "100";, startup. there will be related values in A51. If it is not set to 100, startup. A51 clears the value 0. (Startup. A51 = variable initialization ). After initialization, the SP pointer is set. Non-variable areas, such as the stack area, will not be assigned or cleared.
Some people like to change startup. A51. This is not necessary and may be wrong to satisfy their own interests. For example, you want to save some variables when the power is down, but change the value to startup. a51 is a very stupid method. In reality, you only need to use the features of the non-variable area to define a pointer variable pointing to the lower part of the stack: 0xff ., Why do we need to modify it? This can be said: you do not need to change startup. A51 at any time. If you understand its features

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.