Hi all, im stuck on the display part of the alarm clock im working on. All works fine other than what is displayed on screen on the alarm side. The display shows on the top line of a 2x16 lcd the time from the rtc ds1307 the next line is supposed to show the alarm that is next due, that's one of two alarm times. Below you'll find code that Ive been playing with. Is there a command equivalent to the expression inbetween? eg: if the time is in between alarm 1 and 2 show display1, if alarm is in between 2 and 1 show display 2. I guess another possible issue is what happens at 23:59 or 00:00.thanks in advance

ALHR var byteALMIN var byteMinToAlarm[ALHR, ALMIN]: ; See if the Alarm time is earlier than our current time if so return how long until it would ring the next day if ((ALHR < HRS) or ((ALHR = HRS) and (ALMIN< MINS))) then return (ALHR-HRS+24)*60 + ALMIN - MINS endif ; else simple case that it will ring some time today return (ALHR-HRS)*60 + ALMIN - MINS

Warning typed on fly not compiled, probably buggy. Also can easily do without subroutines. Also can do without conversion to minutes to alarm, but this might make it easier to understand. Also could have done function without first test, by instead have the delta time variable be a signed variable. Do the calculation of the main return and if the value is < 0 add 24*60 to it...like:

hi again, a quick update as im back onto the project. i tried playing with your options but probably due to my limited programming knowledge they didnt work. my work around was to convert parameters to seconds and do a subtraction calculation to get the result.

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum