Not seeing any serial output after some additions to code: debugging code added

Hi all, have <2 yrs experience with arduino and about 3 years combined experience with C/C++ (over 17 years) so bear with me if my code looks like crap. Basically I combined a couple pieces of example code and wrote some of my own code for a project where an Arduino Uno (non-clone) and a Arduino Ethernet Shield (non-clone), combined with a Sainsmart 8 channel relay, and a 0-9,*,# pinpad, act as an alarm acknowledgement system to interface with a security camera system, where when a digital out on the cam system sends a message to the arduino, a buzzer and light (and possibly more) will go off, and a user will have to enter his pin acknowledgement code into the pinpad, which will be time/datestamped, and logged somehow (not doing that at the moment, just serial output). Anyway, can anyone take a look at my mess of code and see why I am not even getting the first serial output ("SETUP {") in setup()?? I started off with two distinct pieces of code that worked, one for the alarm/pinpad, and another for the ethernet shield and NTP / timezone stuff, but when I weaved them together, I get absolutely no serial output. I added debugging code to see how far I'm getting, and I've got absolutely nothing. When I add some serial output to example Blink, such as LED ON, LED OFF, it works fine. The NTP/ethernet shield code is working fine on its own too. I'm stuck and can't figure out what I need to do to determine what is wrong here.. I'm sure its something very simple that I'm just missing.

Also, when I compile this thing, I am using 22k/32k, if that matters, but I have to remove the ethernet shield every time I compile, and rejoin the boards (with the power off of course) to get it to upload otherwise I get the avrdude out of sync error.. Any ideas what this might be caused by? Serial is working fine, did a loopback test with pins 0-1 shorted and reset-ground shorted.

http://www.mus1cs.com/alarmack2b.txt

Any help/advice/comments appreciated! Thank you!

Alex

First possible cause to eliminate is RAM starvation, presuming you are on a '328. The code has a lot of string constants that are using up RAM. If it's not the cause of your current bug, it will become a problem soon enough.

Search the forum for how to use the F() macro, which moves strings to PROGMEM (flash memory).

Also search for "free ram" and you'll find code that will tell you how much RAM is free. If you don't have a few hundred bytes free for the stack, including any local variables you declare in your deepest call path, your program may run out of room.

-br

billroy:
First possible cause to eliminate is RAM starvation, presuming you are on a '328. The code has a lot of string constants that are using up RAM. If it's not the cause of your current bug, it will become a problem soon enough.

Thanks, it was definitely my huge 999 char strings that were causing me to run out of memory and not have enough for the serial writes. Yes, I'm on an Uno with a 328. A 999 char string would use 50% of the memory on an 2K SRAM Uno, right? and I was using at least 2 at a time for one routine where I only needed about 20-30 chars.. Haha. I trimmed those strings down to 50 chars and the serial writes are working normally. Just have a lot of debugging to do as I'm getting some funky chars in my 'charcode' strings again (records keypresses for Acknowledgement codes), bad null termination placement or something. When I hit a key on the keypad, it prints the digit and some weird characters. (Like when I hit 7, and I get "charcode: 7 ù+ ¢¯t2") Also For some reason now my keypad rows are working, but columns are broken again so each number I hit is 1,4,7 or * instead of the right column like 2,5,8,0 or 1,3,9,#. I have fixed this once already.. Forget what I did to be honest.

Looks like I will have to search out a board with a bit more memory than 1k for anything bigger than this project if I want to integrate a few larger libraries, or juggle a lot of floats, large strings, etc. But I will roll with the Uno for now and make it work for this little project, not a lot of processing going on, just very basic interfacing of components really. Maybe I'll look into a Mega2560 eventually when the need arises. Thanks again for the help!