- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
dear all:
i connected ttyS0(cyclone board console terminal) with my computer. when i send "0D"(HEX) to the board ,but i see "0A"(HEX) in NIOS2 SDK shell. I know the ASCII of "LF" is 0A ,"CR" is 0D. Can anyone help me to solve it??? thanks!!!!!Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use termios to change the behavior of the terminals.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
my code is:
struct termios options; fd=open("/dev/ttyS0",O_RDWR ); if(fd==-1) {printf("Cannot open ttyS0!!\n"); exit(0); } fcntl(fd,F_SETFL,0); tcgetattr(fd,&options); options.c_cflag |=(CLOCAL | CREAD);// cfsetispeed(&options,B9600); cfsetospeed(&options,B9600); options.c_cflag &= ~PARENB; options.c_cflag &= ~CSTOPB; options.c_cflag &= ~CSIZE; options.c_cflag |= CS8; //////////////options.c_cflag &= ~CNEW_RTSCTS; options.c_iflag &= ~(IXON | IXOFF | IXANY); options.c_iflag = IGNPAR | ICRNL; options.c_iflag |= INPCK; options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); options.c_oflag &= ~OPOST; //options.c_cc[VMIN]=1; //options.c_cc[VTIME]=0; tcflush(fd,TCIFLUSH); tcflush(fd,TCIOFLUSH); tcsetattr(fd,TCSANOW,&options); //tcsetattr(1,TCSANOW,&options); printf("Baudrate 9600 setting OK!!\n"); if (tcsetattr(fd,TCSANOW,&options) != 0) perror("SetupSerial failure!! \n");
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page