Silicon Laboratories SI2493/57/34/15/04, SI2494/39 manual = Rtscontrolenable

Models: SI2493/57/34/15/04 SI2494/39

1 304
Download 304 pages 21.65 Kb
Page 268
Image 268

AN93

sCurrentTime = clock(); iPasses++;

if( sCurrentTime > (sStartTime + sWaitTime) )

 

 

{

 

 

 

 

strcat(cpErrorString, "Timeout of "); strcat(cpErrorString, cpResponse);

 

printf ("\n%s\n", cpErrorString);

 

 

strncpy(cpInput_test, cpInputBuffer, iCharCnt);

 

cpInput_test[iCharCnt]='\0'; //copy the received bytes for late display

 

return cpInputBuffer;

// we exit with the same input string we came in with

 

 

 

// because we time out.

 

}

 

 

 

}

 

 

 

 

};

 

 

 

 

// -------------------------------------------------------------------------

 

 

 

void AssertRTS(bool bAssert)

 

 

{

 

 

 

 

BOOL

bSuccess;

 

 

 

if(bAssert)

 

 

 

dcb.fRtsControl

= RTS_CONTROL_ENABLE;

// assert RTS

else

 

 

 

 

dcb.fRtsControl

= 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);

}

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);

}

268

Rev. 1.3

Page 268
Image 268
Silicon Laboratories SI2493/57/34/15/04, SI2494/39 manual = Rtscontrolenable