You are on page 1of 3

AL-Hussein Bin Talal University College of Engineering Department of Computer Engineering Computer Interfacing and Peripherals Lab Student

Name:

Dr. Fadi Abu-Amara Eng. Huda Saqallah Student Number:

Lab 7: Serial Port Control - 8251


1. Objectives The objective of this lab is to show how the 8251 chip can be used to send and receive serial data. 2. Introduction The 8251 is a Universal Synchronous Asynchronous Receiver Transmitter (USART) used for serial data communication. It receives parallel data from the 8086 microprocessor and converts it into serial data and transmits it through the RS-232 port. It may also receive serial data from the RS-232 port and convert it into parallel form and sends it to the microprocessor as shown in the following figure.

Figure 1: Pin diagram of the 8255 chip.

The 8251 has mode register, command register, and status register. Before the 8251 is used, it must be programmed first by writing control words to these registers according to the following table.

Figure 2: Operation selection for the 8251 chip.

3. Procedures In this section different exercises will be performed such as: serial data communication through RS-231 and RS-232 ports.

3.1. Serial Communication through the RS232-1 Once a key is pressed on the PC keyboard, its ASCII code is sent to the PC. After that, the PC serially sends the received ASCII code to the 8086 microprocessor through the 8251 chips

(serial cable RS-231 with speed of 19200 bps). Next, the 8086 sends the code for display on the LEDs through the 8255 chip. It also sends the code for display on the PC monitor through the serial 8251 interface as shown in the following figure.

Figure 3: Functional circuit description of exercise-1.

The following code is used to perform the previous steps. For this experiment, answer the following: What are the I/O port numbers of the 8251 and 8255 chips? Which port from the 8255 chip is connected to the LEDs? What is the purpose of the instruction CMP AH, 0DH ? What is the purpose of the instruction AND AL,2 ?

D_PORT EQU 0FFF0H CS_PORT EQU 0FFF2H BPORT3 EQU 3FD2H CNT3 EQU 3FD6H CODE SEGMENT ASSUME CS:CODE, DS:CODE ORG 0 START: MOV AL,90H MOV DX,CNT3 OUT DX,AL MOV AL,00H MOV DX,CS_PORT OUT DX,AL OUT DX,AL OUT DX,AL MOV AL,40H OUT DX,AL MOV AL,4EH OUT DX,AL MOV AL,27H OUT DX,AL J1: CALL IN_RS CMP AH,0DH JE J3 J2: CALL OUT_RS JMP J1 J3: CALL OUT_RS

Page 2 of 3

MOV JMP IN_RS: MOV IN AND JZ MOV IN MOV OUT MOV RET OUT_RS: MOV IN AND JZ MOV MOV OUT RET CODE ENDS END

AH,0AH J2 DX,CS_PORT AL,DX AL,2 IN_RS DX,D_PORT AL,DX DX,BPORT3 DX,AL AH,AL DX,CS_PORT AL,DX AL,1 OUT_RS DX,D_PORT AL,AH DX,AL

START

3.2. Serial Communication through the RS232-2 Now, the serial cable RS232-2 with the speed of 9600 bps will be used with same previous code. Exercises 1. Study the following code and then answer the following questions:
RECEIVE: MOV MOV OUT PASSR: IN AND CMP JNE MOV IN AND RET DX,CNTR3 AL,37H DX,AL AL,DX AL,00000010B AL,00000010B PASSR DX,DATA5 AL,DX AL,7FH

a. Find the value stored in the AL register after the instruction ' IN executed? b. What is the purpose of the underlined instructions?

AL, DX' is

2. Does the 8251 chip still be used in todays PCs? If yes, give three examples and explain the reason. 3. Does the 8251 chip still be used in todays Laptops? If yes, give three examples and explain reason.

Page 3 of 3

You might also like