首先介绍一下短路:短路是在电流路径中没有任何有意的限流元件的电路。结果是我们通常认为电阻为零的电路元件开始充当电阻器,并且通常的电源数学模型中断通常会导致电压低于预期,并造成破坏性过热。
由于微控制器的最大电流规格,在从引脚流过的电流路径中需要一个电阻元件。您可以通过输出40 mA的电流来使该引脚消失,如果我正确地记得所有引脚同时输出200 mA的电流,则该引脚会消失。该系统的标称电压为5 V,所以让我们看看如果使用470计算电流:。这恰好是电流的合理值,不会损坏微控制器。如果改为使用15 VΩķΩ5V470Ω≈10mAkΩ电阻,您将获得5 mA的电流,这将更加安全,消耗的功率也更少。另外,这两个电阻值相对较流行,同时提供的电流很小,但又不小,以至于在使用它们时需要考虑走线的电容。
万一实际短路线,您应该完全期望线路本身的电阻可以忽略不计!这将导致引脚直接短路,如引言中所述,将导致引脚失效。短路的线路通常也会导致按钮损坏,因为大电流会由于过热和火花而对按钮触点寿命产生负面影响。代替使用短路来连接线路,更好的方法是在线路的接地附近放置一个电阻。线路通电时,这将限制电流。通过将电阻器放置在线路的接地点附近,我们可以确保线路上的最大压降在线路的末端,因此,如果我们使用按钮将其与另一条传感线短路,则传感线将看到满电压。
设置为输入的引脚也处于所谓的“高阻抗”模式,这意味着它们的行为就像是一个接地电阻很大的电阻器。如果您100%确定该引脚仅是检测引脚,则无需在其前面放置另一个电阻。即使在这种情况下,放置电阻也是一个好主意,因为您可能会意外地将引脚设置为除输入以外的其他值,并可能导致短路。如果确实要放置电阻器,请记住,流过检测线的电流很小,这意味着电阻器上的电压降将非常低,这将导致引脚看到满电压。
如果您需要更多“高级阅读”,可以看看ATmega328 的数据表,ATmega328是某些Arduino中使用的微控制器之一。在第29节“电气特性”中,您会看到在“绝对最大额定值”下,每个I / O引脚的电流为40 mA,整个设备的电流为200 mA。
更新:请不要将绝对最大额定值与运行额定值混淆!这里是ATmega32U4的数据表通知:
NOTICE:
Stresses beyond those listed under “Absolute
Maximum Ratings” may cause permanent dam-
age to the device. This is a stress rating only and
functional operation of the device at these or
other conditions beyond those indicated in the
operational sections of this specification is not
implied. Exposure to absolute maximum rating
conditions for extended periods may affect
device reliability.
以下是同一数据表第379页的脚注:
Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state
conditions (non-transient), the following must be observed:
ATmega16U4/ATmega32U4:
1.)The sum of all IOL, for ports A0-A7, G2, C4-C7 should not exceed 100 mA.
2.)The sum of all IOL, for ports C0-C3, G0-G1, D0-D7 should not exceed 100 mA.
3.)The sum of all IOL, for ports G3-G5, B0-B7, E0-E7 should not exceed 100 mA.
4.)The sum of all IOL, for ports F0-F7 should not exceed 100 mA.
If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater
than the listed test condition.
4. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady
state conditions (non-transient), the following must be observed:
ATmega16U4/ATmega32U4:
1)The sum of all IOH, for ports A0-A7, G2, C4-C7 should not exceed 100 mA.
2)The sum of all IOH, for ports C0-C3, G0-G1, D0-D7 should not exceed 100 mA.
3)The sum of all IOH, for ports G3-G5, B0-B7, E0-E7 should not exceed 100 mA.
4)The sum of all IOH, for ports F0-F7 should not exceed 100 mA.
5. All DC Characteristics contained in this datasheet are based on simulation and characterization of other AVR microcon-
trollers manufactured in the same process technology. These values are preliminary values representing design targets, and
will be updated after characterization of actual silicon