I have successfully programmed ant ATTiny 45 with my Arduino UNO. Since I am new to the Arduino community I have a couple of questions to ask.
What I don't understand is why the chips physical pin numbers aren't used in the sketch ? When I programmed the Tiny 45, I used phydical pin 5 on the chip but in the sketch it's known as pin 0.
If I wanted to use the ATTINY 2313, ATTiny 84, ATTiny 85, what are the physical chip pins known as in the sketch ?
However, I still don't understand why the physical pin numbers of these chips aren't used in the sketch like they are if you are using the 328 on the main Arduino board ?
However, I still don't understand why the physical pin numbers of these chips aren't used in the sketch like they are if you are using the 328 on the main Arduino board ?
look at the "cheatsheet" attached in my last reply, in the arduino board the pins are already labeled and traced to the headers so atmega328 physical pin 19 is Digital 13 in the board, , (try looking at the front of the arduino pcb board and trace physical pin 28 to A5, that's the best way to "understand" the layout)....
p.d.: im a newbie too in this, sorry if i misunderstood something....
Thanks charlie_dream now I understand. We aren't using the actual pin numbers of the chip itself. We're using the pin 'function'. In the case of the ATTiny 45, physical pin 5 is PB0. Therefore we're referencing 0 (zero) like digitalWrite(0, HIGH); zero referring to PB0 of the chip.
Duh on me. I guess I need to read a little better. LOL
We've updated the cheat sheet that was mentioned earlier in this post to include Arduino-tiny pinouts for the ATTiny2314/4313 as well as ATTiny25/45/85.
BTW, there's another easy way to check the pin-out and logical pin numbers...
Go to "My Documents/Arduino/hardware/tiny/cores/tiny" and open the file "pins_arduino.c" and one can find nice ASCII text description of the pins, like this in comments...
Yeah, that's a very nice diagram too. In fact, we used it along with the description in core_pins.h as a reference when we updated the cheat sheet.
PS: D17 isn't directly usable, since it is the RESET pin and needs to be remapped by changing fuses to function as a normal digital port. The same goes for D5 in the ATTinyX5 (but we left it in the diagram, since it is also assigned to analog port A0).
You have one too many for the X5 family and two too many for the 13. Let's see... PB3 needs to be excluded for the X5 family. PB3 and PB4 need to be excluded for the 13.
There is a note in the cheat sheet that says "ATTiny13 has PWM only on PB0 and PB1"
As for ATTinyX5, PB3 and PB4 can both output PWM, but they are not independent (see page 89 in the full datasheet: PB3 can be set to output the inverse of PB4). I suppose that information could be added to the note, if I can figure out a concise way of writing it
Check the diagram in the datasheet.
The "PB" numbers will be the correct ones, not the physical pin numbers.
Realistically, this makes sense, for example VCC and GND can not be I/O pins.
You didn't misunderstand: The new version of the cheat sheet was meant to do exactly that: For example, physical pin 11 on the ATTiny2313/4313 is PD6 (when programming in low-level avr-gcc) and is assigned to Arduino pin number 8: This is written as PD6/D8 in the cheat sheet.
You won't be able to use the inverted PWM for Arduino, but the sheet covers both Arduino pin numbers and normal port numbers (that's why it says D3/PB3). That said, there should be a note saying that PB3 is a "special" PWM pin.