Tcl extended serial port configuration under Win32. Compiled uses Tcl's stubs mechanism. Version 1.20: Feb, 2001 ####################################################################### by Rolf Schroedter, German Aerospace Center, Institute of Space Sensor Technology and Planetary Exploration email: Rolf.Schroedter@dlr.de ####################################################################### Please feel free to use or modify this code for your own applications. This code comes without any warranty. Please send comments and bug reports to comp.lang.tcl or contact the author by e-mail. ####################################################################### Installation: Extract the content of the zip-file into a directory "WinCom" in your TCL library path (e.g. c:/my_tcllib). Load the extension with load c:/my_tcllib/wincom.dll or use the auto_path mechanism: lappend auto_path c:/my_tcllib package require WinCom ####################################################################### Procedures: wincom::help # print a little online-help wincom::config channel ?-option value? # configure an already open channel (see below) wincom::modemstatus channel ?-format fmt? # return ModemStatus of open channel # fmt=ascii|integer|both wincom::handle # return Win32 handle of channel wincom::priority ?value? # set/get process priority 1=high, 0=normal wincom::version # return WinCom version high.low (e.g. 0.9) wincom::config channel ?-option value? without options:return current settings valid options: -mode baud,parity,data,stop # 19200,n,8,1 (see fconfigure -mode) -dtr disable | enable | handshake # DTR (data-terminal-ready) control -rts disable | enable | handshake | toggle # RTS (request-to-send) control -dsr bool # output flow control DSR (data-set-ready) -cts bool # output flow control CTS (clear-to-send) -xonoff {bool bool} # input/output XON/XOFF protocol -xchar "\x11\x13" # XON/XOFF characters -xlimit {on_limit off_limit} # limits for XON/XOFF -timeout {read_tout write_tout read_mult write_mult} # timeout value for reading / writing 1 char (msec) -sysbuffer {read_buffersize write_buffersize} # system buffer size (default={4096 4096} -abort bool # whether communication should be stopped on errors -break bool # 1=set, 0=clear COM break For -timeout the following settings are made in DCB (Device Control Block) DCB.ReadIntervalTimeout = DCB.ReadTotalTimeoutConstant = value; DCB.ReadTotalTimeoutMultiplier = 0; wincom::modemstatus channel ?-format fmt? -format ascii(default) | integer | both integer flags: CTS=16 DSR=32 RING=64 RLSD=128 # Change process priority: not a good style, but I need it for my application # having a DOS programm running which eats all TCL performance wincom::priority ?value? without value: return current value = 0 or 1 with value: setup process priority to 1:HIGH or 0:NORMAL