SPORT_SET_STATE
Run-Time Function: Sets the baud rate, parity,
data bits setting, and stop bits setting of the communications port.
Module: USE DFLIB
Syntax
- iresult = SPORT_SET_STATE (port [, baud]
[, parity] [, dbits] [, sbits])
- port
(Input) Integer. The port number.
- baud
(Optional; input) Integer. The baud rate of the port.
- parity
(Optional; input) Integer. The parity setting of the
port (0-4 = no, odd, even, mark, space).
- dbits
(Optional; input) Integer. The data bits for the port.
- sbits
(Optional; input) Integer. The stop bits for the
port (0, 1, 2 = 1, 1.5, 2).
Results:
The result is of type INTEGER(4).
The result is zero if successful; otherwise, a Win32 error value.
The following restrictions apply:
- The number of data bits must be 5 to 8 bits.
- The use of 5 data bits with 2 stop bits is an invalid combination,
as is 6, 7, or 8 data bits with 1.5 stop bits.
Note: This routine must not be used when any I/O
is pending. Since a read
operation is always pending after any I/O has been started, you
must first call SPORT_CANCEL_IO before port parameters can be
changed.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN
GRAPHICS WINDOWS DLL LIB
See Also:
SPORT_CANCEL_IO,
SPORT_GET_STATE,
Using the Serial I/O Port Routines,
and Communications, and Communications Functions, and SetCommState
in the Win32 SDK
Example
USE DFLIB
INTEGER(4) iresult
iresult = SPORT_SET_STATE( 2, 9600, 0, 7, 1 )
END