Hi All,
I am working with a big LED display which interfaces with the PC by RS232 (9600 baud,no parity , 2 stop bits , 8 bit, no hardware flow control ). I am trying to write my own application using cygwin on vista using open , read and write function calls. Every thing works data is comming out of com2 but is not read by the LED display , I have written a basic programm which sends data to the LED display this works. I think it is something to do with the way I configure the serial port, can anyone check my code to initialise the port -
s->connected=0; /* reset in case we fail to connect | O_NOCTTY */
s->fd = open("/dev/ttyS1", O_RDWR | O_NOCTTY | O_NDELAY); if (s->fd == -1) return 0; else fcntl(s->fd, F_SETFL, FASYNC);
//fcntl(s->fd, F_SETFL, 0);
tcgetattr(s->fd, &options);
/* go to 9600 baud */ cfsetispeed(&options, B9600); cfsetospeed(&options, B9600);
options.c_cflag |= (CLOCAL | CREAD); /* enable */
options.c_cflag &= ~PARENB; /* 8N1 */ options.c_cflag |= CSTOPB; options.c_cflag &= ~CSIZE; options.c_cflag |= CS8; //options.tcflag_t |= CIGNORE ; options.c_cflag &= ~CRTSCTS; options.c_cflag &= ~CRTSXOFF;
/* set all of the options */ tcsetattr(s->fd, TCSANOW, &options);
s->connected=1; return 1;
the other thing could be the serial cable and DTE -DCE set up I have ruled it out by testing with TX connected with RX of the LED display and vice versa. ANy help is appreciated. thanks Rate