silly question about serial port

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

i want to communicate with a serial device in raw mode
when ever i want to send 10 40 40 16 i want to received back e5(hex)
but when i read from /dev/ttyS0 i get 44(hex).

i don't want to use any flow control and baud rate is 19200

my initialization into /dev/ttyS0 is

    cfsetispeed(&options, B19200);
    cfsetospeed(&options, B19200);
    options.c_cflag |= ( CLOCAL | CREAD | HUPCL);
    options.c_cflag |= PARENB;
    options.c_cflag &= ~PARODD;
    options.c_cflag &= ~CSTOPB;
    options.c_cflag &= ~CSIZE;
    options.c_cflag |= CS8;
    options.c_cflag &= ~( CRTSCTS );
    options.c_iflag |= ( INPCK );
    options.c_iflag &= ~( IXON | ICRNL );    
    options.c_oflag = 0;

i have the sending data in array 'data' so i do
write(fd,data,5);   //from sniffer in the other box i see that sending
            //is ok

i receive data  into array 'received_data'
read(fd,received_data,1);  //sniffer in the other box tells me that it has
               //send the desired e5 character.

when i printf 'received_data[0]' in hex i don't get e5 but 44

any ideas?

Site Timeline