Well i seem to have a few problems getting the time to display correctly. It seems to display numbers which are close to (meaning 6 or 12 or 16 off from the real time), but not the numbers. the code seems to work fine for date/time values that are less than 10.
BTW...this is my first real experience with C, so my code is probably pretty bad. Helpful pointers are appreciated too.
Code:
http://babb.sytes.net/PUB/Tora%20OS/timefunction.txt
Pic of what happens:
http://babb.sytes.net/PUB/Tora%20OS/Tor ... 0time..JPG
Im a moron or something.....problems with time.
Re:Im a moron or something.....problems with time.
Hi it seems your'e making a mistake with BCD and decimal. The CMOS as far as i know uses BCD notation meaning 14 = 20 and 12 = 18 which is clearly showing on your picture.
in short try:
time_hours_tens = (time_hours >> 4) & 0x0F;
time_hours_ones = (time_hours >> 0) & 0x0F;
time_minutes_tens = (time_minutes >> 4) & 0x0F;
time_minutes_ones = (time_minutes >> 0) & 0x0F;
repeat above for all other cases(if statements are not needed anymore).
Greets,
Rene (RetainSoft)
in short try:
time_hours_tens = (time_hours >> 4) & 0x0F;
time_hours_ones = (time_hours >> 0) & 0x0F;
time_minutes_tens = (time_minutes >> 4) & 0x0F;
time_minutes_ones = (time_minutes >> 0) & 0x0F;
repeat above for all other cases(if statements are not needed anymore).
Greets,
Rene (RetainSoft)
Re:Im a moron or something.....problems with time.
so >> and << are like the shr and shl operators in ASM.
cool. Thanks a lot.
cool. Thanks a lot.