Weird DS1307 problem

Hi all,

below is the first few lines of my project

#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68

#define LOG_INTERVAL 53 // in seconds

if i change the LOG_INTERVAL to any number greater than 53 then my program stops communicating with the D1307

This has been driving me nuts for the last 2 hours. i had been testing my project with a log interval of 20 seconds. everything was fine and i had all the bugs worked out. so i wanted to change the log interval to 60 seconds and the DS1307 stopped working. i troubleshot it down to 53 or lower works and anything above stops working.

Can someone help me out here. seems like some kind of compiler error with the #defines.

Thanks

Jeff O'Brien

I think it's extremely unlikely to be a compiler error. Can you post the remainder of the code, or at least the section that uses the LOG_INTERVAL symbol?

Mikal

i can't post all of my code but i will try to find some sections that use LOG_INTERVAL.
Why though does the RTC work when the number is 53 or less. don't you think this is odd. the one has nothing to do with the other.
LOG_INTERVAL is just a number that i want to hard code at the beginning. why on earth would this number have anything to do with starting communication to the RTC. i don't know anything about compilers, and i just through that out there.

more to come with some more code snippets...

Thanks

Jeff

i think i figured the problem out but now i need to know what to do about it.
LOG_INTERVAL is also used to set up the size of some integer arrays. the higher the number the bigger the memory allocated for these arrays. i must be some how overflowing the available memory.

where do i go from here?

Thanks

Jeff

The scenario you describe is entirely consistent with the unpredictable behavior I associate with memory overflow. I don't think it's odd at all. If you have an array that grows in proportion to LOG_INTERVAL, there will assuredly be some value for LOG_INTERVAL that will cause unpredictable problems. It might as well be 53 as any other number. If this is the problem, you may, for example, be able to trim the size of the elements in these arrays somehow. But none of us can tell for sure if this is the case, or, if so, how to fix it, unless you are willing to post some of the code.

Mikal