flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Timers Goto page 1, 2 Next |
Author |
|
rhyno_dagreat 28 Nov 2007, 03:24
Jokes aside, though, go here: http://www.osdever.net/bkerndev/index.php and check the tutorial on the PIT. It's pretty handy. |
|||
28 Nov 2007, 03:24 |
|
dosin 28 Nov 2007, 03:30
lol! thanks!
|
|||
28 Nov 2007, 03:30 |
|
rhyno_dagreat 28 Nov 2007, 03:32
No problem! Though I forgot that the timer IRQ went off every 18.222 seconds, though I knew it was constantly on (even from the start) because when I had it activated in my OS it would constantly display a message and not give room for anything else to operate. I have to re-write it before I enable it again. XD
|
|||
28 Nov 2007, 03:32 |
|
LocoDelAssembly 28 Nov 2007, 03:55
Quote:
Maybe I'm misreading you but, wouldn't it be 18.222 interrupts per second rather than the timer turns off every 18.222 seconds? |
|||
28 Nov 2007, 03:55 |
|
bitRAKE 28 Nov 2007, 04:22
IIRC, there is a way to acknowledge the IRQ has been handled - resetting the delay counter. Otherwise, it fires off every chance it gets.
|
|||
28 Nov 2007, 04:22 |
|
rhyno_dagreat 28 Nov 2007, 05:02
LocoDelAssembly wrote:
You're right. I apologize, though what you said is actually what I meant to type. |
|||
28 Nov 2007, 05:02 |
|
sinsi 28 Nov 2007, 05:20
Try this file - I can't remember where I got it from, but it's pretty good.
Although I would use 1193 instead of 1192 - this gives 1000.15 vs 1000.99
|
|||||||||||
28 Nov 2007, 05:20 |
|
edfed 28 Nov 2007, 05:55
1000 int/second is too much
int spend time push eflag, push eip, push cs pop cs, pop eip, pop eflag these 6 inherent instructions are repeat 1000 time/second. it's too much for my OS, i'm thinking about a 110Hz timer; cnt=10847,1 closer to 110 int/second, musical frequency 'LA' or 24int/second for cinema FPS, cnt=49715,19{6} or a real integral int/second, to see later. PS: one strange thing, 1193182Hz is 1234DEh, note the 1234 string amazing, no? |
|||
28 Nov 2007, 05:55 |
|
sinsi 28 Nov 2007, 06:07
That's the beauty of the code - just change "mov ax,1192" to your chosen divisor and you can go from 18.2 to 1,193,182(theoretically), but the comments say that a pentium 100(?) can run at 100,000 ticks/sec.
push,push,push/pop,pop,pop - this takes no time now (or at least very little) - it's all automatic. |
|||
28 Nov 2007, 06:07 |
|
roboman 28 Nov 2007, 07:20
http://www.powerbasic.com/files/pub/asm/8259.ZIP
is a good doc on the int chip on the pc. Also if you dig around in a lot of stepper motor control programs they use either the 8259 timer or the pent cpu built in timer |
|||
28 Nov 2007, 07:20 |
|
dosin 28 Nov 2007, 08:00
Thanks- I'll take a look!
|
|||
28 Nov 2007, 08:00 |
|
edfed 28 Nov 2007, 14:00
in case of cached stack, it is really fast. but takes at least 6 PUSH/POP, 6 cpu cycles.
but if the stack is in real ram, then you must wait RAM latency, it's a long time. more than 6 cpu cycle ok , it's only 6 Push/pop, but in am, we shall code the fatest program as possible. what about the 44100Hz audio sample rate? how to make this one stable? is it integrated in the sound chip or the DMA controler? |
|||
28 Nov 2007, 14:00 |
|
Dex4u 28 Nov 2007, 17:44
If in your clocktick IRQ it increaser's a counter every tick, from startup of your OS.
You just need function that gets count. Example Code: mov ax,6 ;function numberint 40h ; int 40 like dos in 21hmov dword[StartCount],ebx ;returns tick so far in EBX;do what you want timed heremov ax,6 ;function numberint 40h ; int 40 like dos in 21hsub ebx, dword[StartCount] ;sub the start ticksmov dword[StopTime],ebx ; save the ticks that have passed. |
|||
28 Nov 2007, 17:44 |
|
edfed 14 Dec 2007, 04:03
value for the nearest integral value of 100
1193182 / 14551 = 82Hz good because integral, no decimal... |
|||
14 Dec 2007, 04:03 |
|
revolution 14 Dec 2007, 04:51
edfed wrote: value for the nearest integral value of 100 |
|||
14 Dec 2007, 04:51 |
|
edfed 14 Dec 2007, 05:21
erf
by googling besenham, just now, i discover that MY line algorithm is the besenham one... i didn't know that, it's not the besenham algorithm but the edfed one... i reinvent the weel everydays, and finally, i see that my weel is circular like all others what you speak about is not the besenham algorythm, it's a digital PLL, something that regulate the frequency... |
|||
14 Dec 2007, 05:21 |
|
revolution 14 Dec 2007, 06:46
edfed wrote: what you speak about is not the besenham algorythm, it's a digital PLL |
|||
14 Dec 2007, 06:46 |
|
edfed 15 Dec 2007, 05:46
hum, by using this in timer, one very bad thing is the quantification error, because the time of periods is variable.
|
||||||||||
15 Dec 2007, 05:46 |
|
revolution 15 Dec 2007, 06:54
edfed: You show an extreme case where the two frequencies are very close. Of course the difference will create what you see, it is called clock jitter. I already mentioned it will be 1 unit of difference maximum. So expect some severe jitter if the two frequencies are similar.
In any normal application, good programmers would to chose an interrupt frequency at least 10 times, and preferably >=20 times, the desired output frequency. That way the jitter is small enough to become imperceptible. Using ~1ms interrupt with 25 or 30 fps is a very good solution. |
|||
15 Dec 2007, 06:54 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.