I摘要计算器一般是指“电子计算器”,能进行数学运算的手持机器,拥有集成电路芯片,结构简单,功能较弱,但由于它使用方便、操作简单、价格低廉,因而广泛运用于商业交易中,也是必备的办公用品。近年来随着科技的飞速发展,单片机的应用正在不断深入,同时带动传统控制检测技术日益更新。在实时检测和自动控制的单片机应用系统中,单片机往往作为一个核心部件来使用,但仅单片机方面的知识是不够的,还应根据具体硬件结构、软硬件结合,来加以完善。因此,单片机的应用已经越来越贴近生活,用单片机来实现一些电子设计也变得容易起来。计算器在人们的日常中是比较的常见的电子产品之一。可是它还在发展之中,以后必将出现功能更加强大的计算器,基于这样的理念,本次设计是用单片机来设计的计算器。该设计系统是以AT89S52为单片机,P1口作为输入端,外接4X4的键盘。通过键盘扫描来对输入数的控制,在P0口、P2口接了驱动电路,用来保证LCD的工作正常。计算器将完成的功能有加,减,乘,除等功能。关键词:计算器;单片机;LCD;矩阵键盘IIABSTRACTCalculatorgenerallyreferstotheelectroniccalculator,andthetermisintroducedtoChinabytheJapanese.ThecalculatorwiththeICchip,simplestructure,andweakfunctionisabletoperformmathematicaloperationsonhandheldmachine.Butitiseasyusing,simpleoperationandlowprice.Soitiswidelyusedincommercialtransactions,andisalsoanessentialofficesupplies.Withtherapiddevelopmentofscienceandtechnologyinrecentyears,theapplicationofSCMisthedeepeningandpromotethetraditionalcontrollingdetectiontechnologiesthatareincreasinglyupdated.Inreal-timedetectionandautomaticcontrolofmicrocomputerapplicationsystem,themicrocontrollerisoftenusedasacorecomponenttouse,butonlytheknowledgeofthemicrocontrollerisnotenough,andshouldbebasedonthespecifichardwarearchitecture,hardwareandsoftwarecombinationtomakeitperfect.SotheapplicationofSCMismoreandmoreclosetolife,sousingofsinglechiptoachievesomeelectronicdesignsalsobecomeeasy.Inthepeopledailylifethecalculatorisoneofthecommonelectronicproducts.Butitisstillindevelopment,itwillbecomemorepowerfulcalculatorinthefuture.Accordingtosuchidea,thedesignisthatSCMdesigncalculator.ThedesignsystemisbasedonAT89S52microcontroller,P0portasinput,external4X4keyboard.InP1,P2mouthisconnectedwiththedrivecircuittoensurethenormalworkofLED.Thecalculatorwillcompleteadd,subtract,multiply,divideandotherfunction.Keywords:calculator,MCU,LCD,MatrixkeyboardIII前言计算器(calculator;counter)一般是指“电子计算器”,能进行数学运算的手持机器,拥有集成电路芯片,结构简单,功能较弱,但由于它使用方便、操作简单、价格低廉,因而广泛运用于商业交易中,也是必备的办公用品之一。计算器一般由运算器、控制器、存储器、键盘、显示器、电源和一些可选外围设备及电子配件通过人工或机器设备组成。随着科学技术的不断发展及计算器应用的普及,人们发现在工业控制中,有很多时候需要在恶劣的环境中进行各种数据的采集、运算和控制。本设计是由单片机实现的模拟计算器,它不仅能实现数据的加减乘除运算,而且还能使数据及其计算结果在数码管上显示出来,能够实现0-256的数字四则运算。本设计是用单片机AT89S52来控制,采用LCD1602液晶显示读取数据,软件部分是由C语言来编写的。利用键盘和LCD1602设计一个简单的数学计算器,可以完成简单的如加,减,乘,除的四则运算,并将运算结果在LCD1602上显示出来。I目录第一章绪论.............................................................................................................................................11.1研究背景.....................................................................................................................................11.1.1单片机发展现状..............................................................................................................11.1.2计算器系统现状..............................................................................................................21.1.3选题意义及现状..............................................................................................................2第二章总体方案及设计.........................................................................................................................32.1设计目的.....................................................................................................................................32.2设计任务.....................................................................................................................................32.3设计思路.....................................................................................................................................32.3.1方案构思..........................................................................................................................32.3.2方案比较与选择...........................................................................................................42.3.3系统总体模块图..............................................................................................................4第三章系统硬件设计.............................................................................................................................53.1主控模块设计............................................................................................................................53.2键盘输入模块设计...................................................................................................................113.3LCD显示模块设计..................................................................................................................123.3.1LCD1602主要技术参数..............................................................................................133.3.2引脚功能说明..............................................................................................................133.4清零、音乐开关、开方和多次方运算功能模块设计...........................................................143.5电源模块设计...........................................................................................................................153.6运算模块(单片机控制)......................................................................................................16第四章软件设计......................................................................................