【正文】
the count rate is 1/12 of the oscillator frequency. 5. Interrupts The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at is unimplemented. User software should not write a 1 to this bit position, since it may be used in future AT89 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON. Neither of these flags is cleared by hardware when the service routine is vectored to. In fact, the service routine may have to determine whether it was TF2 or EXF2 that generated the interrupt, and that bit will have to be cleared in Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then polled by the circuitry in the next cycle. However, the Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in which the timer overflows. Reference data: 1. the ATMEL pany AT89S52 technical manuals Development Co., Ltd. AT89C52 Datasheets source SCM University Press, singlechip microprocessor theory, application and test ZHANG Youde, etc 5 譯文: 微控制器 AT89S52 主要性能 ? 與 MCS51 單片機產(chǎn)品兼容 ? 8K 字節(jié)在系統(tǒng)可編程 Flash 存儲器 ? 1000次擦寫周期 ? 至 的工作電壓 ? 全靜態(tài)操作: 0Hz~ 33Hz ? 三級加密程序存儲器 ? 256 8 位內(nèi)部 RAM 的 ? 32個可編程 I/O口線 ? 三個 16位定時器 /計數(shù)器 ? 八個中斷源 ? 全雙工 UART串行通道 ? 低功耗空閑和掉電模式 ? 掉電后中斷可喚醒 ? 看門狗定時器 ? 雙數(shù)據(jù)指針 ? 掉電標識符 ? 快速編程時間 ? 靈活的 ISP 編程(字節(jié)和頁模式) 1. 功能特性 AT89S52 是一種低功耗、高性能 CMOS8 位微控制器,具有 8K 在系統(tǒng)可編程 Flash 存儲器。使用 Atmel 公司高密度非易失性存儲器技術(shù)制造,與工業(yè) 80C51 產(chǎn)品指令和引腳完全兼容。片上 Flash 允許程序存儲器在系統(tǒng)可編程,亦適于常規(guī)編程器。在單芯片上,擁有靈巧的 8 位 CPU 和 在系統(tǒng)可編程 Flash,使得 AT89S52 為眾多嵌入式控制應用系統(tǒng)提供高靈度、超有效的解決方案。 AT89S52 具有以下標準功能: 8k 字節(jié) Flash, 256 字節(jié) RAM, 32 位 I/O 口線,看門狗定時器, 2 個數(shù)據(jù)指針,三 16 位片內(nèi)晶振及時鐘電路。另外, AT89S52 可降至 0Hz 靜態(tài)邏輯操作,支持 2 種軟件可選擇節(jié)電模式。空閑模式下, CPU 停止工作,允許 RAM、定時器 /計數(shù)器、串口、中斷繼續(xù)工作。掉電保護方式下, RAM 內(nèi)容被保存,振蕩器被凍結(jié),單片機一切工作停止,直到下一個中斷或硬件復位為止。 6 2. 引腳描述 VCC : 電源 GND: 地 P0 口 P0口是一個 8位漏極開路的雙向 I/O口。作為輸出口,每位能驅(qū)動 8個 TTL邏 輯電平。對 P0端口寫“ 1”時,引腳用作高阻抗輸入。 當訪問外部程序和數(shù)據(jù)存儲器時, P0口也被作為低 8位地址 /數(shù)據(jù)復用。在這種模式下,P0具有內(nèi)部上拉電阻。在 flash編程時, P0口也用來接收指令字節(jié);在程序校驗時,輸出指令字節(jié)。程序校驗時,需要外部上拉電阻。 P1 口 P1 口是一個具有內(nèi)部 上拉電阻的 8 位雙向 I/O 口, p1 輸出緩沖器能驅(qū)