www.smartmcu.com
编写者:温子祺、刘志峰
编写者:温子祺、刘志峰
博客: http://www.cnblogs.com/wenziqi/
http://www.cnblogs.com/wenziqi/
http://www.cnblogs.com/wenziqi/
http://www.cnblogs.com/wenziqi/ 小组: http://group.ednchina.com/2748/
http://group.ednchina.com/2748/
http://group.ednchina.com/2748/
http://group.ednchina.com/2748/
3
目录
前 言 ......................................................................................................................................................
......................................................................................................................................................
......................................................................................................................................................
...................................................................................................................................................... 8
8
8
8
绪 论 ....................................................................................................................................................
....................................................................................................................................................
....................................................................................................................................................
.................................................................................................................................................... 10
10
10
10
第一章 8051
8051
8051
8051 简介 .................................................................................................................................
.................................................................................................................................
.................................................................................................................................
................................................................................................................................. 14
14
14
14
1.1 8051 系列单片机的特点 ............................................................................................................. 14
1.2 8051 系列单片机内部结构 .......................................................................................................... 15
1.2.1 微处理器 .............................................................................................................................. 16
1.2.2 振荡器与 CPU 时序 ............................................................................................................ 18
1.2.3 存储器 .................................................................................................................................. 18
1.2.4 并行接口 .............................................................................................................................. 21
1.3 8051 系列单片机内部资源 .......................................................................................................... 21
第二章 STC89C52RC
STC89C52RC
STC89C52RC
STC89C52RC 处理器 ............................................................................................................
............................................................................................................
............................................................................................................
............................................................................................................ 23
23
23
23
2.1 主要特性 ..................................................................................................................................... 23
2.2 型号 ............................................................................................................................................. 23
2.3 结构框图 ..................................................................................................................................... 24
2.4 管脚 ............................................................................................................................................. 26
2.5 特殊功能寄存器 ......................................................................................................................... 27
第三章 开发环境 ..................................................................................................................................
..................................................................................................................................
..................................................................................................................................
.................................................................................................................................. 29
29
29
29
3.1 C X 51 编译器 ................................................................................................................................ 29
3.2 K EIL 简介 ...................................................................................................................................... 31
3.2.1 Keil C51 系统概述 ................................................................................................................ 31
3.2.2 Keil 开发系统的整体结构 .................................................................................................... 32
3.2.3 Keil C51 存储区关键字 ........................................................................................................ 32
3.3 N OTEPAD ++ 简介 ........................................................................................................................... 35
3.4 N OTE
P
AD ++ 配置 .......................................................................................................................... 36
3.4.1 设置语法着色 ...................................................................................................................... 36
3.4.2 添加关键字 .......................................................................................................................... 37
3.4.3 设置自动完成 ...................................................................................................................... 39
3.5 K EIL 与 N OTE
P
AD ++ 联合编辑 ..................................................................................................... 40
第四章 工程创建与深入 ......................................................................................................................
......................................................................................................................
......................................................................................................................
...................................................................................................................... 44
44
44
44
4.1 启动程序 ..................................................................................................................................... 44
4.2 创建工程 ..................................................................................................................................... 45
4.3 编写程序 ..................................................................................................................................... 47
4.3.1 Hex 文件 ................................................................................................................................ 50
4.4 深入 K EIL .................................................................................................................................... 52
4.4.1 剖析头文件 .......................................................................................................................... 52
4.4.2 剖析优化 .............................................................................................................................. 54
4.4.3 详解 STARTUP.A51 .............................................................................................................. 57
4.5 程序烧写 ..................................................................................................................................... 61
基础入门篇 ............................................................................................................................................
............................................................................................................................................
............................................................................................................................................
............................................................................................................................................ 65
65
65
65