Exp 5 - 201101

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Basic Microprocessor UCCE2043 Laboratory Experiment 5

Experiment 5
Basic I/O Interfacing II – 0 – 9 to 7-segment LED
Name of Student: _____________________________ Date: _____________

ID of Student: _______________________________

Objectives

• Become familiar with BGC-8088 board and its connection to a personal computer (PC).
• To understand the I/O operation and the principle of 7-segment LED.
• To understand the calculation of delay routine.
• To understand the I/O operation of 8255 mode 0 and the techniques of key counter .

Material Requirements

BGC 8088 MICROENGINEER V3.5


No. EDS 8806 basic I/O experiment board.
50 pins IDC flat-cable
RS232- cable
8088/86 instruction set
Microengineer communication software
MASM

Reference Textbook

Introduction To BGC-8088 MICROENGINEER User’s Guide.


Triebel W. A., Singh A., The 8088 and 8086 Microprocessors: Programming, Interfacing,
Software, Hardware, and Applications (4th Edition), Prentice Hall (2002).
Ytha Yu, Charles Marut, Assembly Language Programming and Organization Of the IBM
PC.

Theory

Refer to lecture note Chapter 5 titled “Basic I/O Interfacing”

You can execute the experiment boards in BGC-8088 MICROENGINEER V3.4 by connecting from
50 pins PCI connector with a 50 pins IDC flatcable The Pin’s definition of 25*2 (50 pins) connector
of experiment boards is shown in Figure 4.1 in Experiment 4.

Procedure

1. The related circuit is shown in Figure 5.1.


Basic Microprocessor UCEC2054 Laboratory Experiment

Figure 5.1

2. Type the following program (Program 5.1) using notepad or other text editor.
3. Save the file as “display1.asm”.
4. Go to DOS mode.
5. Run the program “MASM”, to create the “display1.lst”, “display1.obj” and
“display1.exe”.
a. Go to the directory where you have saved the file “display1.asm”.
b. Type c:\masm\irvine\masm.
c. Follow steps 10 to 13 in Experiment 2 to obtain the file “display1.exe”.
6. To create a binary file type:
C:\MASM\8806\exe2bin display1.exe display1.bin

; file name : display1.asm


CODE SEGMENT
ASSUME CS:CODE
MOV DX,0FF13H
MOV AL,89H
OUT DX,AL
MOV DX,0FF10H
MOV AL,00H
BEGIN: OUT DX,AL
MOV CX,0000H
LOOP $
INC AL
DAA
JMP BEGIN
CODE ENDS
END

Program 5.1

7. A file called display1.bin will be created. Download the binary file to the target board.
(Follow step 9 as shown in Experiment 4).

2
Basic Microprocessor UCEC2054 Laboratory Experiment

8. You need to put mini-jumper to the position of right 3. The function of the jumper
in each position is as follow:

Jumper position Function


JP2-1
To enable the 8 -LEDs

JP2-2
To enable the DIP switch

JP2-3
To enable the 7-segment display

JP2-4
To enable the matrix LED

JP2-5
To enable Switch 4

JP2-6
To enable Switch 1

JP2-7
To enable Switch 2

(14 marks)

9. Press G command. What is happening after the G command executed?

____________________________________________________ (5 marks)

10. Refer to Figure 5.1 and Program 5.1, answer the following questions.
i. What is the function of 4511?

____________________________________ (3 marks)

[Total: 22 marks]

3
Basic Microprocessor UCEC2054 Laboratory Experiment

ii. Is the seven segment common cathode or common anode? What is the different
between these two?
__________________________________________________________________
__________________________________________________________________
(3 marks)

iii. Sketch the schematic diagram and build the truth table.
* Answers given.

(3 marks) (3 marks)

Common Cathode Common Anode

7-segment display layout

[Total: 9 marks]

4
Basic Microprocessor UCEC2054 Laboratory Experiment

a b c d e f g Display Data in
value hexadecimal
1 1 1 1 1 1 0 0 3F
0 1 1 0 0 0 0 1 06
1 1 0 1 1 0 1 2 5B
1 1 1 1 0 0 1 3 2F
0 1 1 0 0 1 1 4 66

1 0 1 1 0 1 1 5 6D

0 0 1 1 1 1 1 6 7C
1 1 1 0 0 0 0 7 07C

1 1 1 1 1 1 1 8 7F

1 1 1 0 0 1 1 9 67

1 1 1 0 1 1 1 A 77

1 1 1 1 1 1 1 B 7F

1 0 0 1 1 1 0 C 39

1 1 1 1 1 1 1 D 7F

1 0 0 1 1 1 1 E 79

1 0 0 0 1 1 1 F 71

Table 5.1: Truth table for common cathode 7-segment display


(16 marks)

[Total: 16 marks]

5
Basic Microprocessor UCEC2054 Laboratory Experiment

iv. If the IC 4511 is not use in this experiment, redraw the circuit design in Figure
5.1.what modification need to be done in the Program 5.1?

(3 marks)

__________________________________________________________________
__________________________________________________________________
(3 marks)

v. What is the purpose of command “DAA” in Program 5.1?

__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
(3 marks)

[Total: 9 marks]

6
Basic Microprocessor UCEC2054 Laboratory Experiment

11. The Truth Table for 4511 is shown in Table 5.2.

Table 5.2 : 4511 with 7-segment LED display

12. Type and load the BIN file of Program 5.2 to BGC-8088 board.
a. You may refer to step 2 to step 7 in this experiment.
b. Note: You need to put mini-jumpers, JP2-3, JP2-6 and JP2-7. (Refer to step 8).
c. The new circuit layout is shown in Figure 5.2

7
Basic Microprocessor UCEC2054 Laboratory Experiment

; file name : display2.asm ---- Program 5.2


CODE SEGMENT
ASSUME CS:CODE
MAIN PROC FAR
MOV DX,0FF13H
MOV AL,89H
OUT DX,AL
MOV BL,00H
BEGIN: CALL DISPLAY
CALL KEYINC
CALL KEYDEC
JMP BEGIN
MAIN ENDP
DISPLAY PROC NEAR
MOV DX,0FF10H
MOV AL,BL
OUT DX,AL
RET
DISPLAY ENDP
KEYINC PROC NEAR
MOV DX,0FF12H
IN AL,DX
TEST AL,01H
JNZ QUIT1
MOV CX,1000H
LOOP $
IN AL,DX
TEST AL,01H
JNZ QUIT1
EXIT1: IN AL,DX
TEST AL,01H
JZ EXIT1
MOV AL,BL
INC AL
D AAA
MOV BL,AL
QUIT1: RET
KEYINC ENDP
KEYDEC PROC NEAR
MOV DX,0FF12H
IN AL,DX
TEST AL,02H
JNZ QUIT2
MOV CX,1000H
LOOP $
IN AL,DX
TEST AL,02H
JNZ QUIT2
EXIT2: IN AL,DX
TEST AL,02H
JZ EXIT2
MOV AL,BL
DEC AL
AAS
MOV BL,AL
QUIT2: RET
KEYDEC ENDP
CODE ENDS
END MAIN

8
Basic Microprocessor UCEC2054 Laboratory Experiment

Figure 5.2

13. Press G command and try to understand Program 5.2. Explain the purpose of this
program.
________________________________________________________________________
________________________________________________________________________
(6 marks)

[Total: 6 marks]

9
Basic Microprocessor UCEC2054 Laboratory Experiment

14. Program 5.3 below was modified from Program 5.2 so that the 7-segment will display a
continuous count up when the SW1 is hold and count down when the SW2 is hold.

; file name : display3.asm ---- Program 5.3


CODE SEGMENT
ASSUME CS:CODE
MAIN PROC FAR
MOV DX,0FF13H
MOV AL,89H
OUT DX,AL
MOV BL,00H
BEGIN: CALL DISPLAY
CALL KEYINC
CALL KEYDEC
JMP BEGIN
MAIN ENDP
DISPLAY PROC NEAR
MOV DX,0FF10H
MOV AL,BL
OUT DX,AL
RET
DISPLAY ENDP
KEYINC PROC NEAR
MOV DX,0FF12H
IN AL,DX
TEST AL,01H
JNZ QUIT1
MOV CX,1000H
LOOP $
IN AL,DX
TEST AL,01H
JNZ QUIT1
CALL DELAY
MOV AL,BL
INC AL
AAA
MOV BL,AL
QUIT1: RET
KEYINC ENDP
KEYDEC PROC NEAR
MOV DX,0FF12H
IN AL,DX
TEST AL,02H
JNZ QUIT2
MOV CX,1000H
LOOP $
IN AL,DX
TEST AL,02H
JNZ QUIT2
CALL DELAY
MOV AL,BL
INC AL
AAS
MOV BL,AL
QUIT2: RET
KEYDEC ENDP

DELAY PROC NEAR


MOV CX,0FFFFH
LOOP $
RET
DELAY ENDP
CODE ENDS
END MAIN
* Warning: Program 5.3 contains bugs! Fix it in your assignment! Good Luck!

10

You might also like