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