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

📄 interfacing the serial - rs-232 port part 3-4.htm

📁 Parallel Port description of the communication port
💻 HTM
📖 第 1 页 / 共 4 页
字号:
            <TD>
              <CENTER>Pin 2</CENTER></TD>
            <TD>
              <CENTER>NC</CENTER></TD>
            <TD>Not Connected</TD>
            <TD>&nbsp;</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 3</CENTER></TD>
            <TD>
              <CENTER>GND</CENTER></TD>
            <TD>Ground</TD>
            <TD>&nbsp;</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 4</CENTER></TD>
            <TD>
              <CENTER>RRD</CENTER></TD>
            <TD>Receiver Register Disable</TD>
            <TD>When driven high, outputs RBR8:RBR1 are High Impedance.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 5:12</CENTER></TD>
            <TD>
              <CENTER>RBR8:<BR>RBR1</CENTER></TD>
            <TD>Receiver Buffer Register</TD>
            <TD>Receiver's Data Bus </TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 13</CENTER></TD>
            <TD>
              <CENTER>PE</CENTER></TD>
            <TD>Parity Error</TD>
            <TD>When High, A Parity Error Has Occurred.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 14</CENTER></TD>
            <TD>
              <CENTER>FE</CENTER></TD>
            <TD>Framing Error</TD>
            <TD>When High, A Framing Error Has Occurred. i.e. The Stop Bit was 
              not a Logic 1.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 15</CENTER></TD>
            <TD>
              <CENTER>OE</CENTER></TD>
            <TD>Overrun Error</TD>
            <TD>When High, Data has been received but the nData Received Reset 
              had not yet been activated.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 16</CENTER></TD>
            <TD>
              <CENTER>SFD</CENTER></TD>
            <TD>Status Flag Disable</TD>
            <TD>When High, Status Flag Outputs (PE, FE, OE, DR and TBRE) are 
              High Impedance </TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 17</CENTER></TD>
            <TD>
              <CENTER>RRC</CENTER></TD>
            <TD>Receiver Register Clock</TD>
            <TD>x16 Clock input for the Receiver Register.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 18</CENTER></TD>
            <TD>
              <CENTER>nDRR</CENTER></TD>
            <TD>Data Received Reset</TD>
            <TD>Active Low. When low, sets Data received Output Low (i.e. 
              Clears DR)</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 19</CENTER></TD>
            <TD>
              <CENTER>DR</CENTER></TD>
            <TD>Data Received</TD>
            <TD>When High, Data has been received and placed on outputs 
              RBR8:RBR1. </TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 20</CENTER></TD>
            <TD>
              <CENTER>RRI</CENTER></TD>
            <TD>Receiver Register In</TD>
            <TD>RXD - Serial Input. Connect to Serial Port, Via RS-232 
              receiver.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 21</CENTER></TD>
            <TD>
              <CENTER>MR</CENTER></TD>
            <TD>Master Reset</TD>
            <TD>Resets the UART. <I>UART should be reset after applying 
              power.</I></TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 22</CENTER></TD>
            <TD>
              <CENTER>TBRE</CENTER></TD>
            <TD>Transmitter Buffer Register Empty</TD>
            <TD>When High, indicates that Transmitter Buffer Register is 
              Empty, thus all bits including the stop bit have been sent.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 23</CENTER></TD>
            <TD>
              <CENTER>nTBRL</CENTER></TD>
            <TD>Transmitter Buffer Load / Strobe</TD>
            <TD>Active Low. When low, data present on TBR8:TBR1 is placed in 
              Transmitter Buffer Register. A Low to High Transition on this pin, 
              then sends the data.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 24</CENTER></TD>
            <TD>
              <CENTER>TRE</CENTER></TD>
            <TD>Transmitter Register Empty</TD>
            <TD>When High, Transmitter Register is Empty, thus can accept 
              another byte of data to be sent.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 25</CENTER></TD>
            <TD>
              <CENTER>TRO</CENTER></TD>
            <TD>Transmitter Register Out (TXD)</TD>
            <TD>TXD - Serial Output. Connect to Serial Port, Via RS-232 
              Transmitter.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 26:33</CENTER></TD>
            <TD>
              <CENTER>TBR8:<BR>TBR1</CENTER></TD>
            <TD>Transmitter Buffer Register</TD>
            <TD>Data Bus, for Transmitter. Place Data here which you want to 
              send.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 34</CENTER></TD>
            <TD>
              <CENTER>CRL</CENTER></TD>
            <TD>Control Register Load</TD>
            <TD>When High, Control Register (PI, SBS, CLS2, CLS1, EPE) is 
              Loaded. <I>Can be tied high, so changes on these pins occur 
              instantaneously.</I></TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 35</CENTER></TD>
            <TD>
              <CENTER>PI</CENTER></TD>
            <TD>Parity Inhibit</TD>
            <TD>When High, No Parity is Used for Both Transmit and Receive. 
              When Low, Parity is Used.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 36</CENTER></TD>
            <TD>
              <CENTER>SBS</CENTER></TD>
            <TD>Stop Bit Select</TD>
            <TD>A High selects 2 stop bits. (1.5 for 5 Character Word Lengths) 
              A Low selects one stop bit.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 37:38</CENTER></TD>
            <TD>
              <CENTER>CLS2:<BR>CLS1</CENTER></TD>
            <TD>Character Length Select</TD>
            <TD>Selects Word Length. 00 = 5 Bits, 01 = 6 Bits, 10 = 7 Bits and 
              11 = 8 Bits.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 39</CENTER></TD>
            <TD>
              <CENTER>EPE</CENTER></TD>
            <TD>Even Parity Enable</TD>
            <TD>When High, Even Parity is Used, When Low, Odd Parity is 
            Used.</TD></TR>
          <TR>
            <TD>
              <CENTER>Pin 40</CENTER></TD>
            <TD>
              <CENTER>TRC</CENTER></TD>
            <TD>Transmitter Register Clock</TD>
            <TD>16x Clock input for Transmitter.</TD></TR></TBODY></TABLE><FONT 
        size=-1>Table 18 : Pin Description for CDP6402, AY-5-1015 / D36402R-9 
        and compatible UART's</FONT> </CENTER>
        <P>
        <P>However one disadvantage of these chips over the 8250's is that these 
        UART's have no inbuilt Programmable Baud Rate Generator, and no facility 
        to connect a crystal directly to it. While there are Baud Rate Generator 
        Chips such as the AY-5-8116, a more cheaper <I>(and common)</I> 
        alternative is the 74HC4060 14-bit Binary Counter and Oscillator. </P>
        <P>The 74HC4060, being a 14 bit binary counter/divider only has outputs 
        for some of it's stages. Only Q4 to Q14 is available for use as they 
        have external connections. This means higher Baud Rates are not 
        obtainable from common crystals, such as the 1.8432 Mhz and 2.4576 Mhz. 
        The UART requires a clock rate 16 times higher than the Baud Rate you 
        will be using. eg A baud rate of 9600 BPS requires a input clock 
        frequency of 153.6 Khz. </P>
        <CENTER>
        <TABLE>
          <TBODY>
          <TR>
            <TD width="50%">
              <CENTER><IMG alt="Baud Rate Generator using a 74HC4060" border=0 
              src="Interfacing The Serial - RS-232 Port Part 3-4_files/74hc4060.gif"> 
              <BR><FONT size=-1>Figure 10 : Baud Rate Generator using a 
              74HC4060</FONT> </CENTER></TD>
            <TD width="50%">
              <CENTER>
              <TABLE border=1 width="100%">
                <TBODY>
                <TR>
                  <TD><B>
                    <CENTER>Output</CENTER></B></TD>
                  <TD><B>
                    <CENTER>1.8432Mhz</CENTER></B></TD>
                  <TD><B>
                    <CENTER>2.4546Mhz</CENTER></B></TD></TR>
                <TR>
                  <TD>
                    <CENTER>Out 2</CENTER></TD>
                  <TD>
                    <CENTER>115.2 KBPS</CENTER></TD>
                  <TD>
                    <CENTER>153.6 KBPS</CENTER></TD></TR>
                <TR>
                  <TD>
                    <CENTER>Q4</CENTER></TD>
                  <TD>
                    <CENTER>7200 BPS</CENTER></TD>
                  <TD>
                    <CENTER>9600 BPS</CENTER></TD></TR>
                <TR>
                  <TD>
                    <CENTER>Q5</CENTER></TD>
                  <TD>
                    <CENTER>3600 BPS</CENTER></TD>
                  <TD>
                    <CENTER>4800 BPS</CENTER></TD></TR>
                <TR>
                  <TD>
                    <CENTER>Q6</CENTER></TD>
                  <TD>
                    <CENTER>1800 BPS</CENTER></TD>
                  <TD>
                    <CENTER>2400 BPS</CENTER></TD></TR>
                <TR>
                  <TD>
                    <CENTER>Q7</CENTER></TD>
                  <TD>
                    <CENTER>900 BPS</CENTER></TD>
                  <TD>
                    <CENTER>1200 BPS</CENTER></TD></TR>
                <TR>
                  <TD>
                    <CENTER>Q8</CENTER></TD>
                  <TD>
                    <CENTER>450 BPS</CENTER></TD>
                  <TD>
                    <CENTER>600 BPS</CENTER></TD></TR>
                <TR>
                  <TD>
                    <CENTER>Q9</CENTER></TD>
                  <TD>
                    <CENTER>225 BPS</CENTER></TD>
                  <TD>
                    <CENTER>300 BPS</CENTER></TD></TR></TBODY></TABLE><FONT size=-1>
              <CENTER>Table 19 : Possible Baud Rates using a 74HC4060 
              </CENTER></FONT></CENTER></TD></TR></TBODY></TABLE></CENTER>
        <P>The 1.8432 Mhz crystal gives some unfamiliar Baud Rates. While many 
        of these won't be accepted by terminal programs or some hardware, they 
        are still acceptable if you write your own serial programs. For example 
        the PC's baud rate divisor for 7200 BPS is 16, 3600 BPS is 32, 1800 BPS 
        is 64 etc. If you require higher speeds, then it is possible to connect 
        the UART to the OUT2 pin. This connection utilizes the oscillator, but 
        has no frequency division applied. Using OUT2 with a 1.8432 Mhz crystal 
        connected gives a baud rate of 115,200 BPS. The CMOS CDP6402 UART can 
        handle up to 200 KBPS at 5 volts, however your MAX-232 may be limited to 
        120 KBPS, but is still within range. </P><BR><A name=46><FONT 
        size=+1>Microcontrollers</FONT><BR>
        <HR>
        </A>
        <P>It is also possible to use microcontrollers to transmit and receive 
        Serial data. As we have already covered, some of these MCU's (Micro 
        Controller Units) have built in UART's among other things. Take the 
        application we have used above. We want to monitor analog voltages using 
        a ADC and then send them serially to the PC. If the Microcontroller also 
        has a ADC built in along with the UART or SCI, then we could simply 
        program the device and connect a RS-232 Line Driver. This would minimize 
        your chip count and make your PCB much smaller. </P>
        <P>Take the second example, displaying the serial data to a common 16 
        character x 2 line LCD display. A common problem with the LCD modules, 
        is they don't accept cartridge returns, line-feeds, form-feeds etc. By 
        using a microcontroller, not only can you emulate the UART, but you can 
        also program it to clear the screen, should a form-feed be sent or 
        advance to the next line should a Line-feed be sent. </P>
        <P>The LCD example also required some additional logic (An Inverter) to 
        reset the data receive line on the UART, and provide a -ve edge on the 
        enable of the LCD to display the data present on the pins. This can all 
        be done using the Microcontroller and thus reducing the chip count and 
        the cost of the project. </P>
        <P>Talking of chip count, most Microcontrollers have internal 
        oscillators thus you don't require the 74HC4060 14 Bit Binary Counter 
        and Oscillator. Many Microcontrollers such as the 68HC05J1A and PIC16C84 
        have a smaller pin count, than the 40 Pin UART. This not only makes the 
        project smaller in size, it reduces complexity of the PCB. </P>
        <P>But there are also many disadvantages of the Microcontroller. The 
        major one, is that you have to program it. For the hobbyist, you may not 
        have a development system for a Microcontroller or a method of 
        programming it. Then you have to learn the micro's code and work out how 
        to tackle the problem. At least with the UART, all you did was plug it 
        in, wire it up and it worked. You can't get much simpler that that. </P>
        <P>So far we have only discussed Full Duplex Transmission, that is that 
        we can transmit and receive at the same time. If our Microcontroller 
        doesn't have a SCI then we can <I>Emulate</I> a RS-232 port using a 
        Parallel line under software control. However Emulation has it's 
        dis-advantages. It only supports slow transmission speeds, commonly 
        2400, 9600 or maybe even 19,200 BPS if you are lucky. The other 
        disadvantage is that it's really only effective in half duplex mode. 
        That is, it can only communicate in one direction at any one given time. 
        However in many applications this is not a problem. </P>
        <P>As there are many different types of Micro-Controllers all with their 
        different instruction sets, it is very hard to give examples here which 
        will suit everyone. Just be aware that you can use them for serial 
        communications and hopefully at a later date, I can give a limited 
        number of examples with one micro. </P></UL><BR><BR></TD>
  <TR></TR></TBODY></TABLE><BR><BR><FONT size=2>Copyright 1999-2001 <A 
href="mailto:Craig.Peacock@beyondlogic.org">Craig Peacock</A> 19 August 
2001.</FONT> <BR><BR></CENTER></BODY></HTML>

⌨️ 快捷键说明

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