Master the fundamental concepts of device drivers & interrupts through this focused micro-challenge.
Channel 0 generates IRQ0 at a programmable rate. Write mode/control to port 0x43, then latch low/high bytes of divisor to port 0x40. For example, divisor 1193182 / 100 yields roughly 100 Hz ticks for a scheduler heartbeat.
nasmLoading…
The PIT output feeds IRQ0 on the master PIC. Until you remap the PIC, the default vector may conflict with CPU exceptions, so bring up remapping before unmasking IRQ0. If the divisor is programmed while the channel is running, latch the counter first to avoid glitches. Many hobby kernels use the PIT as the first periodic interrupt source because it needs no device-specific driver beyond I/O ports.
You will program the PIT divisor and verify IRQ0 fires at the expected rate. This exercise requires port 0x43/0x40 sequencing and connecting the interrupt to your existing ISR.
Implement PIT timer programming in C.
Requirements:
Test:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github