Re: rs232 tcl
From: Rolf Schroedter (me_at_privacy.net)
Date: 06/15/04
- Next message: RSeeger00: "Re: foreach enhancement?"
- Previous message: John Chambers: "Re: Goofiness on OSX"
- In reply to: Michael Schuster: "rs232 tcl"
- Next in thread: Michael Schuster: "Re: rs232 tcl"
- Reply: Michael Schuster: "Re: rs232 tcl"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 15 Jun 2004 16:17:14 +0200
Hmm, the problem with your question is that you are not setting all bits
of the tio flags, but you are taking the current settings and reset
some flags. Tcl's defaults are:
iostate.c_iflag = IGNBRK;
iostate.c_oflag = 0;
iostate.c_lflag = 0;
iostate.c_cflag |= CREAD;
iostate.c_cc[VMIN] = 1;
iostate.c_cc[VTIME] = 0;
Ok, let me guess:
Michael Schuster wrote:
> Hi,
> I'm running tcl with linux and want to open a rs232 - com with
> the same settings as with my c-progs.
> How do I open e.g. /dev/ttyS55 with the settings:
> tio.c_lflag &=~ (ECHO|ICANON|ISIG|IEXTEN);
That looks like you are selecting raw input.
Okay, that's Tcl's way to work with serial ports.
I would additionally recommend to
fconfigure $serial -translation binary
after opening the port.
> tio.c_iflag &=~ (ICRNL|BRKINT|IXON|ISTRIP|INPCK);
Again that's raw input, no character mapping, no break, no XON.
But, is there any secret, why you e.g. switch off IXON,
but don't touch IXOFF,IXANY ?
Why do you disable BRKINT but don't touch IGNBRK ?
Probably it works, because these flags aren't set,
but it seems to me that Tcl is more straight:
iostate.c_iflag = IGNBRK;
> tio.c_cflag &= ~(CSIZE| PARENB);
> tio.c_cflag = CS8 |CREAD| CLOCAL;
Disable parity, enable 8 bit char's, enable receiver
Okay that's typically done with
fconfigure $chan -mode bbbb,n,8,s
where bbbb=baud rate (you should know your baud rate)
and s=stop bits (you don't touch this but you should know).
> tio.c_oflag &= ~(OPOST);
That's raw output. That's what Tcl does. But again you probably want
no CRLF processing by Tcl's channel system:
fconfigure $serial -translation binary
> tio.c_cc[VMIN]=1;
> tio.c_cc[VTIME]=0;
That's Tcl's default, unless you do a
fconfigure $chan -timeout
> in tcl?
> Any help is welcome. Thanks in advance
> Michael
IMO everything looks fine, you should have no trouble to communicate.
I guess the problem is that you do not know your baudrate & stop bit
settings. Are you using some system defaults ?
Regards,
Rolf.
---------------------------------------------------------------
Rolf Schroedter, German Aerospace Center
Remove .nospam to reply: mailto:Rolf.Schroedter@dlr.de.nospam
- Next message: RSeeger00: "Re: foreach enhancement?"
- Previous message: John Chambers: "Re: Goofiness on OSX"
- In reply to: Michael Schuster: "rs232 tcl"
- Next in thread: Michael Schuster: "Re: rs232 tcl"
- Reply: Michael Schuster: "Re: rs232 tcl"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|