Laboratory 1- Preparation

advertisement
Laboratory 2- Experimentation
Asynchronous data communications
via null modem
We use the lab set-up shown in Fig. 3. Two cables connect the RS232 ports of the 2 PC’s to a lab
board. The TD pin of PC1 cable is connected to point V1 of the board. The RD pin of PC2 cable
is connected to point V4 of the board. The SG pins of the 2 cables are connected to a common
ground of the board. A picture of the board is shown in Pic.1, where points V1 and V4 are
labelled.
RS232 cable
PC1
RS232 cable
Lab
Board
PC2
Fig. 3: Lab set up
Pic.1: Picture of lab board
The PC’s have a communication software called Hyperterminal (to find it: Start 
Programs  Accessories  Communications). This software is normally used to
connect a machine to another machine across the PSTN via modems. Here, we use it to
send data (e.g., an ASCII text file) from one PC1 to PC2 via a null modem (as if it’s
through the PSTN).
In this first lab, you may need to practice with Hyperterminal by going through its
various windows to set-up the parameters needed for communications.
First, choose a connection name, say “lab1”, as shown below.
Next, select the serial port (COM1, COM2, TCP/IP) as shown in the following
screen. For serial communications, choose COM1 (or COM2).
Then, select the communication parameters: data bit rate (e.g., 2400 bps), data_bits per
character (e.g., =7), parity bit (even, odd, none), Stop_bit=1 (can be >1), flow control =
hardware, as shown on the following screen.
1. Lab Experiment
1.1 Objective: observe and decode the EIA232 signal, wire a null modem, and
transmit
ASCII data between 2 PC’s via the null modem.
2.2 Apparatus: Lab board, 2 RS232 cables, 2 PC’s, oscilloscope
2.3 Procedure
A. Measuring & decoding the data signal in the serial port
1. Connect the TD pin of the serial port of PC1, from point V1 of the board, to the
oscilloscope (and connect the SG pin to the common ground of the scope). Using
the Hyperterminal communication software, set the bit rate to 300 bps,
data_bits=7, parity=even. Then type character “m” repeatedly on the screen. The
resulting signal is transmitted on the TD pin.
2. Capture and observe the signal for “m” on the scope. Note that the signal runs
from right to left, starting with the Start_bit pulse, the LSB bit pulse, etc., as was
shown in Fig. 1-b. Zoom on one character (set of 10 pulses). On your answer
sheet do the following:
 Sketch the 10-pulse signal for “m” that you see on the scope
 What is the polarity of the Start_bit and the Stop_bit?




Measure the amplitudes (in V) of the + and – pulses of the signal
Measure the width (in second) of the + and – pulses. How is this width related
to the bit rate?
Decode the signal to find the ASCII code for letter “m”. Verify that this is the
correct ASCII code by consulting an ASCII table.
Verify that the even parity bit observed is correct.
4. Repeat the steps above with bit rate=1200 bps parity=odd.
B. Serial data transmission via null modem
1. Using a jumper cable, connect the TD pin of PC1 cable (point V1 on board) to the
RD
pin of PC2 cable (point V4 on board). Make sure the SG pins of both cables are
connected to the ground. This creates a null modem.
2. On each PC, using Hyperterminal, write a text file consisting of characters
“mmmmmmm…”. Save it as file as file1.txt on PC1, and as file2.txt on PC2.
3. Set Hyperterminal parameters as bit_rate=300 bps, data_bits=7, parity=even on
both
PC’s. Use the “Transmit text file” of Hyperterminal to transmit file1.txt from PC1
to
PC2. Retry until successful transmission, i.e. when “mmmmmmm…” appears on
the
screen of PC2. Fill in answer sheet.
4. Repeat Step 3 above by changing bit_rate=1200 bps on PC2. If no successful
transmission, explain (on answer sheet)
5. Rewire the connections on the board to transfer file2.txt from PC2 to PC1.
2. Lab answer sheet
Preparation
1. Decimal code for letter “m” is: ……………
2. 7-bit binary ASCII code for letter “m” is: ……………….
3. a) ASCII code with even parity: ………….
b) ASCII code with odd parity:
4. Signal sketch for letter “m” is:
Experiment
Step A-2:
1. Sketch the 10-pulse signal for “m” that you see on the scope
2. What is the polarity (+-)of the Start_bit and the Stop_bit?
Start_bit:
Stop_bit:
3. Measure the amplitudes (in V) of the + and – pulses of the signal
+ pulse:
- pulse:
4. Measure the width (in second) of the + and – pulses. How is this width related
to the bit rate?
Pulse width:
Pulse width is related to bit rate as:
5. Decode the signal to find the ASCII code for letter “m”.
Decoded ASCII code for “m”:
Decimal value of code:
Verified by ASCII table?:
6. What is the polarity of the ( even ) parity bit?
Polarity:
Why is it even parity?:
Step A3:
1. Measure the width (in second) of the + and – pulses. Does it verify the bit
rate?
Pulse width:
Width verifies bit rate?:
2. What is the polarity of the (odd ) parity bit?
Polarity:
Why is it odd parity?:
Step B3:
Is the data transfer successful?:
If yes, capture screen of PC2 and insert below.
Step B4:
If data transfer unsuccessful, why?
Step B-5:
Is the data transfer successful?:
If yes, capture screen of PC1 and insert below.
4. References
[1]. http://www.asciitable.com
Download