function cportstate;
%function Params=cportstate(H) retrieves the configuration and timeout
%parameters of a serial or parallel port previously opened by cportopen. 
%The parameters are:
%
%H      - The port handle returned by cportopen.
%Params - A structure containing the following fields:
%
%Port Configuration:
%-------------------
%   BaudRate:     Specifies the device communication rate in bits per second.
%   ByteSize:     Specifies the bits per byte transmitted and received, 
%                 can be 4-8.
%   Parity:       Specifies the parity scheme. 0-4=no,odd,even,mark,space.
%                 Do not confuse this member with the fParity member, which 
%                 turns parity on or off.
%   StopBits:     Specifies the number of stop bits. 
%                 0 - 2 specify 1, 1.5 and 2 stop bits.
%   fOutX, fInX:  1, 0 software flow control (XON/XOFF) on/off.
%   fRtsControl:  Specifies the RTS flow control status. 1 - RTS line on,
%                 2 - RTS handshaking, 0 - RTS line off.
%   fOutxCtsFlow: CTS flow control. Using RTS/CTS flow control requires
%                 1 for this member and 2 for the fRtsControl member.
%   fOutxDsrFlow: DSR flow control state. DSR flow control is rarely used. 
%                 A typical port configuration has this member to be 0, 
%                 while enabling the DTR line.
%   fDtrControl:  DTR flow control status. 1 - DTR line on, 2 - DTR 
%                 handshaking, 0 - DTR line off.
%
%Port timeouts:
%--------------
%   ReadIntervalTimeout:
%                 The maximum number of milliseconds that can elapse between
%                 two characters without a time-out occurring with the 
%                 ReadIntervalTimeout member.
%   ReadTotalTimeoutMultiplier:
%                 For each read operation, this number is multiplied by the 
%                 number of bytes that the read operation expects to receive.
%   ReadTotalTimeoutConstant:
%                 This member is the number of milliseconds added to the 
%                 result of multiplying the total number of bytes to read by 
%                 ReadTotalTimeoutMultiplier. The result is the number of 
%                 milliseconds that must elapse before a time-out for the 
%                 read operation occurs.    
%   WriteTotalTimeoutMultiplier:
%                 For each write operation, this number is multiplied by the 
%                 number of bytes that the write operation expects to receive.
%   WriteTotalTimeoutConstant:
%                 This member is the number of milliseconds added to the 
%                 result of multiplying the total number of bytes to write 
%                 by WriteTotalTimeoutMultiplier. The result is the number 
%                 of milliseconds that must elapse before a time-out for the 
%                 write operation occurs.
%
%To assist with multitasking, it is common practice to configure 
%so that read operations immediately return with the characters to be read. 
%To do this, set ReadIntervalTimeout to -1 and set both 
%ReadTotalTimeoutMultiplier and ReadTotalTimeoutMultiplier to zero.

% Written by Eyal Doron, July 1999

