Serial Monitor behaves strangly

I have a project, 13406 bytes of 32256 max. It does rather a lot and I have the serial monitor set up to give me a lot of debug info through Serial.print statements. This works fine however....it seems that when adding some extra code at this point, it makes the serial monitor to print garbage and stop entirely. In my current sketch I might have 500 messages printing to the screen perfectly fine, but then I add in my code a statement in the very beginning of the void loop that just initialises the time : setTime(22,50,0,25,01,2012);, try to run it and the Serial monitor just gives 2 lines of garbage and then stops. When I put the setTime in comments....all works fine and I get the prveious messages.

Then I tried to put an extra Serial.print("test line"); (commented out the settime). This works fine, I get al my debug info. But then I copy this statement 10 times and the Serial Monitor starts but interrupts a bit later.

I also tried to put in another valid void function in and got the same result. It looks as if their's a critical number of code and once this is exceeded, the Serial Monitor becomes unstable. Has anyone encounterd this before and is their a cause/solution ? I'm using an R3 Uno

We can't see your code, but my guess is, you've run out of RAM

Put your constant strings into PROGMEM

Ok Thanks,

I'll try that. Cheers !

If you are using 1.0, you can easily put your strings into PROGMEM with F():

Serial.print("test line")

becomes:

Serial.print(F("test line"));

James, I saw the F a while back. Do you know how it is implemented? Will duplicate strings be combined?

Nope, haven't looked into it yet.