Hi: I've recently discovered that the code in Microchip TB028 (and the hardware real time clocks that are commonly being sold) only use the 4 year test for leap year. This will work OK till midnight Feb 28 2100. Although I'll be long gone by then it would be nice if a clock could be used to determine the day of the week for past and future dates so I'm looking for a routine that will determine if a year is a leap year and that works from 1582 to 9999+. A strategy might be to first do a couple of rotate right file operations on a 16 bit unsigned integer holding the year in a couple of bytes, checking for a carry on each rotate. A carry means not a leap year and stop any further calculation. Then a loop that starts with the shifted year (i.e.. starts with year/4) and then subtract 25 repeatedly (i.e. subtracting 100 from the unshifted year). If the loop terminates with a carry out it's a leap year (i.e. could only divide by 4). If the loop terminates with a zero remainder the year is divisible by 100 so might be a leap year, depending . . . If the loop counter rotated right twice generates no carries the year is divisible by 400 and is a leap year else it is not a leap year. I've worked on this all day and am still don't see light at the end of the tunnel. I find that status,C is not changed by dec or incf. That the meaning of status,C changes depending on what the prior operation was. So was hoping that someone has already figured out how to do it? PS - The LCD hardware commands for cursor and blink on/off are global in nature and so can not be on when the LCD is being updated since they would be applied to all the characters getting updated. That means they are not usable for clock displays. But software blinking, like in AN582, does work nicely. Have Fun, Brooke -- w/Java http://www.PRC68.com w/o Java http://www.pacificsites.com/~brooke/PRC68COM.shtml http://www.precisionclock.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist