当前位置:网站首页>单片机IO详解(上拉 下拉 准双向 输入 输出 推挽 开漏)
单片机IO详解(上拉 下拉 准双向 输入 输出 推挽 开漏)
2022-06-25 06:38:00 【IT小生lkc】
一般单片机都会提供上拉和下拉功能:
上拉:将不确定的信号,固定在高电平,电源到器件引脚上的电阻叫上拉电阻,作用是平时使用该引脚为高电平,上拉是对器件注入电流,即灌电流
下拉:将不确定的信号,固定到地点平,地到器件引脚的电阻叫下拉电阻,作用是平时使该引脚为低电平,下拉是从器件输出电流,即拉电流
输入:
上拉输入 :将不确定的信号通过一个电阻嵌位在高电平
下拉输入 :把电压拉低,拉到GND,将不确定的信号拉到低电平
输入浮空:容易受到干扰,检测电平是不定的
模拟:传统方式的输入,数字模拟转换
施密特输入:防止电路干扰
基本电路的缺点是在读取外部信号的跳变沿时会出现抖动,施密特触发器就是解决了上述抖动的问题
三态输入:
三态电路可提供三种不同的输出值:逻辑“0”,逻辑“1”和高阻态
高电平 低电平 高阻
输出:
复用推挽和推挽输出区别:
推挽复用不经过输出数据寄存器(ODR)。如果是采用推挽输出,则该引脚电平直接由ODR控制,例如串口如果不是复用推挽就直接有ODR控制不受usart外设控制
推挽输出:一般都是推挽输出,真正的输出高电平和低电平
推挽输出特点:
这种配置的下拉与准双向口和开漏配置相同,具有较强的拉电流能力,不同的是,具有持续的强上拉,无论有强大的高电平以及低电平驱动能力
开漏输出:
不常见,如果作为逻辑输出,可能是I2C,需要上拉电阻
关闭所有上拉晶体管,只驱动下拉晶体管,下拉与准双向口下拉配置相同,因此只能输出低电平(吸收电流),和高阻状态。不能输出高电平(输也电流)
准双向口:
当IO输出为高电平时,其驱动能力很弱,外部负载很容易将其拉至低电平。
当IO输出为低电平时,其驱动能力很强,可吸收相当大的电流
准双向口只能有效的读取0,而对1则是采用读取非零的方式,就是读入的时候要先向io上写1,再读
真正的双向io是不需要任何预操作可直接读入读出的
准双向口做为输入时,通个一个施密特触如器和一个非门,用以干扰和滤波。
准双向口用作输入时,可对地接按键,如下图1,当然也可以去掉R1直接接按键,当按键闭合时,端口被拉至低电平,当按键松开时,端口被内部“极弱上
拉”晶体管拉至高电平。当端口作为输出时,不应对地外接LED如图形控制,这样端口的驱动能力很弱,LED只能发很微弱的光,如果要驱动LED,要采用图
3的方法,这样准双向口在输出为低时,可吸收20mA的电流,故能驱动LED。图4的方法也可以,不过LED不发光时,端口要吸收收很大电流。
边栏推荐
- アルマ / alchemy girl
- 太美的承诺因为太年轻
- Controlling volume mixer
- 2022 biological fermentation Exhibition (Jinan), which is a must read before the exhibition. The most comprehensive exhibition strategy will take you around the "fermentation circle"
- Unity get resource path
- 分布式锁中的王者方案 - Redisson
- Hongmeng learning notes: creating layouts using XML
- How to realize the stable output of 3.3v/3.6v (1.2-5v) voltage of lithium battery by using the voltage rise and fall chip cs5517
- How to record a database [closed] - how to document a database [closed]
- shell 上下两行合并成一行
猜你喜欢
Navicat prevent new query from being deleted by mistake
Want to self-study SCM, do you have any books and boards worth recommending?
[learn shell programming easily]-5. Plan tasks
The process of making wooden barrels with 3DMAX software: a three-step process
sin(a+b)=sina*cosb+sinb*cosa的推导过程
Flask 的入门级使用
【他字字不提爱,却句句都是爱】
Uncaught TypeError: Cannot read properties of undefined (reading ‘prototype‘)
Ht7180 3.7V L 12v/2a built in MOS high current boost IC solution
Derivation of COS (a+b) =cosa*cosb-sina*sinb
随机推荐
Ht81293 built in adaptive dynamic boost 20W mono class D power amplifier IC solution
【2022黑马程序员】SQL优化
集群常用群起脚本
2022 biological fermentation Exhibition (Jinan), which is a must read before the exhibition. The most comprehensive exhibition strategy will take you around the "fermentation circle"
lotus windowPoSt 手动触发时空证明计算
[tool sharing] a software that pays equal attention to appearance and skills
ACWING/2004. 錯字
Kubernetes 集群中流量暴露的几种方案
StreamNative Platform 1.5 版本发布,集成 Istio、支持 OpenShift 部署
Hongmeng learning notes: creating layouts using XML
Efficient exploration | an application practice of ES geographical location query
Analysis on the output, market scale and development status of China's children's furniture industry in 2020 and the competition pattern of children's furniture enterprises [figure]
Derivation of COS (a+b) =cosa*cosb-sina*sinb
Bcrypt password encryption kalrry
100 times larger than the Milky way, Dutch astronomers found mysterious objects in deep space
Jameswebb Space Telescope goes into operation to help study interstellar objects
Are you still doing the dishes yourself? Teach you how to make dishwasher controller with single chip microcomputer
Streaming a large file using PHP
Atomic alpha development board -- SD card and EMMC burning tool
[ros2] Why use ros2? Introduction to ros2 system characteristics