
例說8051:單片機程式設計案例教程
單片機,單片機,還是單片機
從8048開始,“單片機”即成為廣受歡迎的代名詞,8051更成為電機、電子類專業必修的課程。當然,應用單片機制作電子系統項目,既簡單又經濟實惠,早已成為學生的最愛。在電路設計方面,需求量較大、電路較複雜的系統可采用為客戶專用而設計的ic(即asic),如晶片組、控制晶片等,雖然asic的機關成本不高,但總體成本很高、開發時間也比較長。需求量不是很大,而電路變化較多的系統則多采用可程式設計邏輯器件(如cpld、fpga)。不過,cpld、fpga的單價較高。由此可見,目前對于中、小規模的電路設計,還是采用單片機最合适。以常用的8051電路為例,一個89c51或89s51的零售價約幾元錢,隻是cpld或fpga的幾十分之一而已。
為喝一杯鮮奶,養一頭母牛
在過去十多年裡,我們一直從事電路設計(orcad、protel)與單片機的教學,帶領學生從實際電路的設計、單片機程式設計,直到完成整個電子系統。盡管市面上有關8051的書籍很多,但其中不少結構類似,不外乎“第1章介紹8051的系列與結構、第2章談8051的指令……”若按照順序教學,第1章還沒結束之前,就算老師還沒累倒,學生早就癱倒在地了!是以,老師們總是跳着教,第一次先上第1章的某部分,再翻到第2章的某部分……第二次再談第1章的某部分,再翻到第2章的某部分……這樣翻來覆去,不叫人眼花缭亂才怪!是以漏東西在所難免。好多年前就想自己編寫一本較适用的單片機教材,不過,市面上關于這方面的書籍很多,我常遲疑于“為喝一杯鮮奶,養一頭母牛”的困惑,始終無法鼓起勇氣動手撰寫本書。
<a href="https://yq.aliyun.com/articles/103041">第 1 章 輕松看8051</a>
<a href="https://yq.aliyun.com/articles/103047">1-1 微型計算機與單片機</a>
<a href="https://yq.aliyun.com/articles/103067/">1-2 8051基本知識</a>
<a href="https://yq.aliyun.com/articles/103071">1-3 8051的開發流程與工具</a>
<a href="https://yq.aliyun.com/articles/103086">1-4 執行個體演練</a>
<a href="https://yq.aliyun.com/articles/103089">1-5 實時練習</a>
<a href="https://yq.aliyun.com/articles/103092">第 2 章 輸出口的應用</a>
<a href="https://yq.aliyun.com/articles/103107">2-1 認識mcs-51的存儲器結構</a>
<a href="https://yq.aliyun.com/articles/103326">2-2 8051的輸入/輸出口</a>
<a href="https://yq.aliyun.com/articles/103350">2-3 輸出電路設計</a>
<a href="https://yq.aliyun.com/articles/103352">2-4 指令格式</a>
<a href="https://yq.aliyun.com/articles/103361">2-5 尋址方式</a>
<a href="https://yq.aliyun.com/articles/103396">2-6 資料傳送指令</a>
<a href="https://yq.aliyun.com/articles/103413">2-7 執行個體演練</a>
<a href="https://yq.aliyun.com/articles/103416/">2-8 實時練習</a>
第3章 輸入口的應用
第 4 章 輸入/輸出口進階應用
第5章 中斷的應用
第6章 定時器/計數器的應用 第6章
第7章 串行口的應用
第8章 聲音的産生
第9章 步進電機的控制
第 10 章 ad與da的應用
第 11 章 led點陣的應用
第 12 章 lcd的應用