A N 9 3
280
Rev. 1.4
char *cpResponse, int iTimeoutMs)
{
unsigned long ulNoOfbytes;
strcpy(cpOutBuffer, cpCommand);
WriteFile(hCom, (long *)cpOutBuffer, strlen((char *)cpOutBuffer),
&ulNoOfbytes, 0);
if(iTimeoutMs)
cpInBuffRd = WaitForResponse(cpResponse, cpInBuffRd, iTimeoutMs);
if(!cpInBuffRd)
exit(0);
return cpInBuffRd;
}
// Check for a specific response in the input buffer, and return ptr to what
// follows. If this times out or ERRORs before the response is found then a
// NULL is returned; It keeps reading the ser channel while waiting
char *WaitForResponse(char *cpResponse, char *cpInputBuffer, int iTimeOutInMs)
{
unsigned long ulNoOfbytes;
clock_t sStartTime = clock();
clock_t sCurrentTime;
// covert wait time in ms's to clock_t by mutiplying by CLOCKS_PER_SEC/1000
clock_t sWaitTime = (clock_t)(iTimeOutInMs*CLOCKS_PER_SEC)/1000;
int iPasses = 0;
int iCharCnt =0; // set to 0
while(1)
{
char cTemp = *cpInputWr;
*cpInputWr = 0;
char *cpFound = strstr(cpInputBuffer, cpResponse);
*cpInputWr = cTemp;
if(cpFound)
{//copy the received bytes for late display
strncpy(cpInput_test, cpInputBuffer, iCharCnt);cpInput_test[iCharCnt]='\0';
return c strlen(cpResponse);
}
// Setup a 50 ms timeout for reads
sCOMMTIMEOUTS.ReadIntervalTimeout = 0;
sCOMMTIMEOUTS.ReadTotalTimeoutMultiplier = 0;
sCOMMTIMEOUTS.ReadTotalTimeoutConstant = 50;
sCOMMTIMEOUTS.WriteTotalTimeoutMultiplier = 0;
sCOMMTIMEOUTS.WriteTotalTimeoutConstant = 0;
SetCommTimeouts(hCom, &sCOMMTIMEOUTS);
// Read the serial port
//cpInputWr has char from the port
BOOL bError = !ReadFile(hCom, cpInputWr, 1, &ulNoOfbytes, 0);
iCha= ulNoOfbytes; i=ulNoOfbytes;
Содержание Si2404
Страница 2: ...AN93 2 Rev 1 4 ...
Страница 27: ...AN93 Rev 1 4 27 Figure 7 Parallel Interface Read Timing Figure 8 Parallel Interface Write Timing ...
Страница 200: ...AN93 200 Rev 1 4 Figure 31 TAM Handset and Speakerphone Voice Paths ...
Страница 201: ...AN93 Rev 1 4 201 Figure 32 Si3000 Codec Gain and Signal Selection Options ...
Страница 290: ...AN93 290 Rev 1 4 Figure 57 256 Band Spectral Display Figure 58 2048 Band Spectral Display ...
Страница 305: ...AN93 Rev 1 4 305 Figure 76 Parallel or SPI Port Interrupt Service Flowchart ...