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

Calculator Flowchart 8051

The flowchart summarizes the basic calculator logic for an 8051 microcontroller to perform addition, subtraction, multiplication, and division operations on inputs from a keypad and display the results on a LCD screen. It initializes the LCD, reads inputs, performs the calculation based on the operation, converts the result to ASCII format and prints it to the LCD, then returns to read the next input. It handles negative results by getting the 2's complement and printing a "-" sign.

Uploaded by

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

Calculator Flowchart 8051

The flowchart summarizes the basic calculator logic for an 8051 microcontroller to perform addition, subtraction, multiplication, and division operations on inputs from a keypad and display the results on a LCD screen. It initializes the LCD, reads inputs, performs the calculation based on the operation, converts the result to ASCII format and prints it to the LCD, then returns to read the next input. It handles negative results by getting the 2's complement and printing a "-" sign.

Uploaded by

Dwiky Erlangga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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