
140 Embedded systems design
These devices can also provide a system tick signal for use by the
operating system.
Simulating a real-time clock in software
These can be simulated in software by programming a
timer to generate a periodic event and simply using this as a
reference and counting the ticks. The clock functions are then
created as part of the software. When enough ticks have been
received it updates the seconds counter and so on. There are two
problems with this: the first concerns the need to reset the clock
when the system is turned off and the second concerns the accu-
racy which can be quite bad. This approach does save on a special
clock chip ...