Serial Port: is my code wrong or something else?
Posted by jschna1 (jschna1), 17 July 2007Currently I need to send some commands down a serial port but when I send them nothing happens. Then I tried using fconfigure -mode to set the mode, but it throws an error that mode is not an acceptable argument (like its not recognizing the device as a serial port). And to top it off, when I try to read from the device the program just freezes indefinately.
Below is that section of my code, but the question is: is this code wrong or is my computer not able to communicate this way bc of the OS or tcl/tk version? I am running a Red Had Linux machine with tcl/tk 8.3 on it.
Posted by admin (Graham Ellis), 17 July 2007That fconfigure look very windows-like ...
Posted by jschna1 (jschna1), 17 July 2007This is what I get from the man page of open.
"If fileName refers to a serial port, then the specified serial port is opened and initialized in a platform-dependent manner. Acceptable values for the fileName to use to open a serial port are described in the PORTABILITY ISSUES section.
The fconfigure command can be used to query and set additional configuration options specific to serial ports (where supported):
This option is a..." (then it goes on to talk about all the other options and such)
and then in the Portability Issues section:
"Valid values for fileName to open a serial port are generally of the form /dev/ttyX, where X is a or b, but the name of any pseudo-file that maps to a serial port may be used. Advanced configuration options are only supported for serial ports when Tcl is built to use the POSIX serial interface. "
But I think that Red Hat is POSIX compatible, so that shouldn't be the problem, should it?
Posted by admin (Graham Ellis), 18 July 2007Have you tried the POSIX open?
set port [open /dev/ttyS4 RDWR]
Posted by jschna1 (jschna1), 18 July 2007I have; I even tried again thinking maybe I was wrong but same things happen: when writing nothing happens and the program freezes when reading.
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho