Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: 555 timer chip guy on June 06, 2007, 01:20:05 PM

Title: ATMega switch out
Post by: 555 timer chip guy on June 06, 2007, 01:20:05 PM
can a circuit designed for the ATMega8 also use the 168 because the ATMega168 is faster and is more powerful but I cant fine a circuit for it, all the circuits I fined are for the ATMega8! >:(
Title: Re: ATMega switch out
Post by: rgcustodio on June 06, 2007, 02:03:42 PM
The ATmega8 and ATmega88/48/168 family are pin compatible. So you can use the ATMega168 as a drop in replacement BUT your code might not work correctly, since the memory mapped port addresses would've likely changed. Read the appnotes for changes in the design:
http://www.atmel.com/dyn/resources/prod_documents/doc2553.pdf

Note that the appnote only discusses the ATmega88, there might be changes in b/n the family members (88/48/168) so it will also be better to read the data sheets.

HTH.

- Rommel
Title: Re: ATMega switch out
Post by: Admin on June 06, 2007, 04:47:33 PM
555 guy, if you look at my $50 Robot code (http://www.societyofrobots.com/downloads/sbs_source_photovore_v1.zip) you will notice a section called CONFIGURE PORTS in the SoR_Utils.h file.

In that same file you will see lines such as PORT_OFF(PORTD, 4);

In the makefile file you will notice a line that says:
# MCU name
MCU = atmega8

If you modify each depending on your needs, your code should work for any AVR.
Title: Re: ATMega switch out
Post by: 555 timer chip guy on June 09, 2007, 04:32:32 PM
thank you