(another) serial port question



While programming for the serial port, I've come across a strange
phenomenon. I can now successfully send an unsigned character array
sizeof 255 with hex values from 0 to FF over serial and receive this
array and display it. Strangely, however, 0x0D (13) being transmitted
appears as 0x0A (10) on the receiving end. My hardware setup is as
follows: two serial cards (one used to send - one used to receive) on
one Linux machine.

Example of problem:

Transmitted:

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
....etc.

Received:

0
1
2
3
4
5
6
7
8
9
A
B
C
A
E
F
....(rest received is ok)

Here are my setup options:

struct termios options;

fd= open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);

fcntl(fd, FSETFL, 0);
tcgetattr(fd, &options);
cfsetispeed(&options, B115200);
cfsetospeed(&options, B115200);
options.c_cflag |= (CLOCAL|CREAD);
options.c_lflag &=~(ICANON | ECHO | ECHOE | ISIG);
options.c_oflag &=~OPOST;
options. &= ~(IXON | IXOFF | IXANY);
options.c_cflag |= CRTSCTS;
options.c_cflag &= ~PARENB;
options.c_cflag &= ~CSTOPB;
options.c_cflag &= ~CSIZE;
options.c_cflag |= CS8;

tcsetattr(fd, TCSANOW, &options)

Since 10 and 13 are LF (Line Feed) and CR (Carriage Return)
respectively, I think I might be confusing the machine somehow. Any
input would be greatly appreciated.

Chris.

.



Relevant Pages

  • (another) serial port qusetion.
    ... While programming for the serial port, I've come across a strange ... I can now successfully send an unsigned character array ... My hardware setup is as ... one Linux machine. ...
    (comp.os.linux.hardware)
  • Re: (another) serial port question
    ... I can now successfully send an unsigned character array ... My hardware setup is as ... one Linux machine. ...
    (comp.os.linux.misc)
  • Re: Additional information
    ... I just saw that hdd is the cdrom drive on another linux machine. ... If you get errors on a CD, it could mean that the disk was not burned ... Isn't it strange that the same people that laugh at gypsy fortune tellers take economists seriously? ...
    (comp.os.linux.hardware)
  • Re: New Scientific Library - Lang?
    ... Strange... ... I used C# (with Mono) on my Linux machine. ... Linux is now the same as Windows - I should really pay more ...
    (comp.lang.cpp)