Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on using fconfigure -mode command for serial communication

Status
Not open for further replies.

khung

Programmer
Mar 22, 2002
2
US
I can't use the -mode option in the fconfigure Tcl command. It doesn't understand this option. I'm using Tcl v8.3.4. The manual doesn't talk about it either. I looked into the source file of tclIO.c and in the Tcl_GetChannelOption() and didn't see it parsed for the -mode option. Is it true that this option only available in v8.4a4.

The other question I have is what do I need to do to run the serial COM port in DOS. I've ported Tcl v8.3.4 to DOS. It appears that I have to provide my own DOS serial COM port function for this to work. I'd appreciate any pointers.
 
I'm not familiar with -mode but -translation works fine. What are you trying to do with -mode? Bob Rashkin
rrashkin@csc.com
 
I need to set the baud rate, parity bit, etc. for the serial port on PC which is done with the -mode option I believe based on what I read on the Tcl manual for fconfigure command.
 
According to my documentation (which is, I admit, the help file with the ActiveTCL download), teh -mode option (-mode baud,parity,data,stop
This option is a set of 4 comma-separated values: the baud rate, parity, number of data bits, and number of stop bits for this serial port. The baud rate is a simple integer that specifies the connection speed. Parity is one of the following letters: n, o, e, m, s; respectively signifying the parity options of ``none'', ``odd'', ``even'', ``mark'', or ``space''. Data is the number of data bits and should be an integer from 5 to 8, while stop is the number of stop bits and should be the integer 1 or 2. ) is associated with the "open" command. Bob Rashkin
rrashkin@csc.com
 
Actually, the -mode option is used with the fconfigure command, but documented under the open command. I think the documentation needs some "refactoring."

Anyway, the -mode option has been supported by the fconfigure command since version 8.0. I'm not sure what the problem might be. As a test, you can try querying the settings of a serial port and see whether you get back valid information. I got the following on my Windows 2000 system:

[tt]% [ignore]set fid [open COM2: r+][/ignore]
file8daf48
% fconfigure $fid -mode
1200,n,7,1
% fconfigure $fid -mode 9600,n,8,1
% fconfigure $fid -mode
9600,n,8,1[/tt]

I'm not quite sure what you meant by the statement that you've "ported Tcl v8.3.4 to DOS." Real, live MSDOS-style DOS without Windows XX? In that case, I'm afraid I won't be much help. David Gravereaux, davygrvy@pobox.com, is the only person I know of who's recently done much poking about with Tcl in a true MSDOS environment. You might check out the thread on the Google Groups archive and other related threads on the comp.lang.tcl USENET newsgroup (available through the Google Groups interface, to see if you can find some useful information. - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top