Calculator Flowchart 8051

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

Basic Calculator Flowchart for 8051

Start

LCD initialization

Fill the look-up


table with LCD
initialization codes

Read Input

Calculate Result

Print output

OP = ADD?
Result is
Negative?
YES
YES

LCD
initialization

Add the two


operands and
save results

Read Key

NO

Set the DPTR with


look-up table start
address

Result < 10?

YES

Calculate
Result

Sub the two


operands and
save results

Print valid
input on
LCD

Clear ACC

YES
NO
Convert
result to
ASCII then
print on
LCD

OP = MUL?

Print Output

Convert numbers
from ASCII to Bin
by masking higher
nibble

Get code from


ROM and placing
in into ACC

YES
Divide result by 10
Multibly the two
operands and
save results

NO

Save Operands/
Operation in RAM
byte for each one

Increment DPTR
for next code

Convert
Quotient to
ASCII then
print to LCD
OP = DIV?

ACC = ZERO?

YES

RET

NO

Have entered
operands and
operation?

YES

NO

OP = SUB?

Check If Valid

Read Input

Get the 2's


complement
to result
and print -

NO

YES
Divide the two
operands and
save results

NO

Convert
remainder
to ASCII
then print
on LCD

RET

RET

RET

NO

You might also like