Stopky v PC
Luky
luky
Středa Březen 17 11:48:37 CET 2004
Perioda vyvolavani INT08 je dana zakladnim kmitoctem PIT, ktery je 1193181D
(1234DDh) Hz. Tento kmitocet se nasledne deli (zakladni nastaveni delicky je
0, tj. 65536, 1193181/65536=~18.2Hz). Zmenou delici konstanty se da
nastavit napr. 100Hz, 1000Hz apod. Dosahovane rozliseni pri mereni casu muze
byt pak radove vetsi nez cca 50ms(18.2Hz). Jen je potreba davat pozor (i
kdyz to neni bezpodminecne nutne), aby se vyvolavala puvodni rutina
preruseni ve spravnych intervalech (cca 18.2x za sekundu).
Samozrejme uvazuji pouziti pod DOSem, pod Win by to asi takhle jednoduse
neslo.
Prikladam rutiny v Pascalu pro ilustraci nastaveni PITu. (zdroj: PC-GPE)
S pozdravem
Lukas Grepl, OK2WDT
procedure SetTimer(TimerHandler : pointer; frequency : word);
begin
clock_ticks := 0;
counter := $1234DD div frequency;
Port[$43] := $34; { Set the PIT channel 0 frequency }
Port[$40] := counter mod 256;
Port[$40] := counter div 256;
end;
procedure CleanUpTimer;
begin
Port[$43] := $34;
Port[$40] := 0;
Port[$40] := 0;
end;
procedure Handler; Interrupt;
begin
{ DO WHATEVER WE WANT TO DO IN HERE }
Write('*');
clock_ticks := clock_ticks + counter; { Adjust the count of clock ticks }
if clock_ticks >= $10000 then { Is it time for the BIOS handler to do it's
thang? }
begin
clock_ticks := clock_ticks - $10000;
asm pushf end;
BIOSTimerHandler;
end
else { If not then just acknowledge the interrupt }
Port[$20] := $20;
end;
Další informace o konferenci Hw-list