Mixt-level exact delay

xiaoxiao2021-03-06  49

Using the 8253, 8254 programmable time spaced timer chip in the computer. There are three independent 16-bit counter inside the computer. The counter can be counted in binary or two-decimal (BDC). The counter generates 1193,180 pulses per second. Each pulse makes the number of the counter minus the number of the counter. The generation frequency is variable, and QueryperFormanceFrequency can be obtained, in general, is 1193180. QueryperFormanceCounter can get the current counter value. So as long as your computer is fast enough, theoretical accuracy can reach 1/1193180 seconds. Void querysleep (float millisecond) {_ large_integer bitmp; __ int64 qPart1, qpart2; double dfminus, DFTIM, DFFREQ;

QueryperformanceFrequency (& litmp); // »ñμã¼1¼¼êæ ÷ μä ± öóæμâêêêêêq = (Double) Litmp.quadpart;

QueryperFormanceCounter (& litmp); QPart1 = Litmp.quadpart;

Do {QueryperFormanceCounter (& Litmp); // »ñμãõö¹¹μqpart2 = litmp.quadpart;

DFMINUS = (Double) (qPart2-qPart1); DFTIM = DFMINUS / DFFREQ; // ê ± 4 ä2î} While (DFTIM <(MilliseCond / 1000);

转载请注明原文地址:https://www.9cbs.com/read-82594.html

New Post(0)