3
\$\begingroup\$

According to this datasheet, the ATTiny85 has 6 I/O pins if we include the reset pin. I used five of them to charlieplex 18 LEDs and I need another one to use as analog input.

Would it be possible to use the reset pin either as an analog input or as a digital output? If so, how? I tried controlling LED's with the reset pin, however it kept resetting my board really fast, so that's not how you do it.

Which is simpler, reset pin as analog input or as digital output and how would I manage that?

\$\endgroup\$
  • 1
    \$\begingroup\$ You have to disable the reset pin in the FUSES \$\endgroup\$ – Mike Oct 20 '14 at 16:39
  • \$\begingroup\$ That's fuse RSTDISBL in the Fuse High Byte (bit 7), which needs setting to 0 (Table 20-4). \$\endgroup\$ – Majenko Oct 20 '14 at 17:01
  • \$\begingroup\$ But is that also valid if I want to read a value at the reset pin using analogRead? And won't this make it impossible to program the ATtiny using an ISP programmer? \$\endgroup\$ – Calin Oct 20 '14 at 17:06
  • \$\begingroup\$ Read the datasheet, it's all there: "If the RSTDISBL fuse is programmed, this start-up time will be increased to 14CK + 4 ms to ensure programming mode can be entered." and yes, you will need it set even for analogRead() - how can a pin tell the difference between a logic low and a 0.04v analog voltage...? \$\endgroup\$ – Majenko Oct 20 '14 at 17:25
  • \$\begingroup\$ Ok, I'll try it and come back to you ;) \$\endgroup\$ – Calin Oct 20 '14 at 17:39
4
\$\begingroup\$

You can use it for either one as long as you don't pull it down to ground (or too close to ground). So, for example, you could use it for analog input but you have to keep it in a voltage range that is far enough above 0V so it won't cause a reset.

\$\endgroup\$
  • \$\begingroup\$ Not sure why this got voted down. I have done this and it works. \$\endgroup\$ – ThatAintWorking Nov 12 '15 at 4:58
  • \$\begingroup\$ It does, especially for input. The resolution will suffer a tad, but you just need to bias or scale the input to keep it in the safe zone. I still recommend fusing for B.O.D. You can interpret full analog as digital at a cost of some T-Cycles, or go to lower resolution if delay is an issue. This is ideal for jumper pins. \$\endgroup\$ – mckenzm Jun 10 '18 at 3:38
3
\$\begingroup\$

Uses this fuse; L:62 H:5F; It will disable the reset pin. Once it's disabled, you can use it as i/o pin, but you can't reprogram the chip with a normal programmer.

  1. After this fuse has been programmed device can be programmed via high-voltage serial mode, only.

See

20.6 High-voltage Serial Programming

in the Datasheet for instructions on how to do high-voltage programming.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.