How to implement a microsecond resolution Delay?
Falk0ner, вс, 06/07/2008 - 15:34.
// Wait 0.2ms
procedure PerformanceDelay;
var
hrRes, hrT1, hrT2, dif: Int64;
begin
if QueryPerformanceFrequency(hrRes) then
begin
QueryPerformanceCounter(hrT1);
repeat
QueryPerformanceCounter(hrT2);
dif := (hrT2 - hrT1) * 10000000 div hrRes;
until dif > 2;
end;
end;
procedure PerformanceDelay;
var
hrRes, hrT1, hrT2, dif: Int64;
begin
if QueryPerformanceFrequency(hrRes) then
begin
QueryPerformanceCounter(hrT1);
repeat
QueryPerformanceCounter(hrT2);
dif := (hrT2 - hrT1) * 10000000 div hrRes;
until dif > 2;
end;
end;
Взято с сайта http://www.swissdelphicenter.ch/en/tipsindex.php
Отправить комментарий