Specifications
AN93
Rev. 0.9 215
printf("%02x ", (unsigned char)cpInput_test[i]);printf("**%d ",
*cpInputRd);
//Alternatively use CTS
Delay(150);
do{ // flush out the bytes for last RX packets.
BOOL bError = !ReadFile(hCom, cpInputWr, 1, &ulNoOfbytes, 0); //
ulNoOfbytes=1
printf("%02x ", (unsigned char)cpInputWr[0]);
}while (ulNoOfbytes); printf("\n");
AssertRTS(true); printf("RTS=1 Tx "); //RTS=1 for transmitting
Delay(50); // morrie 01/20/06
iLength = strlen(caRR_PKT_STR);
for (i=0; i<iLength; i++)printf("%02x ", (unsigned char)caRR_PKT_STR[i]);
printf("\n");
WriteFile(hCom, caRR_PKT_STR, iLength, &ulNoOfbytes,0); //Tx RR message
Delay(100); //Delay x ms to complete TX sending before
set RTS=0 for RX
}
return;
}
// ---------------------------------------------------------------------------------
----
// Use this call to check CTS status
// DWORD iEVentMAsk; // wait for EV_CTS
// BOOL WaitCommEvent(HANDLE hFile, &iEVentMAsk, LPOVERLAPPED lpOverlapped);
// ----------------------------------------------------------------
void SetupSerPort()
{
BOOL bSuccess;
hCom = CreateFile(pcCommPort, GENERIC_READ | GENERIC_WRITE, 0,
NULL, OPEN_EXISTING, 0, NULL);
if (hCom == INVALID_HANDLE_VALUE)
{ // Handle the error.
printf ("CreateFile failed with error %d.\n", GetLastError());
exit(1);
}