本書以89C51單片機為典型機,詳細介紹了MCS-51系列單片機的構成、工作原理、指令系統(tǒng)、匯編語言程序設計、中斷技術、定時/計數(shù)器、串行口通信等內容,并結合應用實際,系統(tǒng)地介紹了MCS-51系列單片機的擴展技術,其中包括存儲器擴展、I/O口擴展、顯示器與鍵盤接口、A/D及D/A接口技術等。為順應單片機技術的發(fā)展趨勢,跟蹤單片機技術的*發(fā)展,滿足不同層次的研究開發(fā)人員的需求,本書還詳細介紹了AT89系列單片機及C8051F系列單片機的特點、應用和編程開發(fā)方法。本書共分為十一章,內容豐富,力求反映當前單片機技術的*方法,在對單片機原理敘述全面、準確的基礎上,加強了實踐教學環(huán)節(jié)。為了便于初學者理解和掌握,本書在內容安排上采用循序漸進的論述方法,從基礎理論到實踐應用,并充分考慮所使用實例的典型性和實用性,期望讀者在學習后,既能掌握單片機的一般原理和接口技術,又能掌握單片機應用系統(tǒng)的設計方法。
自20 世紀80 年代初Intel 公司研制出MCS-51 系列單片機以來,單片機作為最典型的低端嵌入式系統(tǒng),由于其微小的體積和極低的成本,廣泛應用于家用電器、機器人、儀器儀表、工業(yè)控制、交通運輸?shù)阮I域。單片機在我國也得到廣泛的推廣和應用,成為控制系統(tǒng)中最普遍的應用技術。編者從事過多年的單片機原理與應用的教學工作和單片機應用產(chǎn)品的開發(fā)工作,深深體會到當前大部分教學內容與實際應用嚴重脫節(jié)。為了使廣大讀者熟悉和掌握MCS-51 系列單片機,作者結合自己多年的教學和科研實踐,并參考了大量相關資料,編寫了本書,力圖從以往教材局限于具體單片機原理的解析上解脫出來,著重于各種功能的應用。本書內容分為十一章,以MCS-51系列單片機為介紹對象,分別介紹MCS-51 系列單片機結構原理、MCS-51 單片機指令系統(tǒng)、匯編語言程序設計、并行I/O 口的使用、并行I/O 口的擴展方法及使用、中斷系統(tǒng)和定時/計數(shù)器、A/D 轉換接口和D/A 轉換接口技術、鍵盤與顯示器接口技術等內容。近年來,嵌入式微控制器的發(fā)展速度驚人,并融合了許多新的設計理念和傳統(tǒng)計算機的技術成果。在目前百花齊放的單片機系列之中,具有系統(tǒng)編程(ISP)特性的片上系統(tǒng)(SoC)系列單片機C8051F 脫穎而出,本書最后介紹了該系列單片機的特點及應用,期望對讀者起到拋磚引玉的作用。本書本著理論必需、夠用的原則,突出實用性、操作性,加強理論聯(lián)系實際,語言上通俗易懂,做到了好教易學,以滿足目前教學的實際需要。本書在編寫過程中,在力求對單片機原理敘述全面、準確的基礎上,加強了實踐教學環(huán)節(jié)。從工程設計應用的角度出發(fā),列舉了大量的例題和實際操作課題,除提供常見的編程方法和接口電路外,還給出簡單實用的電路。從教學的實際需要出發(fā),培養(yǎng)學生的創(chuàng)造性能力、產(chǎn)品開發(fā)能力,力求達到理論與實踐的統(tǒng)一。本書由桑勝舉、王太雷主編,張秀紅、趙曉寧、沈丁、吳月英副主編。參與本書編寫的有:山東科技大學張琴(第1 章)、山東泰山職業(yè)技術學院趙曉寧(第2 章)、泰山學院吳月英(第3章、第11 章)、張秀紅(第4 章、第8 章)、沈。ǖ10 章)、錢藝(第5 章)、欒云才(第6 章)、宗棟(第7 章)、張巖(第9 章)。泰山學院楊德運、趙繼超、郇正良、葉長國、李芳、周京偉、貝依林等教師參與了部分章節(jié)的編寫工作,書中所有圖表由吳月英精心繪制,全書由桑勝舉進行統(tǒng)稿。
本書得到山東省教育廳教學改革研究項目(應用型本科計算機硬件基礎課程體系的改革與實踐研究,魯教高函2015-12)、山東省泰安市科技發(fā)展專項計劃項目(環(huán)境探測球形機器人科研平臺的構建,201320629)、山東省泰安市科技發(fā)展計劃項目(基于C 型臂手術導航關鍵技術及空間姿態(tài)探測儀的研究,2016GX0004)和泰山學院科技計劃項目(球形機器人驅動原理及仿真研究,Y-0102013010)的資助。
在此表示衷心的感謝!由于時間倉促,作者水平有限,書中難免存在錯誤和不妥之處,敬請廣大讀者批評指正。
桑勝舉,男,泰山學院副教授,曾獲泰山學院優(yōu)秀科研成果一二三等獎各一次,任中國圖學學會高級會員,山東省科協(xié)國家級科技思想庫決策專家,山東省計算機學會理事,泰安市科技咨詢協(xié)會常務理事。
目 錄
第1 章緒論 ··········································· (1)
1.1 單片機技術的發(fā)展背景·················· (1)
1.2 單片機的組成······························ (2)
1.3 單片機的特點及應用····················· (3)
1.3.1 單片機的特點···················· (3)
1.3.2 單片機的應用···················· (4)
1.4 單片機的發(fā)展歷史························ (4)
1.5 單片機分類································· (5)
1.5.1 按單片機功能分類·············· (5)
1.5.2 MCS-51 系列單片機············ (6)
1.6 單片機發(fā)展趨勢··························· (7)
本章小結 ·········································(10)
習題 1 ·············································(10)
第 2 章單片機的結構及原理·····················(11)
2.1 80C51 單片機的基本結構··············(11)
2.1.1 80C51 單片機的組成··········(11)
2.1.2 80C51 單片機的存儲器·······(13)
2.2 并行I/O 口································(18)
2.2.1 P0 口······························(19)
2.2.2 P1 口······························(20)
2.2.3 P2 口······························(20)
2.2.4 P3 口······························(21)
2.3 時鐘電路與復位電路····················(21)
2.3.1 時鐘電路與時序················(21)
2.3.2 復位電路·························(23)
2.4 單片機的工作方式·······················(25)
2.4.1 復位方式·························(25)
2.4.2 程序執(zhí)行方式···················(25)
2.4.3 節(jié)電工作方式···················(25)
2.4.4 編程和校驗方式················(26)
2.5 單片機的工作過程·······················(27)
2.6 AT89 系列單片機簡介··················(27)
本章小結 ·········································(29)
習題 2 ·············································(29)
第 3 章單片機的指令系統(tǒng)························(30)
3.1 指令系統(tǒng)簡介·····························(30)
3.2 尋址方式···································(31)
3.3 數(shù)據(jù)傳送類指令··························(35)
3.3.1 內部RAM 傳送指令···········(36)
3.3.2 外部RAM 傳送指令···········(37)
3.3.3 數(shù)據(jù)交換類指令················(38)
3.3.4 查表指令·························(38)
3.3.5 堆棧操作指令···················(39)
3.4 算術運算類指令·························(40)
3.4.1 加法指令·························(40)
3.4.2 減法指令·························(43)
3.4.3 乘法指令·························(43)
3.4.4 除法指令·························(44)
3.5 邏輯運算類指令·························(44)
3.5.1 基本邏輯操作···················(44)
3.5.2 其他邏輯操作···················(46)
3.6 控制轉移類指令·························(47)
3.6.1 無條件轉移指令················(47)
3.6.2 條件轉移指令···················(50)
3.6.3 調用及返回指令················(51)
3.6.4 空操作指令······················(52)
3.7 位操作類指令····························(53)
3.7.1 位傳送指令······················(53)
3.7.2 位修改指令······················(53)
3.7.3 位邏輯操作指令················(53)
3.7.4 位判斷轉移類指令·············(54)
本章小結 ·········································(55)
習題 3·············································(55)
第 4 章 80C51 匯編語言程序設計··············(57)
4.1 概述········································(57)
4.1.1 程序設計語言···················(57)
4.1.2 匯編語言偽指令················(57)
4.1.3 程序匯編方法···················(60)
4.2 順序程序設計····························(62)
4.3 分支程序設計····························(64)
4.3.1 一般分支結構程序·············(65)
4.3.2 散轉程序設計···················(68)
4.4 循環(huán)程序設計····························(70)
4.4.1 循環(huán)程序結構···················(70)
4.4.2 循環(huán)程序實例···················(71)
4.5 查表程序設計····························(76)
·VI·
4.6 子程序設計與堆棧技術················(77)
4.6.1 子程序實例······················(78)
4.6.2 堆棧結構·························(81)
4.6.3 子程序結構······················(82)
4.6.4 代碼轉換程序···················(83)
4.6.5 算術運算子程序················(85)
4.6.6 查找、排序程序················(89)
本章小結 ·········································(92)
習題 4 ·············································(92)
第 5 章中斷系統(tǒng)····································(97)
5.1 中斷系統(tǒng)概述····························(97)
5.1.1 中斷的概念······················(97)
5.1.2 中斷的特點······················(97)
5.1.3 中斷系統(tǒng)的功能················(98)
5.2 中斷源與中斷寄存器···················(99)
5.2.1 中斷源····························(99)
5.2.2 中斷寄存器···················· (100)
5.3 中斷處理過程·························· (102)
5.3.1 中斷響應······················· (102)
5.3.2 中斷處理······················· (103)
5.3.3 中斷返回······················· (104)
5.3.4 中斷響應時間················· (104)
5.4 中斷觸發(fā)方式·························· (104)
5.5 中斷源的擴展·························· (105)
5.5.1 定時器擴展中斷源··········· (105)
5.5.2 中斷查詢擴展················· (106)
5.6 中斷請求的撤除······················· (107)
5.6.1 撤除定時器中斷·············· (107)
5.6.2 撤除串行口中斷·············· (107)
5.6.3 撤除外部中斷················· (107)
5.7 中斷初始化····························· (108)
5.8 應用舉例···················