[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RS-485 vs 232



Hi there,

Is there a difference (in software) between reading data from serial 3
(485) or serial 0 or 2 (232).
I have a program capturing binary data from serial 0 or 2.
If I switch to serial 3, CR and LF (0x0D and 0x0A) are replaced in the
data. I have the port opened in raw mode. This is the code for setting
the COM port options

tcgetattr(m_port,&options);
// Set baudrate to 115k2

cfsetispeed(&options,B115200);
cfsetospeed(&options,B115200);

// Enable the receiver and set local mode
options.c_cflag |= (CLOCAL | CREAD);

// Set character size to data bits and set no parity Mask the characte
size bits
options.c_cflag &= ~(CSIZE|PARENB);
options.c_cflag |= CS8;		// Select 8 data bits

// Disable hardware flow control
options.c_cflag &= ~CRTSCTS;
options.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
// Disable software flow control
options.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
			   |INLCR|IGNCR|ICRNL|IXON);

options.c_oflag &= ~OPOST;
// Timeout 0.1 sec for first byte, read minimum of 25 bytes
options.c_cc[VMIN]     = 0;
options.c_cc[VTIME]    = 1;

// Set the new options for the port
tcsetattr(m_port,TCSANOW,&options);

Any suggestions to what may be my problem?

Patrick