I'm trying to port some old Pascal code that I was handed, whose purpose is to control a digital I/O card, and I've run into a snag involving a wait function. Whenever sending a signal the programmer would do something like this
[Set the port status]
LoopDelay([a long integer])
[Set the next port status]
LoopDelay([next long integer])
etc.
LoopDelay looks like this:
procedure loopdelay(looping:longint);
var
counter,count : longint;
begin
for counter:=1 to looping do
inc(count);
end {loopdelay};
It looks to me like he did some math based on the processor speed and calculated how many times he would have to iterate through a loop to wait a certain amount of time. How can I figure out how long the wait is?
Additional information: The processor is a late 80s/early 90s 486 (according to wikipedia at between 20 and 66 MHz). The computer runs either DOS or an early Windows, and the code was compiled with Turbo Pascal 7. The two constants being passed to loopdelay are 1266 and 6328.
I should be visiting the machine soon, so hopefully I'll be able to find out the exact processor then. Ideally I would like a formula into which I can plug the clock speed.