Arduino Forum

Using Arduino => Microcontrollers => Topic started by: CantSayIHave on Apr 28, 2015, 04:46 pm

Title: ATtiny84
Post by: CantSayIHave on Apr 28, 2015, 04:46 pm
Hey, just a few quick questions:

I have an ATtiny84. Here (http://www.atmel.com/Images/8006S.pdf) is the datasheet for it.

What is the difference between PA and PB?

Can I use all 12 pins as input/output? If so, are they numbered 0-11 counterclockwise when using Arduino as ISP?

Thanks
Title: Re: ATtiny84
Post by: Riva on Apr 28, 2015, 05:13 pm
What pins are used for what will be dependent on the Arduino core your using.
Title: Re: ATtiny84
Post by: CantSayIHave on Apr 28, 2015, 05:24 pm
Just asking if I can format the board to use all 12 pins as I/O
Title: Re: ATtiny84
Post by: legonick22 on Apr 28, 2015, 05:26 pm
Let me give you the full shake-down here (in order according to pin #):

(http://nathan.chantrell.net/blog/wp-content/uploads/2012/02/ATtiny84_arduino-tiny_pins.png)

1. VCC = Put your +5V here.
2. XTAL1 = Put one lead of your XTAL here, can be GPIO if external clock fuse is disabled. No analog.
3. XTAL2 = Put other lead of XTAL here. Same as above,
4. RESET = Unless you have configured your fuses to disable it, this is RESET when tied to low. You can use it for I/O if you disable external reset, but I highly recommend against that.
5. INT0 = Interrupt 0. Can be used for External interrupts or GPIO. No analog.
6. GPIO. Can also be analog in.
7. MOSI = UART connection. Also GPIO or analog in.

8. MISO = UART. GPIO or analog in.
9. SCK = UART. GPIO or analog in.
10. T0 = GPIO or analog in.
11. AIN1 = GPIO or analog in.
12. AIN0 = GPIO or analog in.
13. AREF = Analog reference pin. I see people use it for GPIO or analog in, but I don't know how.
14. GND = Put your 0V here.

You don't really need to worry THAT much about PA and PB. They are a distinction useful for port manipulation (http://www.arduino.cc/en/Reference/PortManipulation), which the average user won't use.

Pinouts for the Arduino IDE depend upon both your core and your variant. Check the files included with your bootloader folder. Try looking under /your_bootloader/Variants/Standard
Title: Re: ATtiny84
Post by: Riva on Apr 28, 2015, 05:57 pm
Here is the pinout from a different core taken from here (http://highlowtech.org/?p=1695).
Notice the digital pins are in a different order to the previous post.
(http://highlowtech.org/wp-content/uploads/2011/10/ATtiny44-84.png)
Title: Re: ATtiny84
Post by: DrAzzy on Apr 28, 2015, 07:22 pm
PA and PB are PortA and PortB; which port it's on is important if you're doing direct port manipulation. Not important if not doing that.

The second pinout seems to be less common now - I only found one core using that, all the others have it the other way around.
Title: Re: ATtiny84
Post by: CantSayIHave on Apr 28, 2015, 07:26 pm
Thanks so much guys!

You answered all of my questions!
Title: Re: ATtiny84
Post by: DrAzzy on Apr 28, 2015, 07:31 pm
Also, btw - if you're going to be using the SOIC-14 package variant of the Tiny84, take a look at the Tiny841 (link in sig for Arduino core). It's pin compatible, and just a few cents more on digikey, but it has dual hardware UARTs and 6 PWM outputs, and hardware SPI, and 12 analog input channels instead of 8 (11 usable - the 12th is on reset)