www.久久久久|狼友网站av天堂|精品国产无码a片|一级av色欲av|91在线播放视频|亚洲无码主播在线|国产精品草久在线|明星AV网站在线|污污内射久久一区|婷婷综合视频网站

當(dāng)前位置:首頁(yè) > 單片機(jī) > 單片機(jī)
[導(dǎo)讀]SFR定義: sfr P5 = 0x85; /* PORT 5 */ 位尋址定義: sbit st_rs = P5^0; 編譯錯(cuò)誤: *** ERROR C146 IN LINE 320 OF C8051F020.H: 'P5' invalid base address KEIL FAQ:( http://www.keil.c

SFR定義:
sfr P5 = 0x85; /* PORT 5 */

位尋址定義:
sbit st_rs = P5^0;

編譯錯(cuò)誤:
*** ERROR C146 IN LINE 320 OF C8051F020.H: 'P5' invalid base address

KEIL FAQ:( http://www.keil.com/support/docs/1916.htm )

*QUESTION :

When I compile my program, I receive the following error message:

Error 146: Invalid Base Address

How do I fix this?

*ANSWER :

This error message indicates that the byte base address specified for an SBIT is not valid. The byte address of an SBIT must be an SFR whose least

significant nibble must be 0 or 8. For example:

sfr P1 = 0x90;
sbit P1_0 = P1^0; // This is valid

sfr P4 = 0xD1;
sbit P4_0 = P4^0; // This is NOT valid since P4 is not an a 0 or 8 boundary

For SFR addresses that are not bit-addressable, you might use standard AND and OR operations to access the indivitual SFR bits.

Example:

sfr P4 = 0xD1;

void test (void) {
if (P4 & 0x01) { // if bit 0 set
P4 |= 0x80; // set bit 7
}
else {
P4 &= ~0x02; // reset bit 1
}
}

原因:
( http://www.keil.com/forum/docs/thread7997.asp )
Non-8 divisible port addresses are not bit assignable. What genious decided that would be a good idea?

Goes all the way back to the original 8051 architecture decisions at Intel.

Bit instructions take one byte of address. Notice that there are 0x10 bytes of bit-addressable memory. The other addressable bits are in SFRs. You can

practically see the hardware guys tapping off the high bit in their address decoder. 0 -> RAM, 1 -> SFR.

Then, you have to decode the next 7 bits to an actual SFR. It's very simple to take bits 6:3 as the SFR address, and use bits 2:0 to select the

individual bit from that byte. That means the bits appear in every eighth SFR address, which is to say the addresses ending in 0 or 8.

Really simple circuit, even at the expense of strangeness at the software level. That's classic Intel design philosophy for you. Save gates where you can

and let the programmers deal with it.

解讀:
在SFR空間地址只有可被8整除的寄存器才可以進(jìn)行位尋址。
位尋址指令代碼使用一個(gè)字節(jié)表示,bit7= 1:片內(nèi)RAM,0:SFR,bit6~bit3= SFR寄存器地址,bit2~bit0=寄存器內(nèi)的位地址。
SFR空間內(nèi)只有16個(gè)寄存器是可以位尋址的,其它寄存器的位操作只能用(與)、(或)來(lái)操作。

本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除。
換一批
延伸閱讀

采用8051作為核心元件,構(gòu)成變速調(diào)溫控制系統(tǒng),適應(yīng)特殊的溫度曲線,而且采用不同的軟件系統(tǒng),可以適應(yīng)不同的工藝要求,具有良好的可移植性和擴(kuò)展性。本文給出了系統(tǒng)硬件和軟件的總體設(shè)計(jì)。

關(guān)鍵字: 8051 變速調(diào)溫系統(tǒng) 核心元件

CC2530 結(jié)合了領(lǐng)先的RF 收發(fā)器的優(yōu)良性能,業(yè)界標(biāo)準(zhǔn)的增強(qiáng)型8051 CPU,系統(tǒng)內(nèi)可編程閃存,8-KB RAM 和許多其它強(qiáng)大的功能。

關(guān)鍵字: cc2530 PWM 8051

  2014年6月11日訊——恩智浦半導(dǎo)體(NXP Semiconductors N.V.)(納斯達(dá)克代碼:NXPI)今天宣布推出全新的單級(jí)驅(qū)動(dòng)器數(shù)字IC系列,用于緊湊型

關(guān)鍵字: 8051 MCU 智能硬件

用8051控制報(bào)警產(chǎn)生實(shí)例

關(guān)鍵字: 8051 報(bào)警

單片機(jī)位尋址和不可位尋址

關(guān)鍵字: 不可位尋址 位尋址

MCS- 51系列單片機(jī)的指令系統(tǒng)是一種簡(jiǎn)明高效的指令系統(tǒng),其基本指令共有111條,其中單字節(jié)指令49條,雙字節(jié)指令4\'5條,三字節(jié)指令17條。如果按功能可以講這些指令分為五類:數(shù)據(jù)傳送類(29條)、算術(shù)操作類(24條...

關(guān)鍵字: 8051 單片機(jī) 指令系統(tǒng)

復(fù)位就是指通過某種手段使單片機(jī)內(nèi)部某些資源一種固定的初始狀態(tài),以確保單片機(jī)每次復(fù)位后都能在某一固定的環(huán)境中從某一固定的入口地址處開始運(yùn)行

關(guān)鍵字: 8051 單片機(jī) 復(fù)位狀態(tài)

單片機(jī)CPU與外部設(shè)備交換信息通常有如下幾種方式:無(wú)條件傳送方式,查詢傳送方式和中斷傳送方式。我們以單片機(jī)與微型打印機(jī)接口為例講述這三種方式。假定用戶要打印三個(gè)數(shù)據(jù),這三個(gè)數(shù)據(jù)保存在單片機(jī)的內(nèi)部數(shù)據(jù)存儲(chǔ)器10H,11H,...

關(guān)鍵字: 8051 單片機(jī) 數(shù)據(jù)傳輸方式

8051系列各種芯片的引腳是互相兼容的,8051,8751和8031均采用40腳雙列直播封裝型式。當(dāng)然,不同芯片之間引腳功能也略有差異。8051單片機(jī)是高性能的單片機(jī),因?yàn)槭艿揭_數(shù)目的限制,所以有不少引腳具有第二功能,...

關(guān)鍵字: 8051 單片機(jī) 引腳功能

P1口也是一個(gè)準(zhǔn)雙向口,作通用I/O使用。

關(guān)鍵字: 8051 p1口 單片機(jī) 端口結(jié)構(gòu)
關(guān)閉