Physics 121 - Salisbury University

Download Report

Transcript Physics 121 - Salisbury University

ENEE 440
Chapter 10
Data Communication
Parallel transmission Data is sent 8 bits (byte) at a
time over 8 data lines. A few handshaking lines
may be needed. One uses a 25-pin D-shell
connector and cable(DB-25 or equivalent)
Serial transmission Data is sent one bit at a time
over one data line. In theory and principle one
needs only two lines for data, one for the signal
and the other for ground. A few clock and
handshaking lines are needed and in many PCs a 9pin connector is used.
Serial Communication . . . Details
Synchronous serial communication means that the
sending and receiving devices are synchronized
(“in sync”) by means of special SYNC bytes that
are agreed upon prior to the transmission of data
Asynchronous serial communication means that
instead of trying to stay in sync, special start and
stop bits are used to ensure that the correct byte
of data is received. It is simpler to implement and
is commonly used in PCs
Disadvantage of the asynchronous method is the
excessive overhead. This means that for every byte
of data that is transmitted, 2 or 3 bits are used to
indicate the start and stop of that one byte of data.
Asynchronous serial communications
• A frame consists of one start bit (0) plus the byte
of data plus the parity bit plus the stop bit(s)
[Always HIGH]
• A protocol has to be established between the
sending and receiving devices before the data can
be transmitted. Protocol means an agreement
about:
• 7E1 means that the protocol is 7 bits of data, even
parity, and 1 stop bit. Overhead is 30%
• 8N1 means 8 bits of data, no parity bit and 1 stop
bit. Overhead is 20%
An Example is Worth a Thousand Words!
7E1 protocol showing a 10-bit frame with 7-bit data
(ASCII code for “C” is 43H, see ASCII chart), 1
start, 1 stop and even parity.
START
0
D0 D1 D2 D3 D4 D5 D6 PARITY STOP
1
1 0 0 0 0
1
1
1
8N1 protocol shows a 10-bit frame with 8-bit data
(ASCII code for “C” is 43H, see ASCII chart), 1
start, 1 stop and no parity bit.
START
0
D0 D1 D2 D3
1
1
0
0
D4 D5 D6 D7
0
0
1
0
STOP
1
Basics of serial communications
• Baud rate is the same as the bits per second. 9600
baud means that data is being transmitted at the
rate of 9600 bits per second (bps)
• Half-duplex means that data can be sent and
received but one at a time
• Full-duplex means that data can be sent and
received simultaneously
• Parallel - to - Serial convert the data that comes
out of the data bus in parallel form into a stream of
1s and 0s (serial data)
Modems and FSK
• Modem (modulator / Demodulator) converts the
digital data into audible tones
• FSK (Frequency Shift Keying) 2225 Hz represents 1
and 2025 Hz represents 0 in one direction and 1270
Hz represents 1 and 1070 Hz represents 0 in the
other direction. These tones can easily be
transmitted by the phone lines
• 8250/16450/16550 UART (Universal Asynchronous
Receiver Transceiver) and the 8251 USART
(Universal Synchronous Asynchronous Receiver
Transceiver) convert parallel to serial and viceversa and add start/stop bits and clocking
8251 USART
C / -D When this line is LOW the data register of the
8251 is selected
C / -D When this line is HIGH you read the status
register
C / -D When this line is HIGH you write to the
command register except the first time after
reset you write to the mode register
TxRDY goes high to indicate that the USART is ready
to receive another character from the CPU
RxRDY goes high to indicate that a character is
ready to be read by the CPU.
-CTS Modem ready for data from PC
-RTS is a signal from the PC to the modem that the
PC would like to transmit a byte of data to the
modem.
-DTR (Data Terminal Ready) is a signal from the PC to
the modem that the PC is in working condition
-DSR (Data Set Ready) is a signal from the modem to
the PC that the modem is in working condition
How about two examples . . . please?
What is the mode word for 7E1 at 9600 baud.
Assume the base address of the 8251 is 350H and
that TxC and RxC are tied to a 153.6 kHz clock.
Look at the mode word chart as we answer this
question. 153600/16 = 9600. So our baud factor is
16. We have 7 data bits, even parity and 1 stop bit.
The mode word is 01111010 = 7A
Write the instructions to send the letter C.
mov al , 43H ; 8251 takes care of framing!
out 34FH, al ; address of data register.
RS -232
• HIGH is a voltage between -3V and -25V and a
LOW as +3V and +25V
• The voltage levels most commonly used are -12V
(HIGH) and +12V (LOW)
• Since digital data comes out as 0V and 5V, there
are special level translation chips that convert
TTL -to- RS232 and RS232-to-TTL
• The chip set most universally used was MC1488
for TTL -to- RS232 and MC1489 for RS232-to-TTL.
A popular chip is MAX 232C.
RS -232 . . . The Devil’s in the Details
• Digital lines going out of the UART are connected
to an MC 1488 whose output is connected to an
RS232 cable
• The other end of the RS232 cable (not more than
50 ft. away) is connected to an MC1489 whose
TTL output goes to the modem
• Similarly, the TTL output of the modem is fed into
an MC1489 whose output goes into the same RS232 cable. The other end is connected to an MC
1489 whose output goes to the UART
Another Example
9-pin cable
3
2
7
8
6
5
1
4
9
25-pin cable
2
3
4
5
6
7
8
20
22
Line name
TxD
RxD
-RTS
-CTS
-DSR
GND
-CD (carrier detect)
-DTR
RI ( ring indicator)