Specifications

AN93
Rev. 0.9 219
if (!bSuccess)
{ // Handle the error.
printf ("SetCommState failed with error %d.\n", GetLastError());
exit(1);
}
else
return;
}
void AssertDTR(bool bAssert)
{
BOOL bSuccess;
if(bAssert)
dcb.fDtrControl = RTS_CONTROL_ENABLE; // assert RTS
else
dcb.fDtrControl = RTS_CONTROL_DISABLE; // dis-assert RTS
bSuccess = SetCommState(hCom, &dcb);
if (!bSuccess)
{ // Handle the error.
printf ("SetCommState failed with error %d.\n", GetLastError());
exit(1);
}
return;
}
void Delay(long iMs)
{
clock_t wait;
// covert ms's to clock_t by mutiplying by CLOCKS_PER_SEC/1000
wait = (clock_t)(iMs*CLOCKS_PER_SEC)/1000;
clock_t goal;
goal = wait + clock();
while( goal > clock() )
;
}
void LoadAndSendPatch(void)
{