Here is the
code I used for reading from the serial but it's not working
I also tried it without the "do -- while " (only using the read sentence) but it also didn't work . Is there anyone who could help me ? # include <stdio.h> # include <unistd.h> # include <fcntl.h> # include <sys/ioctl.h> # include <sys/wait.h> # include <string.h> # include <termios.h> # include <stdlib.h> # include <errno.h> int main(void) { int fd; int n; char recv_char; int m; fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY); if (fd == -1) { perror("open_port: unable to open /dev/ttyS0 - "); } else fcntl (fd, F_SETFL, FNDELAY); do { /* wait for a char to arrive */ m=read(fd, &recv_char, 1); } while (m != 1); printf ( "%c",recv_char); return (recv_char); return (fd); } __________________________________________________________________
MOHAMED RAOUF ICQ#: 44365427
__________________________________________________________________ |
Attachment:
online?icq=44365427&img=21
Description: Binary data