Hai, i am using lpc2368 microcontroller in my embeddd project. i am displaying the clock in lcd also using RTC calculation. i am stuck with a section in which we have to find the clock duration between end time and running time. the end time is obtained by transmitting it serially. the running time is the current rtc time and i am getting it
so please help me in this section i am attaching the running time section program
unsigned char hh[2],mm[2],ss[2]; hh[0]=(RTC_HOUR)/10+0x30; hh[1]=(RTC_HOUR)%10+0x30; mm[0]=(RTC_MIN)/10+0x30; mm[1]=(RTC_MIN)%10+0x30; ss[0]=(RTC_SEC)/10+0x30; ss[1]=(RTC_SEC)%10+0x30;
the following code of substraction of running time from end time will work numerically
hh[0]=(bus_time_msg[0]-hh[0])+0x30; hh[1]=(bus_time_msg[1]-hh[1])+0x30; mm[0]=(bus_time_msg[3]-mm[0])+0x30; mm[1]=(bus_time_msg[4]-mm[1])+0x30; ss[0]=(bus_time_msg[6]-ss[0])+0x30; ss[1]=(bus_time_msg[7]-ss[1])+0x30;
where the bus_time_msg[] is obtained serially
so please help me in this section
So, didn't my answer help? The only thing it didn't cover was what to do if you have dates and are using local times with daylight savings.
But you can you also calculate dates, when your source code so clearly only contains hours, minutes and seconds?