Can someone help me configure my PIT to run at 1000 interrupts per second? Or is this even possible? I am having a hard time understanding what frequency it should run at.
Thanks, Matt
[Solved] 1000 PIT interrupts a second?
[Solved] 1000 PIT interrupts a second?
Last edited by PearOs on Thu Jan 30, 2014 12:41 am, edited 1 time in total.
Re: 1000 PIT interrupts a second?
Id imagine its 0 - 60 time is in here somewhere http://wiki.osdev.org/PIT
Re: 1000 PIT interrupts a second?
I did a "refresher" on the PIT wiki and I'm not really seeing my answer. I've read that article many times, and of course I read it before I asked my questionVolTeK wrote:Id imagine its 0 - 60 time is in here somewhere http://wiki.osdev.org/PIT
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: 1000 PIT interrupts a second?
I mean, seriously?;Input
; ebx Desired PIT frequency in Hz
Re: 1000 PIT interrupts a second?
Hi,
1000 IRQs per second should be entirely possible (as long as nothing in your OS disables IRQs for 1 ms or more).
What frequency it should run at depends on what you use it for and a lot of other things. For example, if you're only using it to keep track of "real time" (and not using it for "nano_sleep()" or scheduling or anything) then it should probably be set to a low frequency (e.g. 100 Hz or 1000 Hz); and if you're not using it to keep track of "real time" (and are using it for "nano_sleep()" and/or scheduling) then you probably shouldn't set it to any frequency at all (e.g. use "one shot mode").
Cheers,
Brendan
The PIT page in the wiki should be enough to figure out how to configure the PIT.PearOs wrote:Can someone help me configure my PIT to run at 1000 interrupts per second? Or is this even possible? I am having a hard time understanding what frequency it should run at.
1000 IRQs per second should be entirely possible (as long as nothing in your OS disables IRQs for 1 ms or more).
What frequency it should run at depends on what you use it for and a lot of other things. For example, if you're only using it to keep track of "real time" (and not using it for "nano_sleep()" or scheduling or anything) then it should probably be set to a low frequency (e.g. 100 Hz or 1000 Hz); and if you're not using it to keep track of "real time" (and are using it for "nano_sleep()" and/or scheduling) then you probably shouldn't set it to any frequency at all (e.g. use "one shot mode").
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
[Solved] Re: 1000 PIT interrupts a second?
Ok ok ok calm down. I asked the wrong question
I needed to know how many hertz would be 1000 miliseconds. Haha
Which is 1 miliseconds / 1000 = 0.001
1 second / seconds = hertz which 1 / 0.001 = 1000 hz!
Haha so if I set the pit to a frequency of 1193.18, I get what I want.
I needed to know how many hertz would be 1000 miliseconds. Haha
Which is 1 miliseconds / 1000 = 0.001
1 second / seconds = hertz which 1 / 0.001 = 1000 hz!
Haha so if I set the pit to a frequency of 1193.18, I get what I want.
Last edited by PearOs on Thu Jan 30, 2014 12:51 am, edited 2 times in total.
Re: 1000 PIT interrupts a second?
Hi,
1193181.666666 / 1 = 1193181.666666. This won't fit in the 16-bit counter, so you don't get what you want. The closest you will get is a count of 65536, which works out to 54.92541 ms between IRQs (or about 18.2065 Hz). The PIT can't go slower.
If you want 1 millisecond between IRQs, then 1193181.666666 / 1000 = 1193.181666. This will only fit if in a 16-bit counter if you round it to the nearest integer. The closest is a count of 1193, which works out to 1.11094 ms between IRQs (or about 9001.37 Hz). Notice that this is 11% more time between IRQs than you wanted. You don't get what you want.
Cheers,
Brendan
Um?PearOs wrote:Ok ok ok calm down. I asked the wrong question
I needed to know how many hertz would be 1000 miliseconds. Haha
Which is 1000 miliseconds / 1000 = 1
1 second / seconds = hertz which 1 / 1 = 1 hz!
Haha so if I set the pit to a frequency of 1193180, I get what I want.
1193181.666666 / 1 = 1193181.666666. This won't fit in the 16-bit counter, so you don't get what you want. The closest you will get is a count of 65536, which works out to 54.92541 ms between IRQs (or about 18.2065 Hz). The PIT can't go slower.
If you want 1 millisecond between IRQs, then 1193181.666666 / 1000 = 1193.181666. This will only fit if in a 16-bit counter if you round it to the nearest integer. The closest is a count of 1193, which works out to 1.11094 ms between IRQs (or about 9001.37 Hz). Notice that this is 11% more time between IRQs than you wanted. You don't get what you want.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: 1000 PIT interrupts a second?
Hahahaha I know I messed up lol, I checked my math. I seriously could use some coffee. Fixed now though.Brendan wrote:Hi,
Um?PearOs wrote:Ok ok ok calm down. I asked the wrong question
I needed to know how many hertz would be 1000 miliseconds. Haha
Which is 1000 miliseconds / 1000 = 1
1 second / seconds = hertz which 1 / 1 = 1 hz!
Haha so if I set the pit to a frequency of 1193180, I get what I want.
1193181.666666 / 1 = 1193181.666666. This won't fit in the 16-bit counter, so you don't get what you want. The closest you will get is a count of 65536, which works out to 54.92541 ms between IRQs (or about 18.2065 Hz). The PIT can't go slower.
If you want 1 millisecond between IRQs, then 1193181.666666 / 1000 = 1193.181666. This will only fit if in a 16-bit counter if you round it to the nearest integer. The closest is a count of 1193, which works out to 1.11094 ms between IRQs (or about 9001.37 Hz). Notice that this is 11% more time between IRQs than you wanted. You don't get what you want.
Cheers,
Brendan
Thanks Brendan