インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス
Serial Port I/O Function: Sets the baud rate, parity, data bits setting, stop bits, and other settings of the communications port.
USE IFPORT
result = SPORT_SET_STATE_EX (port [,baud] [,parity] [,dbits] [,sbits] [,Binmode] [,DTRcntrl]
[,RTScntrl] [,OutCTSFlow] [,OutDSRFlow] [,DSRSense] [,OutXonOff] [,InXonOff] [,XonLim]
[,XoffLim] [,TXContOnXoff] [,ErrAbort] [,ErrCharEnbl] [,NullStrip] [,XonChar] [,XoffChar]
[,ErrChar] [,EofChar] [,EvtChar] [,fZeroDCB])
port |
(Input) Integer. The port number. |
baud |
(Input; optional) Integer. The baud rate of the port. |
parity |
(Input; optional) Integer. The parity setting of the port (0-4 = no, odd, even, mark, space). |
dbits |
(Input; optional) Integer. The data bits for the port. |
sbits |
(Input; optional) Integer. The stop bits for the port (0, 1, 2 = 1, 1.5, 2). |
Binmode |
(Input; optional) Integer. 1 if binary mode should be enabled; otherwise, 0. Currently, if this parameter is used, the value must be 1. |
DTRcntrl |
(Input; optional) Integer. 1 if DTR (data-terminal-ready) flow control should be used; otherwise, 0. |
RTScntrl |
(Input; optional) Integer. 1 if RTS (request-to-send) flow control should be used; otherwise, 0. |
OutCTSFlow |
(Input; optional) Integer. 1 if the CTS (clear-to-send) signal should be monitored for output flow control; otherwise, 0. |
OutDSRFlow |
(Input; optional) Integer. 1 if the DSR (data-set-ready) signal should be monitored for output flow control; otherwise, 0. |
DSRSense |
(Input; optional) Integer. 1 if the communications driver should be sensitive to the state of the DSR signal; otherwise, 0. |
OutXonOff |
(Input; optional) Integer. 1 if XON/XOFF flow control should be used during transmission; otherwise, 0. |
InXonOff |
(Input; optional) Integer. 1 if XON/XOFF flow control should be used during reception; otherwise, 0. |
XonLim |
(Input; optional) Integer. The minimum number of bytes that should be accepted in the input buffer before the XON character is set. |
XoffLim |
(Input; optional) Integer. The maximum number of bytes that should be accepted in the input buffer before the XOFF character is set. |
TXContOnXoff |
(Input; optional) Integer. 1 if transmission should be stopped when the input buffer is full and the driver has transmitted the XoffChar character; otherwise, 0. |
ErrAbort |
(Input; optional) Integer. 1 if read and write operations should be terminated when an error occurs; otherwise, 0. |
ErrCharEnbl |
(Input; optional) Integer. 1 if bytes received with parity errors should be replaced with the ErrChar character; otherwise, 0. |
NullStrip |
(Input; optional) Integer. 1 if null bytes should be discarded; otherwise, 0. |
XonChar |
(Input; optional) Character. The value of the XON character that should be used for both transmission and reception. |
XoffChar |
(Input; optional) Character. The value of the XOFF character that should be used for both transmission and reception. |
ErrChar |
(Input; optional) Character. The value of the character that should be used to replace bytes received with parity errors. |
EofChar |
(Input; optional) Character. The value of the character that should be used to signal the end of data. |
EvtChar |
(Input; optional) Character. The value of the character that should be used to signal an event. |
fZeroDCB |
(Input; optional) Integer. 1 if all settings of the communications port should be set to zero before parameters are set; otherwise, 0. |
The result type is INTEGER(4). The result is zero if successful; otherwise, a Windows* 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.
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.
USE IFPORT
INTEGER(4) iresult
iresult = SPORT_SET_STATE_EX( 2, 9600, 0, 7, 1, OutXonOff=1, InXonOff=1, &
XonLim=1024, XoffLim=512, XonChar=CHAR(17), XoffChar=CHAR(19), &
fZeroDCB=1) )
END
Communications, Communications Functions, and SetCommState in the Microsoft* Platform SDK