Baudrate issues

Hai all, i have written the following code to check my serial ports are working properlly or not.For this I am getting the data for the below given baud rates only: 1800

2400 19200 38400 115,200. i want to get the data for every baurdrate.Here what might be the wrong.For that i have to give any advanced options. code: /*sending program:*/

#include /* Standard input/output definations */ #include/* String function definations*/ #include/*Unix standard function definations*/ #include/*file control definations*/ #include/*error number definations*/ #include/*POSIX terminal control definations*/ int main() { int fd,i,a,n=0; struct termios options; char buff[1]; fd=open("/dev/ttyS0",O_RDWR | O_NOCTTY);/*opening with read-write and no control mode*/ if(fd==-1) perror("Unable to open /dev/ttyS0\n"); else { fcntl(fd,F_SETFL,0); tcgetattr(fd,&options); cfsetispeed(&options,B115200); cfsetospeed(&options,B115200); options.c_cflag |=(CLOCAL | CREAD); /*enabling the receiver*/ options.c_cflag &= ~PARENB / *Disabling the parity/* options.c_cflag &= ~CSTOPB; /*Disabling the stopbit*/ options.c_cflag &= ~CSIZE; /*Disabling the bit mask for data bits*/ options.c_cflag |=CS8; /*1 charecter = 8 bits*/ options.c_cflag |=(ICANON | ECHO | ECHOE); /*Enabling cananical echo and echo erase mode*/ options.c_oflag |=OPOST; /*Enabling Postprocess output*/ options.c_cc[VMIN]=1; /*Blocking stage for min of 1 charecter*/ options.c_cc[VTIME]=1; /*Blocking stage for min time is 1 msec*/ tcflush(fd,TCIFLUSH); /*Before appling the seetings beter to flush old settings*/ tcsetattr(fd,TCSANOW,&options); /*Applying new attributes*/ while(1) { i=fgetc(stdin); buff[0]=i; if(write(fd,buff,1)

Reply to
emb in linux
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.