I'm not sure what's wrong, because I've debugged my code, and it does exactly what I ask it to. Here is the code I used to set the PIT frequency:
Code: Select all
; make sure frequency is 1 word max
and FREQ,0xFFFF
; divide 1193180 (0x1234DC) by frequecy to get divisor to send to PIT ( dx:ax / bx = ax remainder dx )
xor eax,eax
xor edx,edx
mov dx,0x0012
mov ax,0x34DC
mov ebx,FREQ
div bx
; save result
push eax
; tell the PIT we are about to send it a frequency divisor
mov al,0x36
out PIT_CMMD,al
; restore result
pop eax
; send low and high bytes of divisor (respectively) to PIT
out PIT_DAT1,al
shr ax,0x0008
out PIT_DAT1,al
FREQ is a double word in memory. It's value IS 100, just as I specified it to be in earlier code. I have verified this with much debugging. Also, the value I send to the PIT as a divisor is: 0x2E9B, which seems to be exactly correct. Okay... Now to the problem: Now that I've set the PIT frequency to 100, if I set up the ISR that handles IRQ 0 to ouput something whenever the PIT is divisible by 100, it goes way too fast. To get the ISR that handles IRQ 0 to output something approximately once every second, I have to output every time the PIT is divisble by 1825. This is WAY off... it should be 100, not 1825... Any suggestions as to why this is happening?
Brodeur235