Нужно сгенерировать импульсы на с++ с определенной частотой, как собственно задать частоту, delay думаю не выход
Нашел свой старый сорс. PHP: #include <iostream> #include <Windows.h> #include <time.h> bool wait_micro(unsigned __int64 microseconds) { unsigned __int64 counter = 0, freq = 0, counter_stop = 0, last = 0; if(!QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(&freq))) //Это можно вынести наружу функции и вызывать только 1 раз return false; QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&counter_stop)); counter_stop += static_cast<unsigned __int64>(freq * microseconds / 1e6); do { last = counter; QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&counter)); if(last > counter) return false; } while(counter < counter_stop); return true; } int main() { //Проверка работоспособности - будем ждать 1000 раз по 1000 микросекунд //В сумме должно получиться 5 сек unsigned int needed_ms = 5000; clock_t start = clock(), end; for(unsigned int i = 0; i < needed_ms; i++) wait_micro(1000); //Wait for 1000 microseconds = 1 ms end = clock(); //Выводим, сколько надо было ждать, сколько прождали по факту и погрешность std::cout << "Wait finished, sleeped for " << (end - start) << " ms" << std::endl; std::cout << "Error: " << (static_cast<double>(abs(static_cast<long>(end - start - needed_ms))) / needed_ms) * 100.0 << "%" << std::endl; system("pause"); return 0; }