2

Author Topic: Question on the Atmega8  (Read 912 times)

0 Members and 1 Guest are viewing this topic.

Offline VegaObscuraTopic starter

  • Robot Overlord
  • ****
  • Posts: 153
  • Helpful? 6
Question on the Atmega8
« on: January 15, 2011, 12:17:55 PM »
I made the $50 board and it worked great.  But now I want to remake it (possibly on a larger perf board) and I want to make as many of its IO pins available as possible.  The $50 bot board in the tutorial only adds headers to 12 of its pins.  My question is, will there be a problem if I add headers for all 22 pins (excluding pin1, which is reset, and the 4 pins for +V and gnd) and use them for sensors, servos, LEDs, etc?  Will I be able to add devices to the pins that are used for programming the atmega, and still be able to program it?  What about pins 9-14?  Is there an important reason why admin decided not to include headers on those pins in his tutorial (other than preserving simplicity)?

Offline darknrgy

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: Question on the Atmega8
« Reply #1 on: January 15, 2011, 07:58:54 PM »
Check out the Atmega8 datasheet.

http://www.atmel.com/dyn/resources/prod_documents/doc2486.pdf Download it and open it in adobe so you get the chapters. Look for the section for IO descriptions and the pinouts on the second page.

Each of the pins is explained in detail. Different pins have different capabilities. Most can do basic input and output, some can do A/D conversion, some do PWM. A few of them are dedicated for crystal, reset, power, vcc, etc. The pins can do different things in different contexts so careful. For example it is possible to assign PB6 as an input and it will prevent you from programming the board because PB6 is shared by reset :D.... until you figure out the magic trick to program it on startup which I don't remember now. Don't ask me how I know this.
« Last Edit: January 15, 2011, 08:01:47 PM by darknrgy »

Offline Graynomad

  • Full Member
  • ***
  • Posts: 79
  • Helpful? 7
    • Skype - grayn0mad
Re: Question on the Atmega8
« Reply #2 on: January 15, 2011, 08:23:33 PM »
Quote
Will I be able to add devices to the pins that are used for programming the atmega, and still be able to program it?

This is often a problem, best to leave them unused of possible.

If you need the pins you can "isolate" the programmer and the application with resistors (get AVR910 app note from the Atmel site for more info).

In a design I've just finished I used a MUX to physically swap the pins during programming.

Quote
What about pins 9-14?

9-10 are the xtal oscillator pins, you can use them for normal IO if running on an internal oscillator.

11-14 I see nothing special about these pins, they have multiple uses like most others.


______
Rob



« Last Edit: January 15, 2011, 08:36:45 PM by Graynomad »
Scattered showers my arse -- Noah, 2348BC.

Offline VegaObscuraTopic starter

  • Robot Overlord
  • ****
  • Posts: 153
  • Helpful? 6
Re: Question on the Atmega8
« Reply #3 on: January 15, 2011, 08:48:26 PM »

In a design I've just finished I used a MUX to physically swap the pins during programming.

Thank you for your response.  What does MUX stand for?

Offline Graynomad

  • Full Member
  • ***
  • Posts: 79
  • Helpful? 7
    • Skype - grayn0mad
Re: Question on the Atmega8
« Reply #4 on: January 15, 2011, 09:11:52 PM »
Quote
What does MUX stand for?
Multiplexer, there are many different types but in general they switch from two sets of pins (say A and B) to a third (C).

A--->|
        |---> C
B--->|

So for example in this case, A would be the MISO/MOSI/SCK signals from the programmer, B from the application, and C goes to the mega8.

Google 74CBT3257 for the chip I used.

______
Rob
Scattered showers my arse -- Noah, 2348BC.

Offline VegaObscuraTopic starter

  • Robot Overlord
  • ****
  • Posts: 153
  • Helpful? 6
Re: Question on the Atmega8
« Reply #5 on: January 15, 2011, 11:28:09 PM »
I see.

Would it work just as well to connect the application headers and the programmer headers in parallel and just make sure that only one is ever plugged in at a time?  Will I still be able to reprogram the atmega, even if I set port B to output?

Offline Graynomad

  • Full Member
  • ***
  • Posts: 79
  • Helpful? 7
    • Skype - grayn0mad
Re: Question on the Atmega8
« Reply #6 on: January 15, 2011, 11:42:52 PM »
Quote
just make sure that only one is ever plugged in at a time?
Yes that is OK, just pretty tedious after the 100th time :)

Quote
even if I set port B to output?

Doesn't matter what you do with the ports, the chip enters programming mode when the programmer pulls reset low and all pins are configured as appropriate for programming.

______
Rob

Scattered showers my arse -- Noah, 2348BC.

Offline VegaObscuraTopic starter

  • Robot Overlord
  • ****
  • Posts: 153
  • Helpful? 6
Re: Question on the Atmega8
« Reply #7 on: January 16, 2011, 12:17:28 PM »
Thanks, that's exactly what I needed to know.

 


Get Your Ad Here

data_list