SCM——将通用微计算机基本功能部件集成在一块芯片上构成的一种专用微计算机系统。SCM = CPU+OSC+ROM+RAM+T/C+INT+ BEC+I/O+UART


80C51=(8位)CPU + 4KBROM + 128BRAM + (2×16)T/C + (4×8)I/O + 1个UART +5个INT + 2个64KB BEC
CPU = 控制器 + 运算器:

控制器的用途:统一指挥和控制各单元协调工作
控制器的任务:从ROM中取出指令→译码→执行指令
控制器的组成:程序计数器PC、数据指针寄存器DPTR、…
运算器的用途:对数据进行算术运算和逻辑操作控制器的任务:从ROM中取出指令→译码→执行指令
控制器的组成:程序计数器PC、数据指针寄存器DPTR、…
运算器的任务:计算缓存器内容→结果暂存→修改运行标志
运算器的组成:累加器ACC、程序状态字寄存器PSW、…
(1)程序计数器(Program Counter——PC)——指向ROM存储单元的地址指针(引导程序运行)

(2)数据指针寄存器(Data Pointer ——DPTR)——指向ROM或RAM存储单元的地址指针(引导数据传送)

(3)累加器(ACCUMULATER——A或ACC) ——存放操作数或中间运算结果的寄存器

(4)程序状态字寄存器(Program State Word——PSW) ——存放程序运行过程中的各种状态信息的寄存器







2、MCS-51引脚及功能
51系列单片机一般采用40只引脚的双列直插式(DIP——Dual In-line Package)封装结构:

除DIP封装外, 51单片机还采用44只引脚的方形扁平(QFP ——Quad Flat Package) 封装方式(4只引脚无用)。






3、MCS-51的存储器结构
(1) 存储器划分方法
计算机存储器地址空间的两种结构形式:普林斯顿结构和哈佛结构。


(2)程序存储器(ROM)
作用:存放程序、表格或常数,具有非易失性
特点:片内ROM与片外ROM可有2种组合方案



ROM有6个特殊存储器单元——用于程序引导:

(3)片内数据存储器(RAM)
作用:存放程序运行结果。

1) 低128字节的区域 : ①工作寄存器区(00H~1FH) ②可位寻址区(20H~2FH) ③用户RAM区(30H~7FH)

①区共有32个存储单元;
每个单元都有1个8位地址(字节地址);
每个单元都有1个寄存器名称(R0~R7);
32个单元分为4组(第0 ~ 第3组);
CPU只能选一组为当前工作寄存器组。

②区共有16个存储单元;
每个单元都有一个字节地址
每个单元都有8个不同的位地址
②区共有128个位地址

③区共有80个存储单元;
每个单元都有一个字节地址,但没有
位地址,也没有寄存器名。

2)高128字节RAM区 :每个存储单元都有一个字节地址,但只有其中21个单元可以使用,并有相应寄存器名称;51单片机共有21个特殊功能寄存器(Spetial Function Register);SFR承担着51单片机内部资源的管理工作。

4、单片机的复位、时钟与时序
(1)复位与复位电路——使单片机恢复原始默认状态的操作。



(3)单片机时序
1)时序的概念
时序是对象(或引脚、事件、信息)间按照时间顺序组成的序列关系。
时序可以用状态方程、状态图、状态表和时序图4种方法表示,其中时序图最为常用。
时序图亦称为波形图或序列图,纵坐标表示不同对象的电平,横坐标表示时间(从左往右为时间正向轴),通常坐标轴可省略。





5、并行I/O口
51单片机有32只I/O引脚,分属于4个端口(P0~P3)。
1)可作为并行I/O输入通道(例如,按键/开关连接通道)

可作为并行I/O输出通道(例如,数码管显示器连接通道)

可作为串行通信通道(例如,双机通讯的连接通道)

2)P1口

P1口的要点: P1口具有通用I/O口方式,可实现输出、读引脚(输入)和读锁存器三种功能; P1口为准双向通用口,作为通用输入口时应先使P1.n→1,作为通用输出口时是无条件的。
3)P3口


P3口的要点:P3口具有通用I/O口方式,可实现输出、读引脚(输入)和读锁存器三种功能; P3口为准双向通用口,作为通用输入口时应先使P3.n→1,作为通用输出口时应先使第二输出端→1 ;P3口具有第二功能方式,可实现第二输出和第二输入两种功能。
4)P0口





5)P2口



P2口的要点:
1)P2口具有通用I/O口方式,可实现输出、读引脚(输入)和读锁存器三种功能;
2)P2口为准双向通用口,作为通用输入口时应先使P2.n→1,作为通用输出口时应先使控制端→1 ;
3)作为通用I/O口方式时,无需外接上拉电阻;
4)P2口具有地址输出方式,可实现地址输出功能。