L
Hi all,
I have a small, single task application to be ran on a PC system (currently
an old Pentium 75MHz).
I need to call a function at fast and precise time intervals, the data will
be output to LPT port and then converted to analog by using an external
DAC. Running good old DOS v3.3, I tried to reprogram the 1CH timer
interrupt by modifying the frequency divider but unfortunately it seems
that I cannot achieve anything like a rough microsecond interval.
I would like to get such a timer event so that I can then run the
application on different PCs with different CPU speed without having to
tune my application's loop.
My questions:
1: am I doing anything wrong with the timer reprogramming?
2: is there any alternate, simple and **tiny** solution? Everything (OS and
application) must fit on a 1.44Mb floppy.
I attached below some code written in old Turbo Pascal v5.5
thanks in advance
Luca Gallina
{-------------------------------------------------------------------------}
{$F+,S-}
procedure TimerISR; interrupt;
begin
do_my_task; { <-- my task goes here}
end;
{$F-,S+}
{-------------------------------------------------------------------------}
begin { main }
{--- reprogram the Timer0 interval ---}
RegDivider:= $0001; { <-- assign here timer divider, timer should
hopefully overflow just after counting "1"}
port[$43]:= $36;
port[$40]:= RegDivider and $00FF;
port[$40]:= RegDivider shr 8 and $0FF;
{--- replace the Timer0 interrupt service routine ---}
getintvec($1C, ISR_OldAddress);
setintvec($1C, @TimerISR);
{--- main loop ---}
while not KeyPressed do
begin
end;
{--- restore the default Timer0 interrupt service routine before
terminating---}
RegDivider:= $FFFF; { <-- back to the usual 65535 divider}
port[$43]:= $36;
port[$40]:= RegDivider and $00FF;
port[$40]:= RegDivider shr 8;
setintvec($1C, ISR_OldAddress);
end.
I have a small, single task application to be ran on a PC system (currently
an old Pentium 75MHz).
I need to call a function at fast and precise time intervals, the data will
be output to LPT port and then converted to analog by using an external
DAC. Running good old DOS v3.3, I tried to reprogram the 1CH timer
interrupt by modifying the frequency divider but unfortunately it seems
that I cannot achieve anything like a rough microsecond interval.
I would like to get such a timer event so that I can then run the
application on different PCs with different CPU speed without having to
tune my application's loop.
My questions:
1: am I doing anything wrong with the timer reprogramming?
2: is there any alternate, simple and **tiny** solution? Everything (OS and
application) must fit on a 1.44Mb floppy.
I attached below some code written in old Turbo Pascal v5.5
thanks in advance
Luca Gallina
{-------------------------------------------------------------------------}
{$F+,S-}
procedure TimerISR; interrupt;
begin
do_my_task; { <-- my task goes here}
end;
{$F-,S+}
{-------------------------------------------------------------------------}
begin { main }
{--- reprogram the Timer0 interval ---}
RegDivider:= $0001; { <-- assign here timer divider, timer should
hopefully overflow just after counting "1"}
port[$43]:= $36;
port[$40]:= RegDivider and $00FF;
port[$40]:= RegDivider shr 8 and $0FF;
{--- replace the Timer0 interrupt service routine ---}
getintvec($1C, ISR_OldAddress);
setintvec($1C, @TimerISR);
{--- main loop ---}
while not KeyPressed do
begin
end;
{--- restore the default Timer0 interrupt service routine before
terminating---}
RegDivider:= $FFFF; { <-- back to the usual 65535 divider}
port[$43]:= $36;
port[$40]:= RegDivider and $00FF;
port[$40]:= RegDivider shr 8;
setintvec($1C, ISR_OldAddress);
end.