TELE 201 Lab 3

EIA – 232 Serial Interface and Encoding

Lab test ( 3 marks )

Lab Report ( 7 marks ) due 3pm 12th April

Each of the Tele 201 Lab computers are equipped with two asynchronous EIA – 232 ( also known as RS-232 ) serial ports. Under the Linux operating system these are known as ‘/dev/ttyS0’ and ‘/dev/ttyS1’. Physically each serial port is interfaces via a DB-9 connector on the rear of the computer. The following table shows which EIA – 232 functions are available and the pin number for either a 25 pin or 9 pin connector.

Table : EIA – 232 signals

Name / 25-Pin / 9-Pin / Function / Notes
TD / 2 / 3 / Transmitted data
RD / 3 / 2 / Received data
RTS / 4 / 7 / Request to send
CTS / 5 / 8 / Clear to send
DTR / 20 / 4 / Data terminal ready
DSR / 6 / 6 / Data set ready
DCD / 8 / 1 / Data carrier detect
RI / 22 / 9 / Ring indicator
SG / 7 / 5 / Signal ground

DB-9 female 5 o 4 o 3 o 2 o 1 o

Pin Layout 9 o 8 o 7 o 6 o

To send and receive data via the serial ports we will use a program called ‘minicom’. Minicom can be run from the command line in a standard terminal window. Use Ctrl-A Z (ie. Press Ctrl and A followed by Z ) to see a minicom command summary . Most likely you will need to ‘cOnfigure Minicom’ ( Press O ) from which you can use ‘Serial port setup’ to adjust parameters such as the number of bits per second (bps) and enable or disable flow control.

Part I: Lab test – null modem (3 marks)

The goal of this part of the lab is to test if you can connect the two serial ports on the computer via a null modem connection.

2.

a)  (1 mark) Using the multimeter identify the pins of the DB9 plug and markup the notes column of the table above with the wire colour of each pin.

b)  (1 mark) From the terminal command line establish two sessions of the program ‘Minicom’.

Session 1 – type “minicom ttyS0”

Session 2 – type “minicom ttyS1”

Check that both sessions are using the same speed and protocol – 9600n81

Check that ’Hardware control’ is OFF.

Plug your two cables into the serial ports and into the connector blocks and then using the short wires connect TD – RD, RD – TD & SG – SG.

If you have it wired correctly then when you type a character on the session 1 window it will appear on the session 2 window. You may want to try enabling ‘Local echo’ (Ctrl A – E) so that you can see what you are typing on the session 1 window. Turn ‘Hardware control’ On and check that the connection fails.

c)  (1 marks) Now include ‘Hardware control’ in your null modem connection.

Connect RTS(1) – CTS(2) and CTS(1) – RTS(2).

Connect DTR(1) – DCD(2) & DSR(2), DTR(2) – DCD(1) & DSR(1)

Check that the connection is re-established with the control lines included.

Part II: Lab report -- Serial Transmission and ASCII encoding (7 marks)

In this part of the lab we will use the oscilloscope to examine the encoding and electrical specifications of the EIA–232 signals. Wire up a connection from the Transmitted data (TD) line to channel 1 of the oscilloscope. Adjust the oscilloscope to trigger on the rising edge of channel 1. Transmit some data by typing a few characters into the minicom terminal. The scope should capture and display the EIA –232 waveform of each character. You may need to adjust the scope time base and amplitude gain so that you can see the entire waveform.

Transmit a known alpha-numeric ( a – Z , 0 – 9 ) character eg. ‘e’. Sketch the captured waveform. What form of encoding is used in EIA-232 ? Note that the lefthand most bit on the waveform is the start bit, the next eight bits are arranged from the ‘Least Significant Bit’ (LSB) to the ‘Most Significant Bit’(MSB). Eg

Start | LSB | MSB |

3.

You should do the following tasks :

1)  Measure the logic one and logic zero voltage levels.

2)  Measure the bit period..

3)  Use the measurement to calculate the bit rate.

4)  On your sketch indicate the Start bit and note the logic level of each data bit. Write down the binary code of the transmitted data. Convert this into both hexadecimal and decimal. Look up the appendix ASCII code table. Check that the code agrees with the character that you transmitted. Repeat the above with a non alpha-numeric character eg. ‘+, %’. If time permits try some other protocols and bit rates.

The lab report should include:

1) The pin to pin connections for the null modem and the data rate used.

2) Your results from the encoding part of the lab including :

a)  The alpha-numeric and non alpha-numeric characters transmitted.

b)  The waveforms generated on the oscilloscope.

c)  The form of encoding used.

d)  The logic one and zero voltage levels.

e)  The bit period and the bit rate.

f)  The hexadecimal and decimal value of the captured waveforms.

The lab report will be marked according to its correctness, clarity, presentation and general quality.