I'm using an Arduino Uno R3 as a programmer for my ATtiny85.
I know that you can enable the reset pin (IC pin 1) as an IO by burning a fuse bit, at the expense of losing the ability to program it again without 12 volts. However, can I use that pin as an analog input? I'm hoping to leave it unconnected, then use it as a seed for the random() function.
Also, how would I go about burning the fuse bit to enable the reset pin as IO with ArduinoISP?
Thanks for those links! But will those methods you linked to also work on the ATtiny85? The first talks about using the watchdog timers jitter, and while I don't know what that means, it sounds like a possibly hardware specific thing.
Aside from that, I would still like to know if the ATtiny85 reset pin would work as an analog input, and what analog input pin number it would be.
nimaid:
I know that you can enable the reset pin (IC pin 1) as an IO by burning a fuse bit, at the expense of losing the ability to program it again without 12 volts. However, can I use that pin as an analog input? I'm hoping to leave it unconnected
Yes, but you can't leave it unconnected.
nimaid:
, then use it as a seed for the random() function.
It won't be random.
Using unconnected analog pins for random numbers isn't as good as you probably think it is. You can probably get just as good results by sampling the internal voltage reference (I imagine the lowest bit of almost any ADC reading will be quite random).
If what you want is to avoid the same sequence after every reset then you can store your random seed in EEPROM for next time around, that way you always get a different sequence.
Thanks for these cool ideas on getting a random number! My problem is solved. However, I still would like to know if the reset pin could be used as analog input after burning the fuse bit.
nimaid:
Thanks for these cool ideas on getting a random number! My problem is solved. However, I still would like to know if the reset pin could be used as analog input after burning the fuse bit.
Yes. No need to burn any fuse bit, just use it.
Make sure whatever you connect to it never takes it below the reset voltage (which is in the datasheet somewhere), that resets the CPU.
nimaid:
Thanks for these cool ideas on getting a random number! My problem is solved. However, I still would like to know if the reset pin could be used as analog input after burning the fuse bit.
Yes. No need to burn any fuse bit, just use it.
Make sure whatever you connect to it never takes it below the reset voltage (which is in the datasheet somewhere), that resets the CPU.
The datasheet says (p 62): "Pullup is activated and output driver and digital input are deactivated when the pin is used as the RESET pin."
This may imply that the ANALOG input ADC0 is not deactivated, but I am not sure.
The analog input may be of limited use when configured as RESET, because RESET requires a voltage of 0.9 Vcc to be guaranteed HIGH, datasheet p 166
nimaid:
Thanks for these cool ideas on getting a random number! My problem is solved. However, I still would like to know if the reset pin could be used as analog input after burning the fuse bit.
Yes. No need to burn any fuse bit, just use it.
Make sure whatever you connect to it never takes it below the reset voltage (which is in the datasheet somewhere), that resets the CPU.
This makes the reset pin no longer function as a reset pin, but rather a weaker I/O. My question is whether that takes analog input as well.
nimaid:
I know that you can enable the reset pin (IC pin 1) as an IO by burning a fuse bit, at the expense of losing the ability to program it again without 12 volts.
that isnt quite true. with any of the common arduino tiny bootloaders installed its possible to disable reset function, use as digital or analog io, and still load code. no 12v required.