8255 Interfacing Example
8255 Interfacing Example
)
Course Instructor MSI (CPE342) Page 1 of 9
An ADC0804 and a 44780 LCD are connected with 8088 CPU through
8255 PPI. PPI is interfaced with CPU at A0H and above. Develop an
8088 CPU assembly language program that reads a single conversion
from ADC and displays it in decimal on LCD in 3-digit format.
Solution:
LCD is connected with Group A of PPI. Consult following table for pin
connections.
RS PortC.4
̅̅̅̅̅
RW PortC.5
̅̅̅̅
EN PortC.6
D7…D0 PortA.7…PortA.0
ADC is connected with Group B of PPI. Consult following table for pin
connections.
D7…D0 PortB.7…PortB.0
Problem designed by: Muhammad Usman Rafique (Assistant Professor, ECE Deptt.)
Course Instructor MSI (CPE342) Page 2 of 9
Program:
START:
OUT 0A3H, AL
CALL LCD_CONFIG
MAIN:
CALL ADC0804
CALL SPLIT
CALL DISPLAY
JMP MAIN
LCD_CONFIG:
CALL LCD_COMM
CALL LCD_COMM
CALL LCD_COMM
CALL LCD_COMM
Problem designed by: Muhammad Usman Rafique (Assistant Professor, ECE Deptt.)
Course Instructor MSI (CPE342) Page 3 of 9
CALL LCD_COMM
RET
LCD_COMM:
MOV AL, BH
OUT 0A0H, AL
;SETTING EN = 1, RS = 0, RW = 0
OUT 0A3H, AL
MOV BL, AL
OUT 0A3H, AL
MOV AL, BL
SETTING EN = 0, RS = 0, RW = 0
OUT 0A3H, AL
Problem designed by: Muhammad Usman Rafique (Assistant Professor, ECE Deptt.)
Course Instructor MSI (CPE342) Page 4 of 9
MOV BL, AL
OUT 0A3H, AL
MOV AL, BL
RET
LCD_DATA:
MOV AL, BH
OUT 0A0H, AL
;SETTING EN = 1, RS = 1, RW = 0
OUT 0A3H, AL
MOV BL, AL
OUT 0A3H, AL
Problem designed by: Muhammad Usman Rafique (Assistant Professor, ECE Deptt.)
Course Instructor MSI (CPE342) Page 5 of 9
MOV AL, BL
SETTING EN = 0, RS = 0, RW = 0
OUT 0A3H, AL
MOV BL, AL
OUT 0A3H, AL
MOV AL, BL
RET
ADC0804:
OUT 0A3H, AL
OUT 0A3H, AL
OUT 0A3H, AL
OUT 0A3H, AL
OUT 0A3H, AL
OUT 0A3H, AL
OUT 0A3H, AL
JNE WAIT
OUT 0A3H, AL
OUT 0A3H, AL
RET
;0TH DIGIT (Z) IN CL, 10TH (Y) IN CH AND 100TH (X) IN DL.
SPLIT:
RET
Problem designed by: Muhammad Usman Rafique (Assistant Professor, ECE Deptt.)
Course Instructor MSI (CPE342) Page 9 of 9
DISPLAY:
CALL LCD_COMM
CALL LCD_DATA
CALL LCD_DATA
CALL LCD_DATA
RET