I am using a Picaxe 28X1 fw A.0, a 24LC256, a DS1307 and 3 DS18B20's (with the Program Editor ver. 5.1.5) in an application that could be used in various situations to monitor and log time & temp., etc.
The LCD display (4 X 20) shows day of week, time, date, and the temperatures for three different areas of an aquaponics system. My existing code takes 3-4 seconds to go through the temperature read, time register read, and display parts of the program and return to the beginning. This is OK as I don't need to read the temps from the DS19B20's any quicker than that. The end user can see the various temperatures and time in "somewhat" realtime.
This is my first major Picaxe project. I've gotten the program to read the three DS18B20's relying heavily on phanderson's code, found some code for the DS1307 on this forum, and wrote my own three push button scheme to externally set the date, month, year, hour, DOW and minute. Dr_Acula is right, it takes a LOT of code to do that (1200+ lines of memory/code).
And now to work on the datalogging portion of the code.
However, my question is this: what would be the best way to arrange the program to take one reading per hour? I've poked at this long enough so that all the other code works as expected. As mentioned above it takes about three-four seconds to loop through the existing code, I've run out of variables to use, so I can't check the variables for the (say) seconds (b0) and minutes (b1) and have something like if b0 = 59 and b1 = 59 then take reading and write to the 24LC256 because the other parts of the code use the existing variable for other purposes;
With the firmware I have I think I can use flag5 as one of the variable "flags" but I really need two.
I've looked at the timer and timer variable, but the first time I read about it I thought I understood it, but now, after many additional reviews, I'm not quite sure of my own name anymore! Maybe that's the answer, but I just can't get my head around the timer yet.
I've tried setting flags using the memory in the on-board EEPROM such as:
pseudo code:
if minutes = 59 then goto already_set
if minutes = 59 then write value to eeprom
already_set:
(some other code)
read eeprom
if seconds = 59 and minutes = 59 then gosub take_reading
Unfortunately this reads an eeprom location about 28K times a day and I figure I'd blow out that eeprom location in about a month or so, unless only writes to an eeprom wear them out, but I think it's read OR write that wears out an eeprom location?
Have I written my self into the proverbial corner? Or can some clever soul tell me a concept that will allow me to allow the program to continue to run showing time, date and temperatures in almost realtime and log the temperatures and time into the 24LC256 once an hour, considering I may only have one variable left to use? (Please no code, just the idea/concept; more fun that way<g>)
Thanks,
Trav
The LCD display (4 X 20) shows day of week, time, date, and the temperatures for three different areas of an aquaponics system. My existing code takes 3-4 seconds to go through the temperature read, time register read, and display parts of the program and return to the beginning. This is OK as I don't need to read the temps from the DS19B20's any quicker than that. The end user can see the various temperatures and time in "somewhat" realtime.
This is my first major Picaxe project. I've gotten the program to read the three DS18B20's relying heavily on phanderson's code, found some code for the DS1307 on this forum, and wrote my own three push button scheme to externally set the date, month, year, hour, DOW and minute. Dr_Acula is right, it takes a LOT of code to do that (1200+ lines of memory/code).
And now to work on the datalogging portion of the code.
However, my question is this: what would be the best way to arrange the program to take one reading per hour? I've poked at this long enough so that all the other code works as expected. As mentioned above it takes about three-four seconds to loop through the existing code, I've run out of variables to use, so I can't check the variables for the (say) seconds (b0) and minutes (b1) and have something like if b0 = 59 and b1 = 59 then take reading and write to the 24LC256 because the other parts of the code use the existing variable for other purposes;
With the firmware I have I think I can use flag5 as one of the variable "flags" but I really need two.
I've looked at the timer and timer variable, but the first time I read about it I thought I understood it, but now, after many additional reviews, I'm not quite sure of my own name anymore! Maybe that's the answer, but I just can't get my head around the timer yet.
I've tried setting flags using the memory in the on-board EEPROM such as:
pseudo code:
if minutes = 59 then goto already_set
if minutes = 59 then write value to eeprom
already_set:
(some other code)
read eeprom
if seconds = 59 and minutes = 59 then gosub take_reading
Unfortunately this reads an eeprom location about 28K times a day and I figure I'd blow out that eeprom location in about a month or so, unless only writes to an eeprom wear them out, but I think it's read OR write that wears out an eeprom location?
Have I written my self into the proverbial corner? Or can some clever soul tell me a concept that will allow me to allow the program to continue to run showing time, date and temperatures in almost realtime and log the temperatures and time into the 24LC256 once an hour, considering I may only have one variable left to use? (Please no code, just the idea/concept; more fun that way<g>)
Thanks,
Trav