October 2025
Beginner to intermediate
456 pages
10h 39m
English
The DMG has a built-in counter, which tracks the clock ticks of the CPU, and a timer feature that lets programs schedule interrupts at specific intervals in time. This chapter covers both in detail. While the counter is of limited use in general, it’s still good to know how it affects the timer and how we can leverage it as a basic random number generator. On the other hand, the timer is handy, because it gives us precise control over the timing of execution of our code. We’ll use the timer in various places in this book, including in the next chapter when we study serial communication.
The counter is a 16-bit register incremented at the CPU frequency, which is 4.194304 MHz. The upper 8 bits are accessible ...
Read now
Unlock full access