Bona Fide OS Development
http://forums.osdever.net/

problem with the pic
http://forums.osdever.net/viewtopic.php?f=4&t=215
Page 1 of 1

Author:  Sharpner [ Thu Mar 11, 2010 11:52 am ]
Post subject:  problem with the pic

Hi!

I somehow have a strange problem that I' dont understand...

I'm trying to enable the timer.. the code is from brans tutorial
but somehow it raises no interrupt..

in my case freq = 100;

Code:
void init_timer(int32u freq){
    int32u divisor = 1193180 / freq;
    int8u l = (int8u)(divisor & 0xFF);
    int8u h = (int8u)( (divisor>>8));
    outportb(0x43, 0x36);
    outportb(0x40,l);
    outportb(0x40,h);
    kprintf("Timer initialized! Low: %h High: %h Total: %h", l, h, divisor);
}


this is my code....

I also tried:
Code:
    int8u h = (int8u)( (divisor>>8) & 0xFF);


and this is the output:

Timer initialized! Low: 00000037 High: 0000005D Total: 00005D37

so this seems correct...
any ideas?

Author:  Primis [ Tue Jul 06, 2010 12:33 pm ]
Post subject:  Re: problem with the pic

Two things,
1. Do you have a working printf function?
2. Did you register a function in the IDT to handle the interrupt? In my case I have a function called timerHandler() that increments a variable called tick.

Author:  Sharpner [ Fri Jul 09, 2010 12:58 am ]
Post subject:  Re: problem with the pic

thanks for your answer.
I already got it working, I just forgot to enable interupts after the setup of my own table...

;)

bye
Sharpner

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/