Thread(...) { CDlg* appPtr = (CDlg*)lpVoid; while(true) { if(appPtr->m_StartSending == true) { dInitialCount = GetTickCount(); if(dPRCount == 0) dPRCount = GetTickCount(); dCurrentCount = GetTickCount(); Difference = (dCurrentCount - dPRCount); if(Difference >= 100) { appPtr->SendPR(i); //Send message via serial port every 100ms using WriteFile() // Sleep of 1 sec after writefile to ensure data is received dPRCount = 0; dCurrentCount = 0; } } }
SendPR(i) { // transmitting my information Write(...); // Delay of 1 millisec to ensure data is received Sleep(1); }
Windows OS
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)