0% found this document useful (1 vote)
274 views9 pages

Calculator

This document describes a microprocessor system and interfacing project submitted by two students. It includes a circuit diagram, flow chart, list of components, and assembly code to interface a microprocessor with other components like memory chips and an LCD to create a basic calculator. The purpose is to use a microprocessor as the core component to read input from a calculator, perform arithmetic operations, and display the result on the LCD.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
274 views9 pages

Calculator

This document describes a microprocessor system and interfacing project submitted by two students. It includes a circuit diagram, flow chart, list of components, and assembly code to interface a microprocessor with other components like memory chips and an LCD to create a basic calculator. The purpose is to use a microprocessor as the core component to read input from a calculator, perform arithmetic operations, and display the result on the LCD.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Microprocessor System and Interfacing

Complex Engineering Problem

Group Members
MUHAMMAD ZIA-UD-DIN FA17-BEE-060

MUHAMMAD JUNAID AMJAD FA17-BEE-091

SUBMITTED TO: DR. OMER

DATE: 16 -DEC-2019

Department of Electrical Engineering


COMSATS UNIVERSITY ISLAMABAD,

Wah CAMPUS
CIRCUIT DIAGRAM:
INTERFACING

27C128
16X2

27C128

FLOW CHART:
COMPONENTS:
1. Microprocessor (8086)
2. 74LS273
3. 27C128
4. 8255A
5. LCD
6. Calculator
7. Gates

PURPOSE OF USING:
Microprocessor is the basic building block. Which contain code in which
instruction/commands are given cross ponding to certain address which send to further
components to perform action through address or data bus.

74LS273 FLIP-FLOP which contain high speed 8 bit registers.

27C128 memory which performs action very rapidly. It also give data at give input address.

8255A is a general purpose programmable I/O device designed to transfer the data from I/O
to interrupt I/O under certain conditions as required. It can be used with almost any
microprocessor. It consists of three 8-bit bidirectional I/O ports (24I/O lines) which can be
configured as per the requirement.

LCD to display the input and output vale.

Calculator is used to give input which is send to microprocessor.

ALTERNATIVES:
Logic gates.

Single memory of 32x8 bit instead of using 2, 16x8.


ASSEMBLY CODE:
DATA SEGMENT

PORTA EQU 00H; Port A is connected to D0, D7 at given address


PORTB EQU 02H; Port B 0, 1, 2 is connected to RS, RW, EN
PORTC EQU 04H; Port C is connected to Calculators
PCW EQU 05006H; Port for I/O control;

STR1 DB “CALCULATOR: $”

STR2 DB “ENTER FIRST VALUE: $”

STR3 DB “ENTER SECOND VALUE: $”

STR4 DB “CHOSE OPERAND: $”

STR5 DB “RESULT: $”

ENDS

STACK SEGMENT

DW 128 DUP<0>

ENDS

CODE SEGMENT

START:

; SET SEGMENT REGISTER

MOV AX, DATA

MOV DS, AX;

MOV ES, AX;

; DEFINE I/O PORTS

MOV DX, PCW

MOV AX, 089H; (BINARY OF 89) SET PORT A, B (OUTPUT) & PORT C (INPUT)//MODE

OUT DX, AX; DISPLAY ON LCD INDIRECT ADRESSING

CALCULATOR:

CALL LCD_INT

MOV AH, 00H;

MOV DL, 1; ROW 1

MOV BH, 1; COLOUM 1

LEA SI, STR1

CALL LCD_PRINTSTR
CALL DELAY

LEA SI, STR2;

CALL LCD_PRINTSTR

CALL DELAY

; 1ST INTEGER

IN AL, 04H; READING PORT C

LEA SI, [AL]

CALL LCD _PRINTSTR

CALL DELAY

MOV BH, AL; 1ST INTEGER IN BH

LEA SI, STR3

CALL LCD_PRINTSTR

CALL DELAY

; 2ND INTEGER

IN AL, 04H; INPUT PORT C

LEA SI, [AL];

CALL LCD_PRINTSTR

CALL DELAY

MOV BL, AL; 2ND INTEGER IN BL

LEA SI, STR4

CALL LCD _PRINTSTR

CALL DELAY

IN AL, 04H; TAKING OPERAND

MOV CL, AL; OPERAND MOVE TO CL

MOV AL, BH; 1ST INTEGER BACK TO AL

CHECK:

CMP CL, 11H;

JNE ADD

CMP CL, 21H;

JNE SUB

CMP CL, 41H

JNE MUL
CMP CL, 81H

JNE DIV

ADD:

ADD AL, BL; AL=AL+BL

CALL LCD _WRITE

CALL DELAY

CALL DELAY

CALL CALCULATOR

SUB:

SUB AL, BL; AL=AL-BL

CALL LCD _WRITE

CALL DELAY

CALL DELAY

CALL CALCULATOR

DIV:

DIV BL; AX=AL/BL

CALL LCD _WRITE

CALL DELAY

CALL DELAY

CALL CALCULATOR

MUL:

MUL BL; AX=AL*BL

CALL LCD _WRITE

CALL DELAY

CALL DELAY

CALL CALCULATOR

PROC DELAY:

MOV CX, #64H;

D1:

LOOP D1

RET
ENDP

PROC LCD_INT

MOV AL, 38H; GENERATE 7*5 MATRIX

CALL LCD_CMD

MOV AL, 01H; SET CURSOR TO 1ST LINE

RET

ENDP

PROC LCD_CMD

OUT 00H, AL; PORT A ADRESS

OUT 02H, 20H;

CALL DELAY

OUT 02H, 00H;

RET

ENDP

PROC LCD_CLEAR

MOV AL, 01H;

CALL LCD_CMD

RET

ENDP

PROC LCD_PRINTSTR

PUSH SI

PUSH AX;

ABC:

LODSB

CMP AL,’$’

JE EXIT

MOV AH, AL

CALL LCD_WRITE
JMP ABC

EXIT:

POP AX

POP SI

RET

ENDP

PROC LCR_WRITE

OUT 00H, AX;

OUT 02H, 0A0H

CALL DELAY

CALL DELAY

OUT 02H, 80H;

RET

ENDP

PROTEUS SIMULATION:

You might also like