0% found this document useful (0 votes)
2 views

Tutorial-5

The document provides a tutorial for interfacing a keyboard and display controller 8279 with an 80386 microprocessor, including an assembly program for setup and operation. It also includes instructions for designing an interfacing circuit with an A/D converter using PPI 8255, detailing port configurations and initialization procedures. The tutorial features assembly code examples for both tasks, emphasizing key operations and control signals.

Uploaded by

Moad Areibi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Tutorial-5

The document provides a tutorial for interfacing a keyboard and display controller 8279 with an 80386 microprocessor, including an assembly program for setup and operation. It also includes instructions for designing an interfacing circuit with an A/D converter using PPI 8255, detailing port configurations and initialization procedures. The tutorial features assembly code examples for both tasks, emphasizing key operations and control signals.

Uploaded by

Moad Areibi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Microprocessor Systems Course (EC 482)

Tutorial 5
Q1- Interface keyboard and display controller 8279 with 80386 at address
0080H and 0084H. Write Assembly program to set up 8279 in
scanned keyboard mode with encoded scan, N-Key rollover mode.
Use a 16 character display in right entry display format. Then clear
the display RAM with zeros. Read the FIFO for key closure. If any
key is closed, store it’s code to register CH. Then write the byte 55 to
all the displays. The clock input to 8279 is 2MHz, operate it at 100
KHz?

Answer

A2
Tutorial 5
Answer

Keyboard/Display Mode Set CW :

MOV AL, 00011010B


OUT (0084H), AL
Program clock selection :
MOV AL, 00110100B
OUT (0084H), AL

Clear Display RAM :

MOV AL, 11000001B


OUT (0084H), AL
Read FIFO :
MOV AL, 01000000B
OUT (0084H), AL
Write Display RAM :
MOV AL, 10010000B
OUT (0084H), AL
Answer Tutorial 5
START: MOV AL, 1AH ; Set 8279 in Encoded scan
OUT 84H, AL ; N Key rollover, 16 display, Right entry mode.
MOV AL, 34H ; Set operating clock to 100KHz
OUT 84H, AL
MOV AL, D3H ; Clear display ram command
OUT 84H, AL
MOV AL, 40H ; Read FIFO command
OUT 84H, AL

AGAIN; MOV AL, 40H ; Read FIFO command for check key closure
OUT 84H, AL
IN AL, 84H ; Read FIFO status
AND AH, 07H ; Mask all bits except the
JZ again ; if any key is pressed, take
IN AL, 80H ; read code
MOV CH, AL

DISPL: : IN AL, 84H ; Wait for clearing of Display RAM by reading FIFO status D bit
TEST AL, 80H
JNZ displ ; wait if D bit is not set wait, else proceed . If 0 it’s ready
MOV AL, 90H ; Proceed to write display
OUT 84H, AL
MOV AL, 55H ; RAM by using write display
OUT 80H, AL ; 55H to all display RAM
JMP AGAIN
Tutorial 5

Q2- Design an interfacing circuit to read data from A/D converter


using PPI 8255. Setup port A to read data, PC6 to start the
conversion and INTR signal of A/D converter is connecting to
STB input of PPI to load data when the conversion is
completed. Draw the circuit diagram and write the procedure to
initialize the PPI and read the input data from the converter.
Given that the port addresses used are 80H- 84H- 88H-8CH?
(Hint: the data converter needs a pulse low to high to start the
conversion)?

4
Answer Tutorial 5

PC4 STB INTR


A7
A2
A3 PC6

5
Answer Tutorial 5

D7 D6 D5 D4 D3 D2 D1 D0 B0H
1 0 1 1 1 0 0 0
Port A : Input ; Port C high: output; Port B &Port C low do not care ;
Mode 1 (01) for port A ; Strobed input

D7 D6 D5 D4 D3 D2 D1 D0
0CH/0DH
0 0 0 0 1 1 0 1/0

Bit PC0 is used as START pulse,


To set and reset PC6 = 0CH to Reset; 0D H to Set

6
Answer CNWRD EQU B0H
SCPC60 EQU 0CH
ECPC61 EQU 0DH
PORTA EQU 80H
PORTC EQU 88H
CNREG EQU 8CH

MAIN: MOV AL, CNWRD ; move CONTROL WORD to AL


OUT CNREG, AL
MOV AL, SCPC60 ; start of conversion
OUT CNREG, AL
CALL DELAY
MOV AL, SCPC61 ; set start of conversion
OUT CNREG, AL ; start of conversion
CALL READ
END MAIN

READ: PROC
IN AL, PORTC
TEST AL, PC5
JZ READ
IN AL, PORTA
RET
7
READ END

You might also like