请教,ATtiny85 端口A0的问题
本帖最后由 wienne 于 2022-5-19 09:16 编辑使用ATtiny85做个小程序。
A0端口的 LED 不闪烁,仅有一点点微微亮。
A2端口的 LED 闪烁正常。
请问这是什么原因?
A0端口因有RESET功能,是有什么特殊的要设置的代码吗?
byte p1 = A2;
byte p2 = A0;
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(p1, OUTPUT);
pinMode(p2, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(p1, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(p2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(p1, LOW); // turn the LED off by making the voltage LOW
digitalWrite(p2, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
芯片文档里有说明
Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running and provided the reset pin has not been disabled. The minimum pulse length is given in Table 21-4 on page 165. Shorter pulses are not guaranteed to generate a reset.
The reset pin can also be used as a (weak) I/O pin.
复位输入。 该引脚上的低电平持续时间超过最小脉冲长度将产生复位,即使时钟未运行且复位引脚未被禁用也是如此。 最小脉冲长度在第 165 页的表 21-4 中给出。较短的脉冲不能保证产生复位。
复位引脚也可以用作(弱)I/O 引脚。
这个弱IO引脚要怎么使用呢?
有进展了
使用模拟读
https://www.avrfreaks.net/forum/attiny85-and-reset-pin
页:
[1]