ATMega8-P and 328P?

I have a project that I am planning to do and I have found a circuit and code to do this on either an ATMega8 or ATMega16. I noticed that the footprint/pinout on the ATMega8 datasheet is the same for the 328P, although they do not share the same datasheet. Would I be right in thinking that they are the same architecture, but the 8P is just the least powerful and that I can substitute my 328P in it's place?

The project is for some USB1.1 HID devices, but if I must buy a different AVR I may as well go for the 32U.

Thanks in advance for any advice.

m8 and m16 and most tiny series are same classic avr architecture but m328 radically different "revolutionary" register map. all are hid capable but that last will require considerable modification to your code. i prefer the former for hid due to ease of porting.

Thank you, I shall get myself some mega 8's in that case. If I were better at coding I would have a a try at making it work on the 328, but the source code is way beyond my skill level and I need it to just work apart from some configuration options. I have a lot of reading up to do on C :slight_smile:

Is the code Arduino code, or raw C code?

Post the code, and we could give an idea of how hard it would be to make it work on the 328p.

Thank you for your kind offer to have a look at the code, it is in C. I have installed the ATMelStudio V7 and got myself a book from the library about programming micro controllers in C. The code is from symlink.dk - C64 USB Keyboard which is a project to turn a C64 keyboard into a USB1.1 keyboard. I am happy to go and order a Mega8 rather than get people to convert code for me and then try and learn from it. My coding level at best is at the level of simple sketches, but I do need to learn C as I am studying EEE with embedded systems.

I tried to attach the code but it exceeds 9,000 characters.

main.c (12.2 KB)

I suspect it would compile and "just work" for the '328p...

Though it's hard to be sure without these.

#include "usbdrv.h"
#include "oddebug.h"

It looks like nothing in there is specific to the chip, only to the pinout.

Thanks, I will go ahead and build the circuit using a 328. If it doesn't work I will just get Mega8 and see what happens :slight_smile:

Use a socket and the dip version and swap the chips if it doesn't work