查看: 924|回复: 0

[经验] 51单片机引脚简介

[复制链接]
  • TA的每日心情
    开心
    2019-11-4 13:48
  • 签到天数: 14 天

    连续签到: 1 天

    [LV.3]偶尔看看II

    发表于 2020-2-18 09:38:04 | 显示全部楼层 |阅读模式
    分享到:

    [color=rgb(51, 51, 51) !important]第一部分。单片机简介

    [color=rgb(51, 51, 51) !important]MSC-51单片机指以8051为核心的单片机,由美国的Intel公司在1980年推出,80C51是MCS-51系列中的一个典型品种;其它厂商以8051为基核开发出的CMOS工艺单片机产品统称为80C51系列。

    [color=rgb(51, 51, 51) !important]单片机:在一片集成电路芯片上集成微处理器(CPU)、存储器ROMRAM)、I/O接口电路,从而构成了单芯片微型计算机,即单片机(single chip Microcomputer)也叫微控制器(MCU)。

    [color=rgb(51, 51, 51) !important]CPU( Central Processing Unit ):由运算和控制逻辑组成,同时还包括中断系统和部分外部特殊功能寄存器

    [color=rgb(51, 51, 51) !important]RAM( Random-Access Memory ):用以存放可以读写的数据,如运算的中间结果、最终结果以及欲显示的数据;

    [color=rgb(51, 51, 51) !important]ROM (Read-Only Memory):用以存放程序、一些原始数据和表格;

    [color=rgb(51, 51, 51) !important]I/O(input/output)口:四个8位并行I/O口,既可用作输入,也可用作输出;

    [color=rgb(51, 51, 51) !important]T/C (timer/counter):两个定时/记数器,既可以工作在定时模式,也可以工作在记数模式;

    [color=rgb(51, 51, 51) !important]数字电路中只有两种电平:高和低

    [color=rgb(51, 51, 51) !important]单片机为TTL电平: 高 +5V      低 0V

    [color=rgb(51, 51, 51) !important]RS232电平:计算机的串口   高 -12V     低+12V

    [color=rgb(51, 51, 51) !important]所以计算机与单片机之间通讯时需要加电平转换芯片max232等其他芯片

    [color=rgb(51, 51, 51) !important]数字电路的点评特性据定了他只能用二级制:

    [color=rgb(51, 51, 51) !important]二进制逻辑运算,与或非和异或

    [color=rgb(51, 51, 51) !important]数据类型:

    [color=rgb(51, 51, 51) !important]因为51单片机是8位的,所以他的数据类型一般用unsigned char

    [color=rgb(51, 51, 51) !important]

    [color=rgb(51, 51, 51) !important]第二部分。引脚简介

    [color=rgb(51, 51, 51) !important]1.  电源引脚:Vcc (40脚):电源端,接+5V电源。

    [color=rgb(51, 51, 51) !important]Vss(Gnd) (20脚):接地端,接+5V电源地端

    [color=rgb(51, 51, 51) !important]2. 外接晶体引脚:XTAL1和XTAL2

    [color=rgb(51, 51, 51) !important]89C51内部有一个振荡器时钟产生电路。

    [color=rgb(51, 51, 51) !important]XTAL1(19脚):   片内振荡电路反相放大器输入

    [color=rgb(51, 51, 51) !important]XTAL2(18脚):片内振荡电路反相放大器输出 当采用内部时钟时,片外连接石 英晶体和微调电容,产生原始 的振荡脉冲信号。

    [color=rgb(51, 51, 51) !important]采用外部时钟时, XTAL1输入 外部时钟脉冲信号, XTAL2悬空.

    [color=rgb(51, 51, 51) !important]3. 控制信号引脚:RST、ALE、PSEN、EA

    [color=rgb(51, 51, 51) !important]RST (9脚) : 复位信号输入端,高电平有效。

    [color=rgb(51, 51, 51) !important]保持两个机器周期高电平时,完成复位操作。

    [color=rgb(51, 51, 51) !important]ALE/PROG (30脚) :

    [color=rgb(51, 51, 51) !important]地址存允许输出端/编程脉冲输入端

    [color=rgb(51, 51, 51) !important]正常时,连续输出振荡器频率的1/6正脉冲信号。

    [color=rgb(51, 51, 51) !important]访问片外存储器时:

    [color=rgb(51, 51, 51) !important]作为锁存P0口低8位地址的控制信号。

    [color=rgb(51, 51, 51) !important]对8751片内 ROM编程写入时:作为编程脉冲输入端。

    [color=rgb(51, 51, 51) !important]PSEN (29脚): 外部程序存储器读选通输出信号

    [color=rgb(51, 51, 51) !important]访问片外ROM时,输出负脉冲作为读ROM选通.

    [color=rgb(51, 51, 51) !important]常连接到片外ROM芯片的输出允许端(OE)作外部ROM的读选通信号。

    [color=rgb(51, 51, 51) !important]EA/Vpp (31脚):

    [color=rgb(51, 51, 51) !important]外部程序存储器地址使能输入/编程电压输入端.   平常,接“1”时,CPU访问片内4KB的ROM,当地址超4KB时,自动转向片外ROM中的程序。当接“0”时,CPU只访问片外ROM。 第2功能Vpp              对8051编程时,编程电压输入端。

    [color=rgb(51, 51, 51) !important]4. 输入/输出端口引脚 P0、P1、P2、P3

    [color=rgb(51, 51, 51) !important]4个8位的并行输入/输出端口,共32个引脚。作为通用输入/输出端口

    [color=rgb(51, 51, 51) !important]通用输入/输出端口

    [color=rgb(51, 51, 51) !important]准双向口:  作输入时要先对锁存器写“1”。默认启动初始化为高电平

    [color=rgb(51, 51, 51) !important]P0端口(P0.0—P0.7,第39—32脚):

    [color=rgb(51, 51, 51) !important]漏极开路的准双向口, 内部没有上拉电阻,为搞阻状态,不能正常输出高低电平,做I/O时需要接上拉电阻(10K)

    [color=rgb(51, 51, 51) !important]P1端口(P1.0—P1.7,第1—8脚):

    [color=rgb(51, 51, 51) !important]内部带上拉电阻的准双向口,在做输入时要先1

    [color=rgb(51, 51, 51) !important]P2端口(P2.0—P2.7,第21—28脚):

    [color=rgb(51, 51, 51) !important]内部带上拉电阻的准双向口,与P1相似

    [color=rgb(51, 51, 51) !important]P3端口(P3.0—P3.7,第10—17脚):

    [color=rgb(51, 51, 51) !important]内部带上拉电阻的准双向口,做I/O时与P1相似,另外有第二功能

    [color=rgb(51, 51, 51) !important]P3口的第二功能

    [color=rgb(51, 51, 51) !important]


    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条



    手机版|小黑屋|与非网

    GMT+8, 2024-4-17 04:10 , Processed in 0.100928 second(s), 14 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.