C51 的幾個資料區定義和用法

來源:互聯網
上載者:User

1。簡介:
在51系列中data,idata,xdata,pdata的區別
data:固定指前面0x00-0x7f的128個RAM,可以用acc直接讀寫的,速度最快,產生的程式碼也最小。
idata:固定指前面0x00-0xff的256個RAM,其中前128和data的128完全相同,只是因為訪問的方式不同。idata是用類似C中的指標方式 訪問的。彙編中的語句為:mox ACC,@Rx.(不重要的補充:c中idata做指標式的訪問效果很好)
xdata:外部擴充RAM,一般指外部0x0000-0xffff空間,用DPTR訪問。
pdata:外部擴充RAM的低256/或者是128個位元組,地址出現在A0-A7的上時讀寫,用movx ACC,@Rx讀寫,pdata可以看成是xdara區的前面的一塊地區。

2。用法:
2。1 xdata 區和pdata區的用法
基本上一樣的,不同的只是資料區的範圍不同。可以被用於擴充的RAM,或者是擴充的特殊功能寄存器。
在Myson的51單片機,是這樣描述:
擴充的RAM:Auxiliary RAM (AUXRAM)There are total 768 bytes auxiliary RAM allocated in the 8051 external RAM area 800h - AFFh. Program can use "MOVX" instruction to access the AUXRAM.
擴充的特殊功能寄存器:External Special Function Registers (XFR)The XFR is a group of registers allocated in the 8051 external RAM area F00h - FFFh. These registers are used
for OSD control or other special function. Program can use "MOVX" instruction to access these registers.
因為是地址統一編的,所以,這兩種AUXRAM&XFR用法也是一樣的。

關鍵是,在C51中,有兩種不同的處理方法:
2。1。1 直接把它看成是一塊數組來操作。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.