RE: Serielle Schnittstelle
- From
- Mathias Waack <mathias@...>
- Date
Hi all, On 24-Jul-2000 J|rgen Linder wrote: > hallo zusammen, > ich will ein C-Programm fuer die serielle Schnittstelle schrieben. > Dafuer muss man (ich habe nachgelesen) die Terminal-Parameter selber > setzen. > Die serielle Schnittstelle soll folgende Parameter haben: > 9600 Baud, Parity EVEN, 7 Datenbits, 1 Stopbit > Nun das Programm gekuerzt: > terminal_neu.c_iflag &= IBPCHK; IBPCHK kenne ich nicht, was tut das? > termianl_neu.c_cfalg |= CS7; Wo kommt denn dieser Schreibfehler her, hast Du das etwa abgetippt? > terminal_neu.c_cc[VTIME] = 600 c_cc[] ist vom Typ cc_t, welcher bei mir ein unsigned char ist. Die 600 duerfte fuer den etwas gross sein. > nun mein Problem: > alle Terminal-atribute-funktionen, wie > tcgetattr, tcsetattr, cfsetispeed, cfsetospeed und ioctl bringen > Return_code = -1 > der write bringt auch Return_Code -1, nur der open ist ok. > ich weiss nicht warum. Ich auch nicht, bei mir stimmt sonst alles. Ich sehe so spontan auch nicht, wo da der Fehler liegen koennte. Allerdings habe ich nur fluechtig drueber geschaut, ich hab im Moment wenig Zeit. Es tut wohl auch nicht das was Du willst: bash-2.03# stty -F /dev/ttyS0 -a speed 9600 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke # your program bash-2.03# stty -F /dev/ttyS0 -a speed 9600 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 0; time = 88; -parenb -parodd cs5 -hupcl -cstopb -cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig -icanon iexten -echo -echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke Gruss Mathias
Thread
In reply to: Serielle Schnittstelle Jürgen Linder <juergen.linder@...>