Arduino PINS?

I looked at the datasheet of the Atmega8 and read that it has 23 I/O pins. But Arduino only has 13 Digital and 6 Analog sums up only to 19 I/O. What happened with the 4 remaining I/O pins?

Don't they use PC4,5,6 (Reset, SCL, SDA) as I/O pins?

I am not sure where you got the number 23 from, I didn't see it in my data sheet. In fact there 20 I/O pins not 19 (this is because you forgot to include digital pin 0).
PC4 and PC5 are used as digital 12 & 13.
PC6 isn't brought out on the IC package so can't be used.
SCL and SDA are analogue 5 & 6.
Reset is used surprisingly enough as a reset signal triggered from when the USB chip is plugged in or from the RTS / DTR lines of the serial port.
Pin 21 is the analogue reference input used for setting the reference voltage of the A/D converter, but that is it's only use.
Also the two pins you connect the crystal to could be used as clock in and clock out.
Remember a manufacturer is always trying to big up what the sell.

Yes, they are 14 digital pins...

On the first page of the datasheet it says:
"? I/O and Packages
– 23 Programmable I/O Lines
– 28-lead PDIP, 32-lead TQFP, and 32-pad QFN/MLF"

At the moment I want to free my arduino boards from projects which are completed and need no further debugging. So I buy the same Atmega Chips as on the arduino and replace the arduino board with the atmega chips. Don't want to waste my 33$ arduino if the projects works with an 4$ atmega chip. :stuck_out_tongue:

But I want to take the arduino of course as a reference.
So 2 pins are for the crystal and (1) reset pin for the reset function?
23 -2 -1 = 20
This explains why the arduino has "only" 20 usable pins for i/o?

So 2 pins are for the crystal and (1) reset pin for the reset function?



The RESET and oscillator pins are (in theory) re-configurable using a real AVR programmer, if you're willing to live with the internally generated clock and reset signals. Arduino doesn't use them that way...

It's been a while since I read the data sheet, but isn't the configuration of RESET a one shot deal? IIRC once you've done it, you never program the device again.


I think you can always reset the fuses (including RSTDISBL) using "high voltage parallel programming" (uses 12V on RESET to initiate programming mode.) However, serial programmers may be locked out as you said...