Programmable interval timer

from Wikipedia, the free encyclopedia

The Programmable Interval Timer ( PIT ) was originally a special component (chip) in the IBM PC that took care of the timing of processes . The timer chip used most frequently were the types 8253 and 8254 by Intel wide with three 16-bit counters.

Regardless of the computer speed, the PIT is always operated at a rate of (ideally) 1.19318181818… MHz; this is 1/3 of the color subcarrier frequency of the NTSC television system. This strange frequency was chosen in the first PCs from IBM, since a quartz with a multiple of the color carrier had to be available for the integration of a CGA graphics card, which could also be used as a monitor by television sets . The PIT frequency could then easily be obtained from this quartz by means of frequency division; this procedure was more favorable than using additional crystals, since with only one crystal in the circuit, no disturbing beats can affect the image signal, which would then have to be filtered out with additional circuitry. The CPU speed of the first PCs of 4.772727 MHz also resulted from such a consideration, it was 4/3 of the color subcarrier frequency.

In later, faster PCs without a television connection, the PIT then got its own crystal for compatibility reasons , which continued to run at the old speed. Today, a common crystal is usually used again, since improved frequency converters can now obtain almost any desired frequency from a single reference frequency with relative ease .

In today's PCs, the PIT functionality is housed in the chipset of the mainboard ; it is connected to the CPU via the LPC bus .

The PIT was in the original PC for

  • Periodic interruptions on IRQ 0 (PIT timer 0),
  • DRAM memory refresh (PIT timer 1),
  • Sound generation by the PC speaker (PIT-Timer 2)
  • and as a fail-safe timer ( NMI )

utilized. In today's PCs, the PIT only controls the speakers and (depending on the operating system version and age of the computer) the periodic interruptions.

For these functions there are ports 40 hex to 43 hex (or 64 to 67 decimal), via which the PIT can be programmed. It can work in different modes. A rough distinction can be made between repetitive and one-off processes. However, one-off processes are rarely used in practice and are only listed for the sake of completeness.

In standard mode, the timer counts down from the start value (maximum 65535) to 0 and starts over again with the following overflow. With each such overflow it sends a signal, the timer interrupt (IRQ0), to the processor . If you divide the clock frequency by the clocks until the next overflow, you get the frequency with which the IRQ0 is generated. Under MS-DOS and older Windows versions up to and including Windows 98 and Windows ME , the maximum value 65535 was loaded into the timer, so you get 1193181.8181… Hz / 65536 = approx. 18.2065 Hz. This is how an interval occurs of approx. 55 ms between calls to IRQ 0. More modern operating systems (Linux, Windows NT and descendants) use shorter intervals between 1 and 10 ms.

In general, in today's (2009) standard PC there are the following modules for the time control of processes: