skmdmasud
Member
Hi..
I am making a timer clock with on and off timing setting using RTC DS1307 and Atmel atmega8. So far every thing work fine, i can read time, display it in 7 segment, store on and off time in RTC memory and recall it.
My problem is i cannot figure out how to match the ON and OFF time with current time and turn a relay on or off accordingly.
Lets say I have my current time in variable Min and Hr,
My on time in ONMin and ONHr and
off time in OFFMin and OFFHr.
The uC may loose power for several hour and when power is restored it should check with RTC and set its pin status accordingly.
What will be best approach to do the checking and set pin status.
Regards.
I am making a timer clock with on and off timing setting using RTC DS1307 and Atmel atmega8. So far every thing work fine, i can read time, display it in 7 segment, store on and off time in RTC memory and recall it.
My problem is i cannot figure out how to match the ON and OFF time with current time and turn a relay on or off accordingly.
Lets say I have my current time in variable Min and Hr,
My on time in ONMin and ONHr and
off time in OFFMin and OFFHr.
The uC may loose power for several hour and when power is restored it should check with RTC and set its pin status accordingly.
What will be best approach to do the checking and set pin status.
Regards.