Do you have a question? Post it now! No Registration Necessary
February 13, 2006, 5:26 pm

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
ioctl(fd,TCGETS,&options);
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;
options.c_lflag=0;
options.c_cc[VMIN]=0;
options.c_cc[VTIME]=1;
ioctl(fd,TCSETS,&options);
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?
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
ioctl(fd,TCGETS,&options);
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;
options.c_lflag=0;
options.c_cc[VMIN]=0;
options.c_cc[VTIME]=1;
ioctl(fd,TCSETS,&options);
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
- » Re: Fuzzy Logic Operating Systems
- — Next thread in » Embedded Linux
-
- » INTRUSION DETECTION SYSTEM
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » CR1616 en remplacement de CTL1616
- — The site's Newest Thread. Posted in » Electronics (French)
-