热搜关键词: 电路基础ADC数字信号处理封装库PLC

pdf

单片机C语言编程与Proteus仿真技术 (徐爱钧)

  • 1星
  • 2024-10-27
  • 15.53MB
  • 需要1积分
  • 2次下载
标签: 单片机

单片机

本书在介绍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

展开预览

猜您喜欢

评论

W139
比较清楚,谢谢!
2024-11-01 09:34:51
登录/注册

意见反馈

求资源

回顶部

推荐内容

热门活动

热门器件

随便看看

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
×