HOME - - - - - - - - - Other material for programmers - - - - - - - - - Pascalite, "How To Use It" main page

Pascalite hardware: Real Time Clock


Real Time Clock



The following assumes you've got your Pascalite set up and working. If it gives you what you want, great. Be advised, however, that this page is subordinate to others. Visit my Pascalite, "How To Use It" main page if you came drectly here and there are things "missing".




(You can show numbers on the LCD if you have one, but the following programs will also send at least part of every number to the four LEDs for those of you without an LCD display.)

If you have a clock module (RTC), power down the Pascalite, attach the clock module (Be careful about the rotation of the I2C connector), power up again, and try the following....

program IntTutRTC;
var bTH,bTM,bTS,bTHun:byte;

procedure NumToLCD(bTmp:byte);
begin
(See IntTut4)
end.

begin
def_out(d0,d1,d2,d3);
write(LCD,255); {Clears LCD}
settime(0,0,0,0);
write(counter,0);
repeat
gettime(bTH,bTM,bTS,bTHun);
NumToLCD(bTS);
bTS:=255-bTS;
write(portd,bTS);
delay(100);
until 4=5;
end.
Once all is well, the output will be 0, 1, 2, 3... up to 59, at which time it will roll over back to zero. The count will increment once per second. You might think that the line "delay(100)" would mean that the display would count faster than that. What is happening is that the program CHECKS the time 10 times a second, but displays the number of seconds passed, not the number of iterations of the loop.

While on the topic of the real time clock module: The crystal used in it seems a little vulnerable to me, especially as it is near a connector you will be plugging things into. I think that securing it to nearby components with a little silicone sealant would be a good idea.


To search THIS site.... (Go to the site's above, and use their search buttons if you want to seach them.)... Way to search this site without using forms
Search this site or the web powered by FreeFind

Site search Web search

Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows pc) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Link to editor's (Arunet) homepage
How to email or write this page's editor, Tom Boyd