Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: SmAsH on March 15, 2009, 02:00:28 PM

Title: atmega8/168 pinout question
Post by: SmAsH on March 15, 2009, 02:00:28 PM
through reading a few forum posts and googling up some datasheets i have found that there are (correct me if im wrong) 13 digital ports, 5 analogue ports.
digital: 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 18, 19
analogue: 23, 24, 25, 26, 27, 28
reset: 1 (do you just short it to +5V?)
crystal: 9, 10
gnd: 22, 8
vcc:  7
i think thats all, i am still clueless about what avcc and aref do?
my main question is:
can all digital pins be configured to both inputs and outputs? and can i use all those pins a outputs? now i know about how most sensors give analogue readings and such i need to use an adc port.
Title: Re: atmega8/168 pinout question
Post by: superchiku on March 15, 2009, 02:26:40 PM
avcc and aref provide voltage for the adc...aref is analog reference voltage pin where atod conversion will be done according to the refrence voltage given at that pin...
Title: Re: atmega8/168 pinout question
Post by: Webbot on March 15, 2009, 02:42:12 PM
my main question is:
can all digital pins be configured to both inputs and outputs? and can i use all those pins a outputs? now i know about how most sensors give analogue readings and such i need to use an adc port.

Yes all I/O pins can be outputs. But NB this is a +5v output with a max current of around 40mA per pin. So you cant just connect a DC motor to the pin. You can connect a couple of servos - so long as their current draw doesn't exceed the 1A available via the voltage regulator.
Title: Re: atmega8/168 pinout question
Post by: SmAsH on March 15, 2009, 07:10:10 PM
yes i know about servos and whatnot with the motor controllers and how you can fry pins. so you're saying even the analogue pins can be outputs?
Title: Re: atmega8/168 pinout question
Post by: Webbot on March 15, 2009, 10:10:03 PM
Yes. The ADC converter works with 'channels'. On most packages 'especially a 28 pin' then each pin doubles, or even triples, up - ie it fulfills lots of functions. So the 'analogue pins' can either be used as an analogue channel or as a digit i/o port pin.
Title: Re: atmega8/168 pinout question
Post by: SmAsH on March 15, 2009, 11:25:47 PM
hmm, i will have to look into this. thank you for your help webbot  :D
Title: Re: atmega8/168 pinout question
Post by: superchiku on March 16, 2009, 11:20:28 AM
any pin except the avcc,aref and sum other pins can be configured for i/o
Title: Re: atmega8/168 pinout question
Post by: SmAsH on March 16, 2009, 01:01:07 PM
there is 14 digital pins and 6 analogue pins.