单片机IO口判断高低电平的问题

2020-02-04 09:15发布

我想用5V电源的正加在单片机P1口判断高低电平,是否需要加个电阻,防止单片机不正常,如果需要的话大概要加多大?(貌似有听人说电流太大的话单片机无法工作)
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
20条回答
lryxr2507
1楼-- · 2020-02-05 07:57
 精彩回答 2  元偷偷看……
longwu537
2楼-- · 2020-02-05 10:21
lryxr2507 发表于 2012-4-10 18:04
正解!直接上拉一个10K的电阻什么就得了!

接上拉还怎么判断高电平呢?上啦之后不是出了IO口上的电平非常低,就一直显示高电平吗?
正确的应该是IO口10K下拉接地,然后要检测的信号线直接接IO口吧,这样只有电平为高时,IO口才会显示高电平吧.
请大家鉴定……
stely
3楼-- · 2020-02-05 14:20
我也觉得应该是10K下拉。
afei8856
4楼-- · 2020-02-05 15:26
最好是加上电阻,有些单片机引脚承受不了5V电压
millwood0
5楼-- · 2020-02-05 18:15
you should look into the datasheet for your device.it typically specify the maximum current through the clamping diodes. Usually that's 20 - 25ma: anything greater than that can cause permanent damage to the clamping diodes.

so at 5v, the minimum resistance allowed is 5v/20ma = ...

If you are doing adc on that pin,you will look into the maximum resistance specification.

if you are applying an ac signal to it, you need to look into the input capacitance figure to make sure that the resistance isn't too large for your signal (as the resistance forms a low-pass filter with the pin's input capacitance).

...
lxa0
6楼-- · 2020-02-05 20:46
 精彩回答 2  元偷偷看……

一周热门 更多>