Design of 4 times 4 calculator based on 51 single chip microcomputer

1. Design content

It is composed of STC89C52 single-chip microcomputer + 4 by 4 button module + LCD1602 liquid crystal display + power supply.
Specific functions: use 4×4 matrix keyboard for input, which can perform several digital operations such as addition, subtraction, multiplication and division, and display operations on LCD1602 Process and results.

2. Overall design plan

In order to realize the design of the queuing system based on 51 single chip microcomputer, this article will realize the following design requirements:

  ( 1 ) Use LCD1602 and matrix keyboard to design the circuit so that the circuit can complete the " +-*/ " function of the simple calculator ;

( 2 ) Write a program to complete the function of the simple calculator " +-*/ ", and the number of digits involved in the operation is not more than 10 ;

( 3 ) The button layout is as follows:

1

2

3

+

4

5

6

-

7

8

9

*

ON/C

0

=

/

( 4 ) On this basis, the functions of clearing the screen and reporting errors are realized. Simple operation, perfect function and high accuracy.
Based on the points listed above, this design uses STC89C51 microcontroller to control LCD1602 LCD screen module, button module, power module and other external circuits to realize the design of software and hardware. The specific design block diagram is shown in Figure 2.1.

Figure 2.1 Block diagram of overall design

3. Hardware design ideas

Figure 3.1 shows the hardware design of this system. Specifically, the hardware circuit consists of the following modules:

(1) The smallest single-chip microcomputer system. It is used to drive and control other modules to realize the overall function. It uses STC89C51 single-chip microcomputer as the core chip, supplemented by reset circuit and crystal oscillator circuit;

(2) Button module. It is composed of 4*4 matrix buttons to realize the input of values ​​and operators;

(3) Display module. Display the calculation process and calculation results through the LCD1602 liquid crystal display;

(4) Power module. Used to power the entire system.

Figure 3.1 Block diagram of hardware design

4. Software design ideas

The software programming platform selects the most commonly used keil software. Since the program does not involve the underlying drive problem, so I choose the convenient and fast C language programming. In programming, the program is divided into four modules: a delay module, a 1602 display module, a battle module for processing calculation expressions, and a main function module. Modular design is adopted to facilitate debugging and understanding.

The software design of this article needs to be realized:

(1) Scan the keyboard to realize the judgment of the input key value;

(2) Processing and realization of various operations;

(3) Display of calculation process and results;

(4) Realization of the reset function.

The specific program design ideas are shown in Figure 4.1.

 All materials include programs (notes), AD schematic diagrams, protues simulation, reference papers, program explanations, simulation explanations, simulation videos, schematic explanations, introductions to the use of materials, etc., the most comprehensive network! ! ( Https://www.cirmall.com/circuit/18416 )

For more MCU design and information, please pay attention to the WeChat public account "Electronic Engineer Growth Diary"! !

Guess you like

Origin blog.csdn.net/weixin_41017942/article/details/107587085