Java Reference
In-Depth Information
Table 23.1
Pin assignments for the DB9 serial connector.
Pin
Name
Abbreviation
Direction
Function 1
1
Carrier Detect
CD
In
Modem &
destination
modem connected
2
Receive Data
RD
In
Data from modem
3
ransmit Data
TD
Out
Data to modem
4
Data Terminal
Ready
DTR
Out
Computer ready to
send & receive
5
Ground
GND
Common
-
6
Data Set Ready
DSR
In
Modem ready to
send & receive
7
Request to Send
RTS
Out
Computer waiting
to send
8
Clear to Send
CTS
In
Modem ready to
receive
9
Ring Indicator
RI
In
Modem says phone
is ringing
1
The pin function descriptions here are for the case of a computer con-
nected to a modem.
The SerialPort class provides a single method to set the baud rate, number
of data bits, number of stop bits, and the parity:
void SetSerialPortParams (int baud, int dataBits, int
stopBits, int parity)
If a port does not support any of the values passed in the parameters, the method
throws the UnsupportedCommOperationException .
The SerialPort class includes a set of constants to use for these parameters,
such as:
DATABITS - 7
DATABITS - 8
STOPBITS - 1
STOPBITS - 2
PARITY - NONE
PARITY - EVEN
PARITY - ODD
The two devices connected via the serial line need flow control settings to deter-
mine who is sending and who is receiving and when to switch between the two
states. The XON/XOFF and RTS/CTS are the two primary protocols for this. The
Search WWH ::




Custom Search