單片機C語言編程與Proteus仿真技術

單片機C語言編程與Proteus仿真技術

《單片機C語言編程與Proteus仿真技術》是2015年11月電子工業出版社出版的圖書,作者是徐愛鈞。

基本介紹

  • 中文名:單片機C語言編程與Proteus仿真技術
  • 作者:徐愛鈞
  • 出版社:電子工業出版社
  • 出版時間:2015年11月
  • 頁數:360 頁
  • 定價:59 元
  • 開本:16 開
  • ISBN:9787121275388
內容簡介,圖書目錄,

內容簡介

本書在介紹8051單片機組成原理的基礎上,結合目前流行的Keil C51編譯器和Proteus虛擬仿真環境,闡述了單片機C語言編程與虛擬仿真套用技術,全面介紹了單片機中斷系統、定時器/計數器、串列口等片內資源的工作原理,單片機系統擴展、DAC與ADC、鍵盤與顯示器接口技術,詳細介紹了單片機片內、片外資源的C語言程式設計及其Proteus虛擬仿真套用方法,給出了大量單片機C語言程式範例和Proteus原理電路圖,所有範例均在Proteus軟體平台上調試通過,可以直接運行。

圖書目錄

第1章 8051單片機基礎·······································································································1
1.1 8051單片機的特點與基本結構··············································································· 1
1.2 8051單片機的存儲器結構··················································································· 5
1.3 CPU時序··················································································································· 8
1.4 復位信號與復位電路·································································································10
1.5 並行I/O連線埠結構······································································································· 11
1.6 指令系統················································································································13
1.7 指令的定址方式·····································································································15
1.7.1 暫存器定址···········································································································15
1.7.2 直接定址···············································································································15
1.7.3 立即定址···············································································································15
1.7.4 暫存器間接定址···································································································16
1.7.5 變址定址···············································································································16
1.7.6 相對定址···············································································································17
1.7.7 位定址···················································································································18
1.8 指令分類詳解··································································································18
1.8.1 算術運算指令·······································································································18
1.8.2 邏輯運算指令·······································································································20
1.8.3 數據傳送指令·······································································································21
1.8.4 控制轉移指令·······································································································23
1.8.5 位操作指令···········································································································25
1.9 彙編語言程式設計·······························································································26
第2章 Proteus虛擬仿真·····························································································31
2.1 集成環境ISIS ········································································································31
2.2 繪製原理圖·······································································································35
2.3 創建彙編語言原始碼仿真檔案·······················································································37
2.4 在原理圖中進行原始碼仿真調試···················································································39
2.5 原理圖與Keil環境在線上仿真調試····················································································42
第3章 Keil C51應用程式設計····················································································49
3.1 Keil C51程式設計的基本語法················································································49
3.1.1 Keil C51程式的一般結構·····················································································49
3.1.2 數據類型···············································································································50
單片機C語言編程與Proteus仿真技術
3.1.3 常量、變數及其存儲模式···················································································51
3.1.4 運算符與表達式···································································································52
3.2 C51程式的基本語句···································································································56
3.2.1 表達式語句···········································································································56
3.2.2 複合語句···············································································································56
3.2.3 條件語句···············································································································56
3.2.4 開關語句···············································································································57
3.2.5 循環語句···············································································································57
3.2.6 goto、break、continue語句··················································································58
3.2.7 返回語句···············································································································58
3.3 函式·······················································································································59
3.3.1 函式的定義與調用·······························································································59
3.3.2 中斷服務函式與暫存器組定義···········································································60
3.4 Keil C51編譯器對ANSI C的擴展····················································································61
3.4.1 存儲器類型與編譯模式·······················································································61
3.4.2 關於bit、sbit、sfr、sfr16數據類型·····································································62
3.4.3 一般指針與基於存儲器的指針及其轉換···························································65
3.4.4 C51編譯器對ANSI C函式定義的擴展································································66
3.5 C51編譯器的數據調用協定··························································································69
3.5.1 數據在記憶體中的存儲格式···················································································69
3.5.2 目標代碼的段管理·······························································································71
3.6 與彙編語言程式的接口······························································································73
3.6.1 參數傳遞規則·······································································································73
3.6.2 C51與彙編語言混合編程舉例·············································································77
3.7 絕對地址訪問··········································································································80
3.7.1 採用擴展關鍵字“_at_”或指針定義變數的絕對地址·········································80
3.7.2 採用預定義宏指定變數的絕對地址···································································81
3.8 Keil C51庫函式······································································································81
3.8.1 本徵庫函式···········································································································82
3.8.2 字元判斷轉換庫函式···························································································82
3.8.3 輸入、輸出庫函式·······························································································83
3.8.4 字元串處理庫函式·······························································································87
3.8.5 類型轉換及記憶體分配庫函式···············································································88
3.8.6 數學計算庫函式···································································································89
第4章 單片機片內資源套用·······························································································91
4.1 採用Keil C51編寫應用程式的基本原則·········································································91
4.2 並行I/O連線埠·······································································································92
4.2.1 典型單片機輸入、輸出電路···············································································92
4.2.2 單片機I/O連線埠套用編程······················································································94
4.3 中斷系統···············································································································100
4.3.1 中斷系統結構與中斷控制·················································································101
4.3.2 中斷回響·············································································································104
4.3.3 中斷系統套用編程·····························································································106
4.4 定時器/計數器······································································································ 110
4.4.1 定時器/計數器的工作方式與控制···································································· 110
4.4.2 定時器方式套用編程························································································· 113
4.4.3 計數器方式套用編程························································································· 119
4.4.4 利用定時器產生音樂·························································································121
4.5 串列口················································································································· 124
4.5.1 串列口的工作方式與控制·················································································125
4.5.2 串口/並口轉換套用編程····················································································128
4.5.3 單片機與PC機通信套用編程············································································130
4.5.4 單片機與單片機通信套用編程·········································································132
4.5.5 修改底層函式實現printf()重新定向··································································139
第5章 系統擴展與低功耗套用······················································································143
5.1 存儲器擴展·····································································································143
5.1.1 程式存儲器擴展·································································································143
5.1.2 數據存儲器擴展·································································································144
5.2 並行I/O連線埠擴展·······························································································146
5.2.1 線選法·················································································································146
5.2.2 地址解碼法·········································································································147
5.2.3 8155和8255並行接口擴展晶片套用編程·························································149
5.3 8051單片機的低功耗套用······················································································158
5.3.1 空閒工作方式·····································································································158
5.3.2 掉電工作方式·····································································································159
5.3.3 低功耗方式套用編程·························································································159
第6章 鍵盤與顯示器接口套用·····················································································163
6.1 LED顯示器接口技術··························································································163
6.1.1 七段LED數碼管顯示器·····················································································163
6.1.2 單個74HC595驅動多位LED數碼管··································································168
6.1.3 串列接口8位共陰極LED驅動器MAX7219 ······················································171
6.2 鍵盤接口技術·······································································································177
6.2.1 編碼鍵盤接口·····································································································178
6.2.2 非編碼鍵盤接口·································································································180
6.3 8279可程式鍵盤/顯示器晶片接口技術········································································183
6.3.1 8279的引腳排列·································································································183
6.3.2 8279的數據輸入、顯示輸出及命令格式·························································184
6.3.3 8279接口套用編程·····························································································189
6.4 點陣字元型LCD接口技術·························································································191
6.4.1 點陣字元型LCD顯示模組·················································································192
6.4.2 直接方式接口套用編程·····················································································197
6.4.3 間接方式接口套用編程·····················································································200
6.4.4 4位數據匯流排接口套用編程···············································································203
6.5 12864點陣圖型LCD接口技術···············································································206
6.5.1 12864點陣圖型LCD顯示模組···········································································206
6.5.2 12864 LCD接口套用編程··················································································209
6.6 T6963點陣圖型LCD接口技術············································································213
6.6.1 T6963點陣圖型LCD顯示模組···········································································213
6.6.2 T6963 LCD接口套用編程··················································································216
第7章 模數與數模轉換接口套用··············································································223
7.1 轉換器的主要技術指標······················································································223
7.2 數/模轉換器DAC接口技術···················································································224
7.2.1 DAC0832接口套用編程·····················································································225
7.2.2 DAC1208接口套用編程·····················································································229
7.2.3 串列D/A晶片TLC5615接口套用編程·······························································231
7.2.4 利用DAC接口實現波形發生器·········································································233
7.3 模/數轉換器ADC接口技術························································································238
7.3.1 比較式ADC0809接口套用編程·········································································239
7.3.2 積分式ADC ICL7135接口套用編程·································································243
7.3.3 串列A/D晶片TLC549接口套用編程·································································248
第8章 I2C匯流排接口套用····························································································253
8.1 I2C匯流排簡介····································································································253
8.2 I2C匯流排結構與數據傳輸···············································································253
8.3 I2C匯流排通用驅動程式·······························································································257
8.4 I2C接口存儲器晶片24C04套用編程·······································································258
8.5 I2C接口A/D-D/A轉換晶片PCF8591套用編程······························································263
8.6 I2C接口時鐘晶片PCF8563套用編程·············································································274
第9章 Proteus仿真設計實例···························································································285
9.1 紅外遙控系統··································································································285
9.1.1 功能要求············································································································285
9.1.2 硬體電路設計·····································································································285
9.1.3 軟體程式設計·····································································································285
9.2 點陣LED顯示屏··································································································296
9.2.1 功能要求···········································································································296
9.2.2 硬體電路設計·····································································································296
9.2.3 軟體程式設計·····································································································297
9.3 電子密碼鎖·········································································································299
9.3.1 功能要求·············································································································299
9.3.2 硬體電路設計·····································································································299
9.3.3 軟體程式設計·····································································································300
9.4 DS18B20多點溫度監測系統······················································································316
9.4.1 功能要求·············································································································316
9.4.2 硬體電路設計·····································································································316
9.4.3 軟體程式設計·····································································································320
9.5 SD卡WAV音頻播放器·························································································328
9.5.1 功能要求·············································································································328
9.5.2 硬體電路設計·····································································································329
9.5.3 軟體程式設計·····································································································330
附錄A 8051指令表···································································································341
附錄B Proteus中的常用元器件····················································································347
參考文獻···················································································································349

相關詞條

熱門詞條

聯絡我們