Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Jul 2009
expecting Serial port output to a buffer
with the following code i am expecting modem out put to buffer.
here its not responding.
Is it delay problem ??
kindly suggest the same.
char buffer; /* Input buffer */
/* send an AT command followed by a CR */
write(fd, "AT\r", 3);
/* read characters into our string buffer until we get a CR or NL */
bufptr = buffer;
while ((nbytes = read(fd, bufptr, buffer + sizeof(buffer) - bufptr - 1)) > 0)
bufptr += nbytes;
printf("nbytes = %d\n",nbytes);
if (bufptr[-1] == '\n' || bufptr[-1] == '\r')
/* nul terminate the string and see if we got an OK response */
*bufptr = '\0';
if (strncmp(buffer, "OK", 2) == 0)
Thanks in advance