⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serial.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Introduction</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD Handbook" href="index.html" /><link rel="UP" title="Serial Communications" href="serialcomms.html" /><link rel="PREVIOUS" title="Serial Communications" href="serialcomms.html" /><link rel="NEXT" title="Terminals" href="term.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD Handbook</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="serialcomms.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 20 Serial Communications</td><td width="10%" align="right" valign="bottom"><a href="term.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="SERIAL" name="SERIAL">20.2 Introduction</a></h1><div class="SECT2"><h2 class="SECT2"><a id="SERIAL-TERMINOLOGY" name="SERIAL-TERMINOLOGY">20.2.1Terminology</a></h2><div class="VARIABLELIST"><dl><dt>bps</dt><dd><p>Bits per Second -- the rate at which data is transmitted</p></dd><dt>DTE</dt><dd><p>Data Terminal Equipment -- for example, your computer</p></dd><dt>DCE</dt><dd><p>Data Communications Equipment -- your modem</p></dd><dt>RS-232</dt><dd><p>EIA standard for hardware serial communications</p></dd></dl></div><p>When talking about communications data rates, this section does not use the term``baud''. Baud refers to the number of electrical state transitions that may be made in aperiod of time, while ``bps'' (bits per second) is the <span class="emphasis"><iclass="EMPHASIS">correct</i></span> term to use (at least it does not seem to bother thecurmudgeons quite as much).</p></div><div class="SECT2"><h2 class="SECT2"><a id="SERIAL-CABLES-PORTS" name="SERIAL-CABLES-PORTS">20.2.2 Cablesand Ports</a></h2><p>To connect a modem or terminal to your FreeBSD system, you will need a serial port onyour computer and the proper cable to connect to your serial device. If you are alreadyfamiliar with your hardware and the cable it requires, you can safely skip thissection.</p><div class="SECT3"><h3 class="SECT3"><a id="TERM-CABLES" name="TERM-CABLES">20.2.2.1 Cables</a></h3><p>There are several different kinds of serial cables. The two most common types for ourpurposes are null-modem cables and standard (``straight'') RS-232 cables. Thedocumentation for your hardware should describe the type of cable required.</p><div class="SECT4"><h4 class="SECT4"><a id="TERM-CABLES-NULL" name="TERM-CABLES-NULL">20.2.2.1.1 Null-modemCables</a></h4><p>A null-modem cable passes some signals, such as ``signal ground'', straight through,but switches other signals. For example, the ``send data'' pin on one end goes to the``receive data'' pin on the other end.</p><p>If you like making your own cables, you can construct a null-modem cable for use withterminals. This table shows the RS-232C signal names and the pin numbers on a DB-25connector.</p><div class="INFORMALTABLE"><a id="AEN28472" name="AEN28472"></a><table border="0" frame="void" class="CALSTABLE"><col /><col /><col /><col /><col /><thead><tr><th>Signal</th><th>Pin #</th><th>&nbsp;</th><th>Pin #</th><th>Signal</th></tr></thead><tbody><tr><td>SG</td><td>7</td><td>connects to</td><td>7</td><td>SG</td></tr><tr><td>TD</td><td>2</td><td>connects to</td><td>3</td><td>RD</td></tr><tr><td>RD</td><td>3</td><td>connects to</td><td>2</td><td>TD</td></tr><tr><td>RTS</td><td>4</td><td>connects to</td><td>5</td><td>CTS</td></tr><tr><td>CTS</td><td>5</td><td>connects to</td><td>4</td><td>RTS</td></tr><tr><td>DTR</td><td>20</td><td>connects to</td><td>6</td><td>DSR</td></tr><tr><td>DCD</td><td>8</td><td>&nbsp;</td><td>6</td><td>DSR</td></tr><tr><td>DSR</td><td>6</td><td>connects to</td><td>20</td><td>DTR</td></tr></tbody></table></div><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> Connect ``Data Set Ready'' (DSR) and ``Data Carrier Detect'' (DCD)internally in the connector hood, and then to ``Data Terminal Ready'' (DTR) in the remotehood.</p></blockquote></div></div><div class="SECT4"><h4 class="SECT4"><a id="TERM-CABLES-STD" name="TERM-CABLES-STD">20.2.2.1.2 StandardRS-232C Cables</a></h4><p>A standard serial cable passes all the RS-232C signals straight-through. That is, the``send data'' pin on one end of the cable goes to the ``send data'' pin on the other end.This is the type of cable to use to connect a modem to your FreeBSD system, and is alsoappropriate for some terminals.</p></div></div><div class="SECT3"><h3 class="SECT3"><a id="TERM-PORTS" name="TERM-PORTS">20.2.2.2 Ports</a></h3><p>Serial ports are the devices through which data is transferred between the FreeBSDhost computer and the terminal. This section describes the kinds of ports that exist andhow they are addressed in FreeBSD.</p><div class="SECT4"><h4 class="SECT4"><a id="TERM-PORTKINDS" name="TERM-PORTKINDS">20.2.2.2.1 Kinds ofPorts</a></h4><p>Several kinds of serial ports exist. Before you purchase or construct a cable, youneed to make sure it will fit the ports on your terminal and on the FreeBSD system.</p><p>Most terminals will have DB25 ports. Personal computers, including PCs runningFreeBSD, will have DB25 or DB9 ports. If you have a multiport serial card for your PC,you may have RJ-12 or RJ-45 ports.</p><p>See the documentation that accompanied the hardware for specifications on the kind ofport in use. A visual inspection of the port often works too.</p></div><div class="SECT4"><h4 class="SECT4"><a id="TERM-PORTNAMES" name="TERM-PORTNAMES">20.2.2.2.2 PortNames</a></h4><p>In FreeBSD, you access each serial port through an entry in the <ttclass="FILENAME">/dev</tt> directory. There are two different kinds of entries:</p><ul><li><p>Call-in ports are named <tt class="FILENAME">/dev/ttyd<varclass="REPLACEABLE">N</var></tt> where <var class="REPLACEABLE">N</var> is the portnumber, starting from zero. Generally, you use the call-in port for terminals. Call-inports require that the serial line assert the data carrier detect (DCD) signal to workcorrectly.</p></li><li><p>Call-out ports are named <tt class="FILENAME">/dev/cuaa<varclass="REPLACEABLE">N</var></tt>. You usually do not use the call-out port for terminals,just for modems. You may use the call-out port if the serial cable or the terminal doesnot support the carrier detect signal.</p></li>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -