3
\$\begingroup\$

I want to program an ATTINY84 microcontroller using Arduino UNO as an ISP. In my program I need to use the AREF pin that is located at pin P0 on ATTINY84. I know that I can call analogReference() on Arduino UNO ATMEGA328, but what about the ATTINY84? Do I have to program the IC with some fuses?

\$\endgroup\$
1
  • \$\begingroup\$ Are you intending to use the ADC? (Why else would you be worried about the AREF pin...) The only reasons should you need to mess with the fuses for programming with ISP is to change the clock speed if you are using an external crystal or clock source. \$\endgroup\$ Commented May 13, 2013 at 21:31

1 Answer 1

4
\$\begingroup\$

For reference, here's a link to the ATTiny84 datasheet.

Section 16.13 specifies the ADC-related registers for controlling the ADC peripheral.

16.13.1 specifies the ADMUX register:

Bit 7 6 5 4 3 2 1 0
0x07 (0x27) REFS1 REFS0 MUX5 MUX4 MUX3 MUX2 MUX1 MUX0

If REFS1=0 and REFS0=1, the ADC will use the external reference on pin PA0.

These registers can be modified in code, here's an example using AVR-C:

ADMUX = 0x40;

Note that this will mess up the MUX settings, there are other ways to do this if you don't want to mess up the mux settings using bitwise operands:

ADMUX = (ADMUX & 0x7F) | 0x40;
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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