2023年全國碩士研究生考試考研英語一試題真題(含答案詳解+作文范文)_第1頁
已閱讀1頁,還剩14頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、<p><b>  中文4236字</b></p><p><b>  譯文:</b></p><p>  AT89S52單片機(jī)</p><p>  at89s52是美國ATMEL公司生產(chǎn)的低電壓,高性能CMOS8位單片機(jī),片內(nèi)含4Kbytes的快速可擦寫的只讀程序存儲(chǔ)器(PEROM)和128 bytes 的隨機(jī)

2、存取數(shù)據(jù)存儲(chǔ)器(RAM),器件采用ATMEL公司的高密度、非易失性存儲(chǔ)技術(shù)生產(chǎn),兼容標(biāo)準(zhǔn)MCS-51產(chǎn)品指令系統(tǒng),片內(nèi)置通用8位中央處理器(CPU)和flish存儲(chǔ)單元,功能強(qiáng)大at89s52單片機(jī)可為您提供許多高性價(jià)比的應(yīng)用場合,可靈活應(yīng)用于各種控制領(lǐng)域。</p><p><b>  主要性能參數(shù):</b></p><p>  與MCS-51產(chǎn)品指令系統(tǒng)完全兼容&l

3、t;/p><p>  4K字節(jié)可重復(fù)寫flash閃速存儲(chǔ)器</p><p><b>  1000次擦寫周期</b></p><p>  全靜態(tài)操作:0HZ-24MHZ</p><p><b>  三級(jí)加密程序存儲(chǔ)器</b></p><p>  128*8字節(jié)內(nèi)部RAM</p

4、><p>  32個(gè)可編程I/O口</p><p>  2個(gè)16位定時(shí)/計(jì)數(shù)器</p><p><b>  6個(gè)中斷源</b></p><p>  可編程串行UART通道</p><p>  低功耗空閑和掉電模式</p><p><b>  功能特性概述</b&

5、gt;</p><p>  AT89S52提供以下標(biāo)準(zhǔn)功能:4K 字節(jié)flish閃速存儲(chǔ)器,128字節(jié)內(nèi)部RAM,32個(gè)I/O口線,兩個(gè)16位定時(shí)/計(jì)數(shù)器,一個(gè)5向量兩級(jí)中斷結(jié)構(gòu),一個(gè)全雙工串行通信口,片內(nèi)振蕩器及時(shí)鐘電路。同時(shí),at89s52可降至0HZ的靜態(tài)邏輯操作,并支持兩種軟件可選的節(jié)電工作模式??臻e方式停止CPU的工作,但允許RAM,定時(shí)/計(jì)數(shù)器,串行通信口及中斷系統(tǒng)繼續(xù)工作。掉電方式保存RAM中的內(nèi)容

6、,但振蕩器停止工作并禁止其它所有部件工作直到下一個(gè)硬件復(fù)位。</p><p><b>  方框圖</b></p><p><b>  引腳功能說明</b></p><p><b>  Vcc:電源電壓</b></p><p><b>  GND:地</b>

7、</p><p>  P0口:P0口是一組8位漏極開路型雙向I/O口,也即地址/數(shù)據(jù)總線復(fù)位口。作為輸出口用時(shí),每位能吸收電流的方式驅(qū)動(dòng)8個(gè)邏輯門電路,對端口寫“1”可 作為高阻抗輸入端用。</p><p>  在訪問外部數(shù)據(jù)存儲(chǔ)器或程序存儲(chǔ)器時(shí),這組口線分時(shí)轉(zhuǎn)換地址(低8位)和數(shù)據(jù)總線復(fù)用,在訪問期間激活內(nèi)部上拉電阻。</p><p>  P1口:P1是一個(gè)帶內(nèi)部

8、上拉電阻的8位雙向I/O口,P1的輸出緩沖級(jí)可驅(qū)動(dòng)(吸收或輸出電流)4個(gè)TTL邏輯門電路。對端口寫“1”,通過內(nèi)部的上拉電阻把端口拉到高電平,此時(shí)可做熟出口。做輸出口使用時(shí),因?yàn)閮?nèi)部存在上拉電阻,某個(gè)引腳被外部信號(hào)拉低時(shí)會(huì)輸出一個(gè)電流(Iil).</p><p>  Flash編程和程序校驗(yàn)期間,P1接受低8位地址。</p><p>  P2口:P2是一個(gè)帶有內(nèi)部上拉電阻的8位雙向I/O口

9、,P2的輸出緩沖級(jí)可驅(qū)動(dòng)(吸收或輸出電流)4個(gè)TTL邏輯門電路。對端口寫“1”,通過內(nèi)部地山拉電阻把端口拉到高電平,此時(shí)可作為輸出口,作輸出口使用時(shí),因?yàn)閮?nèi)部存在上拉電阻,某個(gè)引腳被外部信號(hào)拉低時(shí)會(huì)輸出一個(gè)電流(Iil)。</p><p>  在訪問外部程序存儲(chǔ)器獲16位地址的外部數(shù)據(jù)存儲(chǔ)器(例如執(zhí)行 MOVX @DPTR指令)時(shí),P2口送出高8位地址數(shù)據(jù)。在訪問8位地址的外部數(shù)據(jù)存儲(chǔ)器(如執(zhí)行 MOVX @R

10、I指令)時(shí),P2口線上的內(nèi)容(也即特殊功能寄存器(SFR)區(qū)中R2寄存器的內(nèi)容),在整個(gè)訪問期間不改變。</p><p>  Flash編程或校驗(yàn)時(shí),P2亦接受高地址和其它控制信號(hào)。</p><p>  P3口:P3口是一組帶有內(nèi)部上拉電阻的8位雙向I/O口。P3口輸出緩沖級(jí)可驅(qū)動(dòng)(吸收或輸出電流)4個(gè)TTL邏輯門電路。對P3口寫入“1”時(shí),他們被內(nèi)部上拉電阻拉高并可作為輸出口。做輸出端時(shí)

11、,被外部拉低的P3口將用上拉電阻輸出電流(Iil)。P3口除了作為一般的I/O口線外,更重要的用途是它的第二功能,如下表所示:</p><p>  P3口還接收一些用于flash閃速存儲(chǔ)器編程和程序校驗(yàn)的控制信號(hào)。</p><p>  RST:復(fù)位輸入。當(dāng)振蕩器工作時(shí),RST引腳出現(xiàn)兩個(gè)機(jī)器周期以上高電平將使單片機(jī)復(fù)位。</p><p>  ALE/PROG:當(dāng)訪問

12、外部程序存儲(chǔ)器或數(shù)據(jù)存儲(chǔ)器時(shí),ALE(地址所存允許)輸出脈沖用于所存地址的低8位字節(jié)。即使不訪問外部存儲(chǔ)器,ALE仍以時(shí)鐘振蕩頻率的1/6輸出固定的正脈沖信號(hào),因此它可對外輸出時(shí)鐘或用于定時(shí)目的。要注意的是:每當(dāng)訪問外部數(shù)據(jù)存儲(chǔ)器時(shí)將跳過一個(gè)ALE脈沖。</p><p>  對flash存儲(chǔ)器編程期間,該引腳還用于輸入編程脈沖(^PROG)。</p><p>  如有不要,可通過對特殊功能

13、寄存器(SFR)區(qū)中的8EH單元的D0位置位,可禁止ALE操作。該外置位后,只要一條MOVX和MOVC指令A(yù)LE才會(huì)被激活。此外,該引腳會(huì)被微弱拉高,單片機(jī)執(zhí)行外部程序時(shí),應(yīng)設(shè)置ALE無效。</p><p>  ^PSEN:程序存儲(chǔ)允許(^PSEN)輸出是外部程序存儲(chǔ)器的讀選通信號(hào),當(dāng)at89s52由外部程序存儲(chǔ)器取指令(或數(shù)據(jù))時(shí),每個(gè)機(jī)器周期兩個(gè)^PSEN有效,即輸出兩個(gè)脈沖。在此期間,當(dāng)訪問外部數(shù)據(jù)存儲(chǔ)器,

14、這兩次有效的^PSEN信號(hào)不出現(xiàn)。</p><p>  EA/VPP:外部訪問允許。欲使CPU僅訪問外部程序存儲(chǔ)器(地址為0000H---FFFFH),EA端必須保持低電平(接地)。需注意的是; 如果加密位LB1被編程,復(fù)位時(shí)內(nèi)部會(huì)鎖存EA端狀態(tài)。</p><p>  如 EA端為高電平(接VCC端),CPU則執(zhí)行內(nèi)部程序存儲(chǔ)器中的指令。</p><p>  Fla

15、sh存儲(chǔ)器編程時(shí),該引腳加上+12V的編程允許電源VPP,當(dāng)然這必須是該器件是使用12V編程電壓VPP.</p><p>  XTAL1: 振蕩器反相放大器的及內(nèi)部時(shí)鐘發(fā)生器的輸出端。</p><p>  XTAL2: 振蕩器反相放大器的輸出端。</p><p><b>  時(shí)鐘振蕩器:</b></p><p>  at

16、89s52中有一個(gè)用于構(gòu)成內(nèi)部振蕩器的高增益反相放大器,引腳XTAL1和XTAL2分別是該放大器的輸入端和輸出端。這個(gè)放大器與作為反饋的片外石英晶體或陶瓷諧振器一起構(gòu)成自激振蕩器,振蕩電路參見圖5。</p><p>  外接石英晶體(或陶瓷諧振器)及電容C1、C2接在放大器的反饋回路中構(gòu)成并聯(lián)振蕩電路。對外接電容C1、C2雖然沒有十分嚴(yán)格的要求,但電容容量的大小會(huì)輕微影響振蕩頻率的高低、振蕩器的穩(wěn)定性、起振的難易

17、程度及溫度穩(wěn)定性,如果使用石英晶體,我們推薦電容使用30PF+10PF,而如使用陶瓷諧振器建議選擇40PF+10PF。</p><p>  用戶也可以采用外部時(shí)鐘。采用外部時(shí)鐘的電路如圖5右所示。這種情況下,外部時(shí)鐘脈沖接到XTAL1端,即內(nèi)部時(shí)鐘發(fā)生器的輸入端,XTAL2則懸空</p><p>  由于外部時(shí)鐘信號(hào)是通過一個(gè)2分頻觸發(fā)器后作為內(nèi)部時(shí)鐘信號(hào)的,所以對外部時(shí)鐘信號(hào)的占空比沒有

18、特殊要求,但最小高電平持續(xù)時(shí)間和最大的低電平持續(xù)時(shí)間應(yīng)符合產(chǎn)品技術(shù)要求。</p><p><b>  空閑模式:</b></p><p>  在空閑工作模式狀態(tài),CPU保持睡眠狀態(tài)而所有片內(nèi)的外設(shè)仍保持激活狀態(tài),這種方式由軟件產(chǎn)生。此時(shí),片內(nèi)RAM和所有特殊功能寄存器的內(nèi)容保持不變。空閑模式可由任何允許的中斷請求或硬件復(fù)位終止。</p><p>

19、;  終止空閑工作模式的方法有兩種,其一是任何一條被允許中斷的事件被激活,即可終止空閑工作模式。程序會(huì)首先響應(yīng)中斷,進(jìn)入中斷服務(wù)程序,執(zhí)行完中斷服務(wù)程序并僅隨終端返回指令,下一條要執(zhí)行的指令就是使單片機(jī)進(jìn)入空閑模式那條指令后面的一條指令。其二是通過硬件復(fù)位也可將空閑工作模式終止,需要注意的是,當(dāng)由硬件復(fù)位來終止空閑模式時(shí),CPU通常是從激活空閑模式那條指令的下一條指令開始繼續(xù)執(zhí)行程序的,要完成內(nèi)部復(fù)位操作,硬件復(fù)位脈沖要保持兩個(gè)機(jī)器周期

20、(24個(gè)時(shí)鐘周期)有效,在這種情況下,內(nèi)部禁止CPU訪問片內(nèi)RAM,而允許訪問其它端口。為了避免可能對端口產(chǎn)生以外寫入,激活空閑模式的那條指令后一條指令不應(yīng)該是一條對端口或外部存儲(chǔ)器的寫入指令。</p><p>  空閑和掉電模式外部引腳狀態(tài)</p><p>  掉電模式:在掉電模式下,震蕩器停止工作,進(jìn)入掉電模式的指令是最后一條被執(zhí)行的指令,片內(nèi)RAM和特殊功能寄存器的內(nèi)容在終止掉電模式

21、前被凍結(jié)。退出掉電模式的唯一方法是硬件復(fù)位,復(fù)位后將重新定義全部特殊功能寄存器但不改變RAM中的內(nèi)容,在VCC恢復(fù)到正常工作電平前,復(fù)位應(yīng)無效,且必須保持一定時(shí)間以使振蕩器重啟動(dòng)并穩(wěn)定工作。</p><p>  程序存儲(chǔ)器的加密 :AT89S52可使用對芯片上的3個(gè)加密位進(jìn)行編程(P)或不編程(U)來得到如下表所示的功能:</p><p><b>  加密位保護(hù)功能表</b

22、></p><p>  當(dāng)加密位LB1被編程時(shí),在復(fù)位期間,EA端的邏輯電平被采樣并鎖存,如果單片機(jī)上電后一直沒有復(fù)位,則鎖存起的初始值是一個(gè)隨機(jī)數(shù),且這個(gè)隨機(jī)數(shù)會(huì)一直保持到真正復(fù)位為止。為使單片機(jī)能正常工作,被鎖存的EA電平值必須與該引腳當(dāng)前的邏輯電平一致。此外,加密位只能通過整片擦除的方法清除。</p><p>  FLASH閃速存儲(chǔ)器的編程:at89s52單片機(jī)內(nèi)部有4K字節(jié)的

23、FLASH PEROM,這個(gè)FLASH存儲(chǔ)陣列出廠時(shí)已處于擦除狀態(tài)(即所有存儲(chǔ)單元的內(nèi)容均為FFH),用戶隨時(shí)可對其進(jìn)行編程。編程接口可接收高電平(+12V)或低電平(VCC)的允許編程信號(hào),低電平編程模式適合于用戶再線編程系統(tǒng),而高電平編程模式可與通用EPROM編程器兼容。</p><p>  AT89S52單片機(jī)中,有些屬于低電壓編程方式,而有些則是高電平編程方式,用戶可從芯片上的型號(hào)和讀取芯片內(nèi)的簽名字節(jié)獲

24、得該信息,見下表。</p><p>  AT89S52的程序存儲(chǔ)器陣列是采用字節(jié)寫入方式編程的,每次寫入一個(gè)字節(jié),要對整個(gè)芯片內(nèi)的PEROM程序存儲(chǔ)器寫入一個(gè)非空字節(jié),必須使用片擦除的方式將整個(gè)存儲(chǔ)器的內(nèi)容清除。</p><p><b>  編程方法:</b></p><p>  編程前,需按表1、圖3和圖4所示設(shè)置好地址,數(shù)據(jù)及控制信號(hào), a

25、t89s52編程方法如下:</p><p>  1.在地址線上加上要編程單元的地址信號(hào)。</p><p>  2.在數(shù)據(jù)線上加上要寫入的數(shù)據(jù)字節(jié)。</p><p>  3.激活相應(yīng)的控制信號(hào)。</p><p>  4.在高電壓編程方式時(shí),將^EA/VPP端加上+12V編程電壓。</p><p>  5.每對FLASH存

26、儲(chǔ)陣列寫入一個(gè)字節(jié)或每寫入一個(gè)程序加密位,加上一個(gè)ALE/^PROG編程脈沖,改變編程單元的地址和寫入的數(shù)據(jù),重復(fù)1—5步驟,直到全部文件編程結(jié)束。每個(gè)字節(jié)寫入周期是自身定時(shí)地,通常約為1.5ms。</p><p>  數(shù)據(jù)查詢:at89s52單片機(jī)用數(shù)據(jù)查詢方式來檢測一個(gè)寫周期是否結(jié)束,在一個(gè)寫周期中,如需要讀取最后寫入的那個(gè)字節(jié),則讀出的數(shù)據(jù)的最高位(P0.7)是原來寫入字節(jié)最高位的反碼。寫周期完成后,有效的

27、數(shù)據(jù)就會(huì)出現(xiàn)在所有輸出端上,此時(shí),可進(jìn)入下一個(gè)字節(jié)的寫周期,寫周期開始后,可在任意時(shí)刻進(jìn)行數(shù)據(jù)查詢。</p><p>  READY/^BUSY:字節(jié)編程的進(jìn)度可通過“RDY/^BSY”輸出信號(hào)監(jiān)測,編程期間,ALE變?yōu)楦唠娖健癏”后P3.4(RDY/^BSY)端電平被拉低,表示正在編程狀態(tài)(忙狀態(tài))。編程完成后,P3.4變?yōu)楦唠娖奖硎緶?zhǔn)備就緒狀態(tài)。</p><p>  程序校驗(yàn):如果加密

28、位LB1、LB2沒有進(jìn)行編程,則代碼數(shù)據(jù)可通過地址和數(shù)據(jù)線讀回原編寫的數(shù)據(jù)。加密位不可能直接變化。證實(shí)加密位的完成通過觀察它們的特點(diǎn)和能力。</p><p>  芯片擦除:利用控制信號(hào)的正確組合(表1)并保持ALE/^PROG引腳10ms的低電平脈沖寬度即可將PEROM陣列(4k字節(jié))整片擦除,代碼陣列在擦除操作中將任何非空單元寫入“1”,這步驟需要再編程之前進(jìn)行。</p><p>  讀

29、片內(nèi)簽名字節(jié):at89s52單片機(jī)內(nèi)有3個(gè)簽名字節(jié),地址為030H、031H和032H。用于聲明該器件的廠商、型號(hào)和編程電壓。讀簽名字節(jié)的過程和單元030H、031H和032H的正常校驗(yàn)相仿,只需將P3.6和P3.7保持低電平,返回值意義如下:</p><p> ?。?30H)=1EH聲明產(chǎn)品由ATMEL公司制造。</p><p> ?。?31H)=51H聲明為at89s52單片機(jī)。<

30、;/p><p>  (032H)=FFH聲明為12V編程電壓。</p><p> ?。?32H)=05H聲明為5V編程電壓。</p><p>  編程接口:采用控制信號(hào)的正確組合可對FLASH閃速存儲(chǔ)陣列中的每一代碼字節(jié)進(jìn)行寫入和存儲(chǔ)器的整片擦除,寫操作周期是自身定時(shí)的,初始化后它將自動(dòng)定時(shí)到操作完成。</p><p>  AT89S52 sin

31、gle chip microcomputer</p><p>  The at89s52 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash Programmable and Erasable Read Only Memory (PEROM) and 128 bytes RAM. The device i

32、s manufactured using Atmel’s high density nonvolatile memory technology and is compatible with the industry standard MCS-51? instruction set and pinout. The chip combines a versatile 8-bit CPU with Flash on a monolithic

33、chip, the Atmel at89s52 is a powerful microcomputer which provides a highly flexible and cost effective s</p><p>  Features: </p><p>  ? Compatible with MCS-51? Products</p><p>  ?

34、4K Bytes of In-System Reprogrammable Flash Memory</p><p>  ? Endurance: 1,000 Write/Erase Cycles</p><p>  ? Fully Static Operation: 0 Hz to 24 MHz</p><p>  ? Three-Level Program Mem

35、ory Lock</p><p>  ? 128 x 8-Bit Internal RAM</p><p>  ? 32 Programmable I/O Lines</p><p>  ? Two 16-Bit Timer/Counters</p><p>  ? Six Interrupt Sources</p><p

36、>  ? Programmable Serial Channel</p><p>  ? Low Power Idle and Power Down Modes</p><p>  The at89s52 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O line

37、s, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator and clock circuitry. In addition, the at89s52 is designed with static logic for operation down t

38、o zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to </p><p>  Pin Description:<

39、;/p><p>  VCC Supply voltage.</p><p>  GND Ground.</p><p><b>  Port 0</b></p><p>  Port 0 is an 8-bit open drain bidirectional I/O port. As an output port ea

40、ch pin can sink eight TTL inputs. When is are written to port 0 pins, the pins can be used as high impedance inputs. </p><p>  Port 0 may also be configured to be the multiplexed loworder address/data bus du

41、ring accesses to external program and data memory. In this mode P0 has internal pullups. </p><p>  Port 0 also receives the code bytes during Flash programming, and outputs the code bytes during program veri

42、fication. External pullups are required during program verification.</p><p><b>  Port 1</b></p><p>  Port 1 is an 8-bit bidirectional I/O port with internal pullups. The Port 1 outpu

43、t buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will sourc

44、e current (IIL) because of the internal pullups. </p><p>  Port 1 also receives the low-order address bytes during Flash programming and verification.</p><p><b>  Port 2</b></p>

45、;<p>  Port 2 is an 8-bit bidirectional I/O port with internal pullups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal pullups an

46、d can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pullups.</p><p>  Port 2 emits the high-order address byte during fetche

47、s from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application it uses strong internal pull-ups when emitting 1s. During accesses to external data

48、memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. </p><p>  Port 2 also receives the high-order address bits and some control signals during Flash pr

49、ogramming and verification.</p><p><b>  Port 3</b></p><p>  Port 3 is an 8-bit bidirectional I/O port with internal pullups. The Port 3 output buffers can sink/source four TTL inputs

50、. When 1s are written to Port 3 pins they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pullups.&l

51、t;/p><p>  Port 3 also serves the functions of various special features of the at89s52 as listed below:</p><p>  Port 3 also receives some control signals for Flash programming and verification.<

52、;/p><p><b>  RST</b></p><p>  Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.</p><p><b>  ALE/PROG</b>

53、</p><p>  Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming.</p>&

54、lt;p>  In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access t

55、o external Data Memory. </p><p>  If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is

56、 weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.</p><p><b>  PSEN</b></p><p>  Program Store Enable is the read st

57、robe to external program memory. </p><p>  When the at89s52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during eac

58、h access to external data memory.</p><p><b>  EA/VPP</b></p><p>  External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program

59、 memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. </p><p>  EA should be strapped to VCC for internal program execution

60、s. </p><p>  This pin also receives the 12-volt programming enable voltage(VPP) during Flash programming, for parts that require 12-volt VPP.</p><p><b>  XTAL1</b></p><p&g

61、t;  Input to the inverting oscillator amplifier and input to the internal clock operating circuit.</p><p><b>  XTAL2</b></p><p>  Output from the inverting oscillator amplifier.</

62、p><p>  Oscillator Characteristics</p><p>  XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in F

63、igure 1. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 2. There are no requirements

64、 on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two </p><p><b>  Idle Mode</b></p><p>  In idle mode, the C

65、PU puts itself to sleep while all the onchip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle

66、mode can be terminated by any enabled interrupt or by a hardware reset.</p><p>  It should be noted that when idle is terminated by a hard ware reset, the device normally resumes program execution, from wher

67、e it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the po

68、ssibility of an unexpected write to a port pin when Idle is terminated by reset, the instruction following the one that invokes Idle should not be one tha</p><p>  Status of External Pins During Idle and Pow

69、er Down Modes</p><p>  Power Down Mode</p><p>  In the power down mode the oscillator is stopped, and the instruction that invokes power down is the last instruction executed. The on-chip RAM an

70、d Special Function Registers retain their values until the power down mode is terminated. The only exit from power down is a hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should

71、not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to r</p><p>  Program Memory Lock Bits</p><p>  On the chip are

72、three lock bits which can be left unprogrammed (U) or can be programmed (P) to obtain the additional features listed in the table below: </p><p>  Lock Bit Protection Modes</p><p>  When lock bi

73、t 1 is programmed, the logic level at the EA pin is sampled and latched during reset. If the device is powered up without a reset, the latch initializes to a random value, and holds that value until reset is activated. I

74、t is necessary that the latched value of EA be in agreement with the current logic level at that pin in order for the device to function properly.</p><p>  Programming the Flash:</p><p>  The at

75、89s52 is normally shipped with the on-chip Flash memory array in the erased state (that is, contents = FFH) and ready to be programmed. The programming interface accepts either a high-voltage (12-volt) or a low-voltage (

76、VCC) program enable signal. The low voltage programming mode provides a convenient way to program the at89s52 inside the user’s system, while the high-voltage programming mode is compatible with conventional third party

77、Flash or EPROM programmers. </p><p>  The at89s52 is shipped with either the high-voltage or low-voltage programming mode enabled. The respective top-side marking and device signature codes are listed in the

78、 following table.</p><p>  The at89s52 code memory array is programmed byte-bybyte in either programming mode. To program any nonblank byte in the on-chip Flash Programmable and Erasable Read Only Memory, th

79、e entire memory must be erased using the Chip Erase Mode.</p><p>  Programming Algorithm: </p><p>  Before programming the at89s52, the address, data and control signals should be set up accordi

80、ng to the Flash programming mode table and Figures 3 and 4. To program the at89s52, take the following steps.</p><p>  1. Input the desired memory location on the address lines.</p><p>  2. Inpu

81、t the appropriate data byte on the data lines.</p><p>  3. Activate the correct combination of control signals.</p><p>  4. Raise EA/VPP to 12V for the high-voltage programming mode.</p>

82、<p>  5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The byte-write cycle is self-timed and typically takes no more than 1.5 ms. Repeat steps 1 through 5, changing the address and data

83、 for the entire array or until the end of the object file is reached.</p><p>  Data Polling: The at89s52 features Data Polling to indicate the end of a write cycle. During a write cycle, an attempted read of

84、 the last byte written will result in the complement of the written datum on PO.7. Once the write cycle has been completed, true data are valid on all outputs, and the next cycle may begin. Data Polling may begin any tim

85、e after a write cycle has been initiated.</p><p>  Ready/Busy: The progress of byte programming can also be monitored by the RDY/BSY output signal. P3.4 is pulled low after ALE goes high during programming t

86、o indicate BUSY. P3.4 is pulled high again when programming is done to indicate READY.</p><p>  Program Verify: If lock bits LB1 and LB2 have not been programmed, the programmed code data can be read back vi

87、a the address and data lines for verification. The lock bits cannot be verified directly. Verification of the lock bits is achieved by observing that their features are enabled.</p><p>  Chip Erase: The enti

88、re Flash Programmable and Erasable Read Only Memory array is erased electrically by using the proper combination of control signals and by holding ALE/PROG low for 10 ms. The code array is written with all “1”s. The chip

89、 erase operation must be executed before the code memory can be re-programmed.</p><p>  Reading the Signature Bytes: The signature bytes are read by the same procedure as a normal verification of locations 0

90、30H, 031H, and 032H, except that P3.6 and P3.7 must be pulled to a logic low. The values returned are as follows.</p><p>  (030H) = 1EH indicates manufactured by Atmel</p><p>  (031H) = 51H indi

91、cates 89C51</p><p>  (032H) = FFH indicates 12V programming</p><p>  (032H) = 05H indicates 5V programming</p><p>  Programming Interface</p><p>  Every code byte in th

92、e Flash array can be written and the entire array can be erased by using the appropriate combination of control signals. The write operation cycle is selftimed and once initiated, will automatically time itself to comple

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論