Why would sketch work on ATMega328 and ! ATMega168

I have a pretty simple program that reads input from an XBee and writes output to a 16x24 matrix. The code works great on a ATMega328, but even though it compiles and loads just fine, will not do anything on a ATMega168. It’s not size (both compile to 5K).

I’ve moved the shield that the wiring is on back and forth. The XBee receives packets just fine on both. The 328 writes to the display, the other doesn’t.

To be honest, I haven’t dug into what’s going on, being lazy and asking first.

There are several kinds of memory. The 32K/16K sketch memory is only one type. You may well be exceeding the other memory limits. Would need to see the sketch to know more.


Is a link to my code. Pretty straightforward stuff.

Is there a way to compile and check for memory usage like on a Parallax Stamp?

Sorry if I’b asking the obvious. but I find that sometimes it is the best place to start.
Can you download any of the examples to the 164?

I have one of each (328 and 168), both work fine with some of my smaller sketches, just this one only works in the 328.

Is there a way to compile and check for memory usage like on a Parallax Stamp?


It sounds like it is lack of user RAM to store variables. As it loads in OK then the code size is the same.

Is there a way to test for out of RAM to store variables other than the sketch just doesn't work? :-/

Any of these may work…

Here’s a nice graphic of the memory layout…

A few minutes searching the forum will reveal more.