timer IRQ
RE:timer IRQ
18.2 times per second, and yes, you can change it
void timerSetFreq(short freq) {
long counter = PIT_FREQ / freq;
outportb(TIMER_CTRL, /*0x43*/TIMER0 + TIMER_WHOLE + TIMER_MODE2);
outportb(TIMER0_CNTR, counter % 256); // send LSB
outportb(TIMER0_CNTR, counter / 256); // send MSB
return;
}
Where:
PIT_FREQ = 0x1234DD
TIMER_CTRL = 0x43
TIMER0_CTRL = 0x40
TIMER0 = 0
TIMER_MODE2 = (1 << 1)
TIMER_WHOLE = (1 << 4) + (2 << 4)
There's more options to configure, of course. Any documentation on the PIT should explain them all. http://www.neuraldk.org/cgi-bin/download.pl?ndk contains a working example (timer.c,h)
Cheers,
Jeff
void timerSetFreq(short freq) {
long counter = PIT_FREQ / freq;
outportb(TIMER_CTRL, /*0x43*/TIMER0 + TIMER_WHOLE + TIMER_MODE2);
outportb(TIMER0_CNTR, counter % 256); // send LSB
outportb(TIMER0_CNTR, counter / 256); // send MSB
return;
}
Where:
PIT_FREQ = 0x1234DD
TIMER_CTRL = 0x43
TIMER0_CTRL = 0x40
TIMER0 = 0
TIMER_MODE2 = (1 << 1)
TIMER_WHOLE = (1 << 4) + (2 << 4)
There's more options to configure, of course. Any documentation on the PIT should explain them all. http://www.neuraldk.org/cgi-bin/download.pl?ndk contains a working example (timer.c,h)
Cheers,
Jeff