上次说了GPIO输入、输出均有几种模式。但我不是学电子的。有些搞不懂,求助于万能的google吧。
A "floating" input is one that is not "tied" to anything: hence "floating".
The usual "tie-ing" is either a pull-up resistor to the power rail or a pull-down resistor to 0 volts / gnd. Either of these connections establishes a known potential at the input. Without either, the input potential is indeterminable - so it is "floating." In terms of electronic engineering and almost without exception, floating inputs are recognised as bad practice
另一位网友的博客:
悬浮输入与上拉输入是两种输入方式,不同之处在于上拉输入时,引脚内部有个上拉电阻。当引脚悬空时,上拉输入的引脚电平是确定的,即高电平;而悬浮输入则不同,它的电平时不确定的,即使外部的一个很小的信号都会使其发生改变。
上拉输入最典型的应用就是外部按键,当按键未按下时,我们要保证它是高电平,当按键按下时才被拉低;而悬浮输入的典型应用就是模数转换,外部的任何一个小信号都要经过A/D采样转换为数字信号。
推挽输出:可以输出高,低电平,连接数字器件
开漏输出:输出端相当于三极管的集电极. 要得到高电平状态需要上拉电阻才行. 适合于做电流型的驱动,其吸收电流的能力相对强(一般20ma以内),
开漏输出有这么几个特点: