📄 interfacing the serial - rs-232 port part 3-4.htm
字号:
<P>Two common RS-232 Level Converters are the 1488 RS-232 Driver and the
1489 RS-232 Receiver. Each package contains 4 inverters of the one type,
either Drivers or Receivers. The driver requires two supply rails, +7.5
to +15v and -7.5 to -15v. As you could imagine this may pose a problem
in many instances where only a single supply of +5V is present. However
the advantages of these I.C's are they are cheap. </P>
<CENTER>
<TABLE>
<TBODY>
<TR>
<TD>
<CENTER><IMG alt="Pinout for MAX-232 RS-232 Level Converter"
border=0
src="Interfacing The Serial - RS-232 Port Part 3-4_files/max232.gif">
</CENTER>Above: (Figure 6) Pinouts for the MAX-232,<BR>RS-232
Driver/Receiver.<BR><BR>
<HR>
Right: (Figure 7) Typical MAX-232 Circuit.<BR><BR></TD>
<TD><IMG alt="Typical MAX-232 Circuit" border=0
src="Interfacing The Serial - RS-232 Port Part 3-4_files/max232a.gif">
</TD></TR></TBODY></TABLE></CENTER>
<P>Another device is the MAX-232. It includes a Charge Pump, which
generates +10V and -10V from a single 5v supply. This I.C. also includes
two receivers and two transmitters in the same package. This is handy in
many cases when you only want to use the Transmit and Receive data
Lines. You don't need to use two chips, one for the receive line and one
for the transmit. However all this convenience comes at a price, but
compared with the price of designing a new power supply it is very
cheap. </P>
<P>There are also many variations of these devices. The large value of
capacitors are not only bulky, but also expensive. Therefore other
devices are available which use smaller capacitors and even some with
inbuilt capacitors. <I>(Note : Some MAX-232's can use 1 micro farad
Capacitors).</I> However the MAX-232 is the most common, and thus we
will use this RS-232 Level Converter in our examples. </P>
<P><A name=42><FONT size=+1>Making use of the Serial Format</FONT>
<HR>
</A>
<P></P>
<P>In order to do anything useful with our Serially transmitted data, we
must convert it back to Parallel. <I>(You could connect an LED to the
serial port and watch it flash if you really want too, but it's not
extremely useful)</I>. This in the past has been done with the use of
UART's. However with the popularity of cheap Microcontroller's, these
can be more suited to many applications. We will look into the
advantages and disadvantages of each method. </P><A name=43><FONT
size=+1>8250 and Compatible UARTs</FONT><BR>
<HR>
</A>
<P>We have already looked at one type of UART, the 8250 and compatibles
found in your PC. These devices have configuration registers accessible
via the data and address buses which have to be initialized before use.
This is not a problem if your device which you are building uses a
Microprocessor. However if you are making a stand alone device, how are
you going to initialize it? </P>
<P>Most Microprocessors / Microcontrollers these days can be brought
with build-in Serial Communication Interfaces (SCI). Therefore there is
little need to connect a 40 pin 16550 to, for example a 68HC11 when you
can buy one built in. If you are still in love with the Z-80 or 8086
then an 16550 may be option! <I>(or if you are like myself, the higher
chip count the better. After all it looks more complicated and
impressive! - But a headache to debug!)</I> </P>
<CENTER>
<P><IMG alt="Pin Diagrams of UARTs - 16550, 16450 & 8250" border=0
height=293
src="Interfacing The Serial - RS-232 Port Part 3-4_files/uart.gif"
width=520> <BR><FONT size=-1>Figure 8 : Pin Diagrams for 16550, 16450
& 8250 UARTs</FONT></P></CENTER>
<P>
<CENTER>
<TABLE border=1 width="80%">
<TBODY>
<TR>
<TD width="10%">
<CENTER><B>Pin No.</B></CENTER></TD>
<TD width="15%">
<CENTER><B>Name</B></CENTER></TD>
<TD><B>Notes</B></TD></TR>
<TR>
<TD>
<CENTER>Pin 1:8</CENTER></TD>
<TD>
<CENTER>D0:D7</CENTER></TD>
<TD>Data Bus</TD></TR>
<TR>
<TD>
<CENTER>Pin 9</CENTER></TD>
<TD>
<CENTER>RCLK</CENTER></TD>
<TD>Receiver Clock Input. The frequency of this input should equal
the receivers baud rate x 16</TD></TR>
<TR>
<TD>
<CENTER>Pin 10</CENTER></TD>
<TD>
<CENTER>RD</CENTER></TD>
<TD>Receive Data</TD></TR>
<TR>
<TD>
<CENTER>Pin 11</CENTER></TD>
<TD>
<CENTER>TD</CENTER></TD>
<TD>Transmit Data</TD></TR>
<TR>
<TD>
<CENTER>Pin 12</CENTER></TD>
<TD>
<CENTER>CS0</CENTER></TD>
<TD>Chip Select 0 - Active High</TD></TR>
<TR>
<TD>
<CENTER>Pin 13</CENTER></TD>
<TD>
<CENTER>CS1</CENTER></TD>
<TD>Chip Select 1 - Active High</TD></TR>
<TR>
<TD>
<CENTER>Pin 14</CENTER></TD>
<TD>
<CENTER>nCS2</CENTER></TD>
<TD>Chip Select 2 - Active Low</TD></TR>
<TR>
<TD>
<CENTER>Pin 15</CENTER></TD>
<TD>
<CENTER>nBAUDOUT</CENTER></TD>
<TD>Baud Output - Output from Programmable Baud Rate Generator.
Frequency = (Baud Rate x 16)</TD></TR>
<TR>
<TD>
<CENTER>Pin 16</CENTER></TD>
<TD>
<CENTER>XIN</CENTER></TD>
<TD>External Crystal Input - Used for Baud Rate Generator
Oscillator</TD></TR>
<TR>
<TD>
<CENTER>Pin 17</CENTER></TD>
<TD>
<CENTER>XOUT</CENTER></TD>
<TD>External Crystal Output</TD></TR>
<TR>
<TD>
<CENTER>Pin 18</CENTER></TD>
<TD>
<CENTER>nWR</CENTER></TD>
<TD>Write Line - Inverted</TD></TR>
<TR>
<TD>
<CENTER>Pin 19</CENTER></TD>
<TD>
<CENTER>WR</CENTER></TD>
<TD>Write Line - Not Inverted</TD></TR>
<TR>
<TD>
<CENTER>Pin 20</CENTER></TD>
<TD>
<CENTER>VSS</CENTER></TD>
<TD>Connected to Common Ground</TD></TR>
<TR>
<TD>
<CENTER>Pin 21</CENTER></TD>
<TD>
<CENTER>RD</CENTER></TD>
<TD>Read Line - Inverted</TD></TR>
<TR>
<TD>
<CENTER>Pin 22</CENTER></TD>
<TD>
<CENTER>nRD</CENTER></TD>
<TD>Read Line - Not Inverted</TD></TR>
<TR>
<TD>
<CENTER>Pin 23</CENTER></TD>
<TD>
<CENTER>DDIS</CENTER></TD>
<TD>Driver Disable. This pin goes low when CPU is reading from
UART. Can be connected to Bus Transceiver in case of high capacity
data bus.</TD></TR>
<TR>
<TD>
<CENTER>Pin 24</CENTER></TD>
<TD>
<CENTER>nTXRDY</CENTER></TD>
<TD>Transmit Ready</TD></TR>
<TR>
<TD>
<CENTER>Pin 25</CENTER></TD>
<TD>
<CENTER>nADS</CENTER></TD>
<TD>Address Strobe. Used if signals are not stable during read or
write cycle</TD></TR>
<TR>
<TD>
<CENTER>Pin 26</CENTER></TD>
<TD>
<CENTER>A2</CENTER></TD>
<TD>Address Bit 2</TD></TR>
<TR>
<TD>
<CENTER>Pin 27</CENTER></TD>
<TD>
<CENTER>A1</CENTER></TD>
<TD>Address Bit 1</TD></TR>
<TR>
<TD>
<CENTER>Pin 28</CENTER></TD>
<TD>
<CENTER>A0</CENTER></TD>
<TD>Address Bit 0</TD></TR>
<TR>
<TD>
<CENTER>Pin 29</CENTER></TD>
<TD>
<CENTER>nRXRDY</CENTER></TD>
<TD>Receive Ready</TD></TR>
<TR>
<TD>
<CENTER>Pin 30</CENTER></TD>
<TD>
<CENTER>INTR</CENTER></TD>
<TD>Interrupt Output</TD></TR>
<TR>
<TD>
<CENTER>Pin 31</CENTER></TD>
<TD>
<CENTER>nOUT2</CENTER></TD>
<TD>User Output 2</TD></TR>
<TR>
<TD>
<CENTER>Pin 32</CENTER></TD>
<TD>
<CENTER>nRTS</CENTER></TD>
<TD>Request to Send</TD></TR>
<TR>
<TD>
<CENTER>Pin 33</CENTER></TD>
<TD>
<CENTER>nDTR</CENTER></TD>
<TD>Data Terminal Ready</TD></TR>
<TR>
<TD>
<CENTER>Pin 34</CENTER></TD>
<TD>
<CENTER>nOUT1</CENTER></TD>
<TD>User Output 1</TD></TR>
<TR>
<TD>
<CENTER>Pin 35</CENTER></TD>
<TD>
<CENTER>MR</CENTER></TD>
<TD>Master Reset</TD></TR>
<TR>
<TD>
<CENTER>Pin 36</CENTER></TD>
<TD>
<CENTER>nCTS</CENTER></TD>
<TD>Clear To Send</TD></TR>
<TR>
<TD>
<CENTER>Pin 37</CENTER></TD>
<TD>
<CENTER>nDSR</CENTER></TD>
<TD>Data Set Ready</TD></TR>
<TR>
<TD>
<CENTER>Pin 38</CENTER></TD>
<TD>
<CENTER>nDCD</CENTER></TD>
<TD>Data Carrier Detect</TD></TR>
<TR>
<TD>
<CENTER>Pin 39</CENTER></TD>
<TD>
<CENTER>nRI</CENTER></TD>
<TD>Ring Indicator</TD></TR>
<TR>
<TD>
<CENTER>Pin 40</CENTER></TD>
<TD>
<CENTER>VDD</CENTER></TD>
<TD>+ 5 Volts</TD></TR></TBODY></TABLE><FONT size=-1>
<CENTER>Table 17 : Pin Assignments for 16550A
UART</CENTER></FONT></CENTER>
<P></P>
<P><I>For more information on the 16550 and compatible UART's see <A
href="http://www.beyondlogic.org/serial/serial.htm#8">The UART (8250's
and Compatibles)</A> in the first part of this tutorial.</I> </P><A
name=44><FONT size=+1>CDP6402, AY-5-1015 / D36402R-9 etc
UARTs</FONT><BR>
<HR>
</A><BR>
<TABLE>
<TBODY>
<TR>
<TD>
<CENTER><IMG alt="Pinout for CDP6402, AY-5-1015 / D36402R-9 UARTs"
border=0
src="Interfacing The Serial - RS-232 Port Part 3-4_files/6402.gif">
<BR><FONT size=-1>Figure 9 : Pinout of CDP6402</FONT> </CENTER></TD>
<TD>
<P>There are UARTs such as the CDP6402, AY-5-1015 / D36402R-9 and
compatibles. These differ from the 8250 and compatibles, by the
fact that they have separate Receive and Transmit data buses and
can be configured by connecting certain pins to various logic
levels. These are ideal for applications where you don't have a
Microprocessor available. Such an example is if you want to
connect a ADC0804 (Analog to Digital Converter) to the UART, or
want to connect a LCD Display to the Serial Line. These common
devices use a 8 bit parallel data bus. </P>
<P>The CDP6402's <I>Control Register</I> is made up of Parity
Inhibit (PI), Stop Bit Select (SBS), Character Length Select (CLS1
and 2) and Even Parity Enable (EPE). These inputs can be latched
using the Control Register Load (CRL) or if you tie this pin high,
changes made to these pins will immediately take effect.
</P></TD></TR></TBODY></TABLE>
<P>
<CENTER>
<TABLE border=1 width="90%">
<TBODY>
<TR>
<TD><B>Pin Number</B></TD>
<TD><B>Abbr.</B></TD>
<TD><B>Full Name</B></TD>
<TD><B>Notes</B></TD></TR>
<TR>
<TD>
<CENTER>Pin 1</CENTER></TD>
<TD>
<CENTER>VDD</CENTER></TD>
<TD>+ 5v Supply Rail</TD>
<TD> </TD></TR>
<TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -