8253 at 100hz

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Ben_3D

8253 at 100hz

Post by Ben_3D »

Hi All,
well this is just a little anomoly..(excuse the spelling). As I've settup my 8253 timer chip to 100hz.

E.g.


    mov   al,36 ; outb(0x43, 0x36)
    out   43h,al   
   
    mov   al,0xe9    ; default is 0x0000 (65536) (18.2 per sec)
    out   40h,al ; out(0x40,countdown_lsb)         

    mov   al,0xe8    ; msb
    out   40h,al ; out(0x40 countdown_msb)

where the
1.19318/E9E8h gives us about 100hz or 100 times a second.

Now for test purposes I have all my interupts calling a single interrupt test function.....its only a test piece of code...does nothing but go into protected mode and set the timer chip then count the interrupts...now for every 100 times the interrupt is called, I poke a character onto the screen.

But it doesn't seem to be 100hz...does the timer chip call multiple interrupts?...as the counter 0...does counter 1 and 2 call interrupts irq?...which ones etc...as I know counter2 is audio?

Counter 1 is for ram refresh etc...but does this also cause an irq interrupt.

I mean I disabled all the interrupts except for irq 0.

e.g.
; Enable IRQ0 (timer) at the 8259 PIC chips, disable others:
;(Port 0x21 bit 0 is timer)
mov al, 0xFE
mov dx, 0x21
out dx, al ; outb(0x21, ~0x01)

mov al, 0xFF
mov dx, 0xA1
out dx, al ; outb(0xA1, ~0x00)


Its just strange that my timer chip is calling my interrupts at 1000 times a second or something.

Thanks for any ideas on this....any ideas would be great just of the top of your head would be great.

Thanks again

:)

Ben
fraserjgordon

Re:8253 at 100hz

Post by fraserjgordon »

If you are running it on Bochs or another emulator, the speed will appear to be higher as emulators are (usually) not realtime.

Maybe try it on a real PC? If you have already, I dunno.
Ben_3D

Re:8253 at 100hz

Post by Ben_3D »

Hi Fraser,
well I've tested the code on bochs, but can't test it on a real pc till tomorrow...nearly 1am now :)
Thanks again Fraser...I'll let you know how it goes tomorrow.

Ben
GLneo

Re:8253 at 100hz

Post by GLneo »

qemu is (i think) realtime :)
air

Re:8253 at 100hz

Post by air »

Try 2E9C (100hz) instead of E9E8 (20hz)
Post Reply