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

📄 serial interface1.htm

📁 一本介绍有关uart方面的电子书籍,对从事uart设计方面的技术人员是一本很好的参考书
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0045)http://www.fpga4fun.com/SerialInterface1.html -->
<HTML><HEAD><TITLE>FPGAs are fun!</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<STYLE>BODY {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
A {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
P {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
DIV {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
HR {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
UL {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
TD {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
TH {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
DD {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
DT {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
PRE {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
CAPTION {
	FONT-FAMILY: Verdana,Tahoma,Arial; FONT-SIZE: 10px
}
A {
	COLOR: black; FONT-WEIGHT: bold; TEXT-DECORATION: none
}
A:hover {
	TEXT-DECORATION: underline
}
.link {
	COLOR: #000000
}
.link:hover {
	COLOR: blue; TEXT-DECORATION: underline
}
PRE {
	BACKGROUND: #d0d0f0; MARGIN: 5px; PADDING-BOTTOM: 5px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 5px
}
</STYLE>

<META content="MSHTML 5.00.3315.2870" name=GENERATOR></HEAD>
<BODY leftMargin=0 rightMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<TABLE border=0 cellPadding=2 cellSpacing=5 width="100%" nowrap>
  <TBODY>
  <TR>
    <TD bgColor=#9090c0 vAlign=top><FONT size=40>fpga4fun.com</FONT> - where 
      FPGAs are fun<BR><BR></TD></TR>
  <TR>
    <TD bgColor=white height=1></TD></TR>
  <TR>
    <TD bgColor=black height=1></TD></TR></TBODY></TABLE>
<TABLE cellPadding=5 cellSpacing=5 height="100%">
  <TBODY>
  <TR>
    <TD bgColor=#dddddd vAlign=top width=140><FONT color=#9090c0><B>Home<BR><A 
      class=link href="http://www.fpga4fun.com/">FPGAs are fun!</A><BR><A 
      class=link href="http://www.fpga4fun.com/WhyThisSite.html">Why this 
      site?</A><BR><BR>FPGA Boards<BR><A class=link 
      href="http://www.fpga4fun.com/board.html">Overview</A><BR><A class=link 
      href="http://www.fpga4fun.com/board_pluto.html">Pluto board</A><BR><A 
      class=link href="http://www.fpga4fun.com/board_pluto-II.html">Pluto-II 
      board</A><BR><A class=link 
      href="http://www.fpga4fun.com/board_dragon.html">Dragon board</A><BR><A 
      class=link href="http://www.fpga4fun.com/board_TXDI.html">TXDI serial 
      interface</A><BR><A class=link 
      href="http://www.fpga4fun.com/board_flashy.html">Flashy fast 
      ADC</A><BR><BR>FPGA projects<BR><A class=link 
      href="http://www.fpga4fun.com/RCServos.html">R/C servos</A><BR><A 
      class=link href="http://www.fpga4fun.com/SerialInterface.html">Serial 
      interface</A><BR><A class=link 
      href="http://www.fpga4fun.com/TextLCDmodule.html">Text LCD 
      module</A><BR><A class=link 
      href="http://www.fpga4fun.com/MusicBox.html">Music box</A><BR><A 
      class=link href="http://www.fpga4fun.com/PWM_DAC.html">PWM and one-bit 
      DAC</A><BR><A class=link 
      href="http://www.fpga4fun.com/QuadratureDecoder.html">Quadrature 
      decoder</A><BR><A class=link 
      href="http://www.fpga4fun.com/PongGame.html">Pong game</A><BR><A 
      class=link href="http://www.fpga4fun.com/GraphicLCDpanel.html">Graphic LCD 
      panel</A><BR><BR>Advanced projects<BR><A class=link 
      href="http://www.fpga4fun.com/digitalscope.html">Digital 
      oscilloscope</A><BR><A class=link 
      href="http://www.fpga4fun.com/10BASE-T.html">10BASE-T interface</A><BR><A 
      class=link href="http://www.fpga4fun.com/PCI.html">PCI 
      interface</A><BR><BR>FPGAs<BR><A class=link 
      href="http://www.fpga4fun.com/WhatAreFPGAs.html">What are FPGAs</A><BR><A 
      class=link href="http://www.fpga4fun.com/HowFPGAsWork.html">How FPGAs 
      work</A><BR><A class=link 
      href="http://www.fpga4fun.com/clocks.html">Clocks and global 
      lines</A><BR><A class=link 
      href="http://www.fpga4fun.com/DownloadCables.html">Download 
      cables</A><BR><A class=link 
      href="http://www.fpga4fun.com/configuration.html">Configuration</A><BR><A 
      class=link href="http://www.fpga4fun.com/LearnMore.html">Learn 
      more</A><BR><BR>FPGA electronic<BR><A class=link 
      href="http://www.fpga4fun.com/SMD.html">SMD technology</A><BR><A 
      class=link href="http://www.fpga4fun.com/oscillators.html">Crystals and 
      oscillators</A><BR><BR>FPGA software<BR><A class=link 
      href="http://www.fpga4fun.com/designsoftware.html">Design 
      software</A><BR><A class=link 
      href="http://www.fpga4fun.com/pinassignment.html">Pin assignment</A><BR><A 
      class=link 
      href="http://www.fpga4fun.com/designentry.html">Design-entry/HDL</A><BR><A 
      class=link 
      href="http://www.fpga4fun.com/simulation.html">Simulation/HDL</A><BR><A 
      class=link href="http://www.fpga4fun.com/synthesis&amp;pnr.html">Synthesis 
      and P&amp;R</A><BR><BR>Quick-start guides<BR><A class=link 
      href="http://www.fpga4fun.com/ISEQuickStart.html">ISE</A><BR><A class=link 
      href="http://www.fpga4fun.com/QuartusQuickStart.html">Quartus</A><BR><BR>HDL 
      Tips &amp; Tricks<BR><A class=link 
      href="http://www.fpga4fun.com/VerilogTips.html">Verilog tips</A><BR><A 
      class=link href="http://www.fpga4fun.com/VHDLTips.html">VHDL 
      tips</A><BR><BR>Site<BR><A class=link 
      href="http://www.fpga4fun.com/WhoAmI.html">Who am I?</A><BR><A class=link 
      href="http://www.fpga4fun.com/forum">Forum</A><BR><A class=link 
      href="http://www.fpga4fun.com/shop.html">Shop</A><BR><A class=link 
      href="http://www.fpga4fun.com/links.html">Links</A><BR></B></FONT><BR><BR></TD>
    <TD vAlign=top>
      <H4>How the RS-232 serial interface works</H4>Most computers have one or 
      two serial RS-232 interface as standard equipment. Each interface has the 
      following characteristics: 
      <UL>
        <LI>Uses a 9 pins connector "DB-9" (older PCs use 25 pins "DB-25"). 
        <LI>Allows bidirectional full-duplex communication (the PC can send and 
        receive data at the same time). 
        <LI>Can communicate at a maximum speed of roughly 10KBytes/s. 
      </LI></UL>You can use serial communication to connect two PCs together, 
      for example. 
      <H4>DB-9 connector</H4>You probably already saw this connector on the back 
      of your PC.<BR><BR><IMG 
      src="Serial Interface1.files/SerialConnector.jpg"><BR><BR>It has 9 pins, 
      but the 3 important ones are: 
      <UL>
        <LI>pin 2: RxD (receive data). 
        <LI>pin 3: TxD (transmit data). 
        <LI>pin 5: GND (ground). </LI></UL>Using just 3 wires, you can send and 
      receive data. 
      <H4>Serial communication</H4>Data is sent one bit at a time; so one wire 
      is enough for each direction. Since computers usually need at least 
      several bits of data, the data is "serialized" before being sent. Data is 
      commonly sent by chunks of 8 bits. The data bit 0 is sent first, bit 7 
      last. 
      <H4>Asynchronous communication</H4>This interface uses an "asynchronous" 
      protocol. That means that no clock signal is transmitted along the data. 
      The receiver has to have a way to "time" itself to the incoming data 
      bits.<BR><BR>In the case of RS-232, that's done this way: 
      <OL>
        <LI>Both side of the cable agree in advance on the communication 
        parameters (speed, format...). That's done manually before communication 
        starts. 
        <LI>The transmitter sends a "1" when and as long as the line is idle. 
        <LI>The transmitter sends a "start" (a "0") before each byte 
        transmitted, so that the receiver can figure out that data is coming. 
        <LI>After the "start", data comes in the agreed speed and format, so the 
        receiver can interpret it. 
        <LI>The transmitter sends a "stop" (a "1") after each data byte. 
      </LI></OL>Let's see how looks the byte 0x55 when transmitted:<BR><BR><IMG 
      src="Serial Interface1.files/SerialCommunication55.gif"><BR><BR>Byte 0x55 
      is 01010101 in binary.<BR>But since it is transmitted LSB (bit-0) first, 
      the line toggles like that: 1-0-1-0-1-0-1-0.<BR><BR>Here's another 
      example:<BR><BR><IMG 
      src="Serial Interface1.files/SerialCommunication.gif"><BR><BR>Here the 
      data is 0xC4, can you see it?<BR>The bits transitions are harder to see. 
      That illustrates how important it is for the receiver to know at which 
      speed the data is sent. 
      <H4>How fast can we send data?</H4>The speed is specified in baud, i.e. 
      how many bits-per-seconds can be sent. For example, 1000 bauds would mean 
      1000 bits-per-seconds, or that each bit lasts one 
      millisecond.<BR><BR>Common implementations of the RS-232 interface (like 
      the one used in PCs) don't allow just any speed to be used. If you want to 
      use 123456 bauds, you're out of luck. You have to settle to some 
      "standard" speed. Common values are: 
      <UL>
        <LI>1200 bauds. 
        <LI>9600 bauds. 
        <LI>38400 bauds. 
        <LI>115200 bauds (usually the fastest you can go). </LI></UL>At 115200 
      bauds, each bit lasts (1/115200) = 8.7&micro;s. If you transmit 8-bits data, 
      that lasts 8 x 8.7&micro;s = 69&micro;s. But each byte requires an extra start and 
      stop bit, so you actually need 10 x 8.7&micro;s = 87&micro;s. That translates to a 
      maximum speed of 11.5KBytes per second.<BR><BR>At 115200 bauds, some PCs 
      with buggy chips require a "long" stop bit (1.5 or 2 bits long...) which 
      make the maximum speed drop to around 10.5KBytes per second. 
      <H4>Physical layer</H4>The signals on the wires use a positive/negative 
      voltage scheme. 
      <UL>
        <LI>"1" is sent using -10V (or between -5V and -15V). 
        <LI>"0" is sent using +10V (or between 5V and 15V). </LI></UL>So an idle 
      line carries something like -10V. 
      <H4>Links</H4>
      <UL>
        <LI>A nice <A 
        href="http://developer.apple.com/documentation/mac/NetworkingOT/graphics/OTSE-L-01.gif">drawing</A>, 
        from this <A 
        href="http://developer.apple.com/documentation/mac/NetworkingOT/NetworkingWOT-79.html">Apple 
        Developer Connection</A> page. 
        <LI>A short <A 
        href="http://penguin.dcs.bbk.ac.uk/academic/technology/physical-layer/asynchronous/">Asynchronous 
        Communication</A> page 
        <LI>An <A 
        href="http://www.taltech.com/TALtech_web/resources/intro-sc.html">Introduction 
        to RS232 Serial Communications</A> 
        <LI><A href="http://tldp.org/HOWTO/Serial-HOWTO-20.html">Voltage 
        Waveshapes</A>, part of this huge <A 
        href="http://tldp.org/HOWTO/Serial-HOWTO.html">Serial HOWTO</A> <!--<li><a href="http://www.erg.abdn.ac.uk/users/gorry/course/phy-pages/async.html">here</a></li>--></LI></UL><BR><BR><A 
      href="http://www.fpga4fun.com/SerialInterface2.html"><FONT color=blue 
      size=2>&gt;&gt;&gt; NEXT: Baud generator 
      &gt;&gt;&gt;</FONT></A><BR><BR><BR>
      <HR>
      This page was last updated on May 10 
2004.<BR><BR></TD></TR></TBODY></TABLE></BODY></HTML>

⌨️ 快捷键说明

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