资料清单:C程序+仿真+设计报告+使用说明+元件清单+操作视频
仿真版本:Proteus8.6及以上版本
程序编译:Keil5 C51
编程语言:C语言
设计编号:【Q03】
1.? 简介
? 本文提出了一种基于51单片机的数码管计算器设计。该设计是以AT89C51单片机为核心的计算器模拟系统,输入采用4×4矩阵键盘,可以进行加、减、乘、除数字运算,并在6位数码管上显示操作过程。
2.? 主要功能
a.通过6位数码管显示计算过程。
b.通过4×4矩阵键盘进行加、减、乘、除数字运算。
3.? 源程序(Keil5)
本设计采用keil5 C51软件(内附安装包)实现程序设计。如需用keil4打开程序,可自行通过.c和.h文件新建工程即可。
#include <reg52.h>
unsigned char show[6]={0,0,0,0,0,0};
unsigned char code seg7_table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x40,0x00,0x50,0x5c};
unsigned char code wei_table[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code err[]={0x11,0x12,0x13,0x12,0x12,0x0e};
unsigned char count=0;
unsigned long a,b;
unsigned char flag=0;
//unsigned char flag1=1;
unsigned char key_code;
bit key_press=0;
void delay(long dly)
{
while(dly--);
}
void disp(long dat)
{
bit flag1=0;
long e;
unsigned char i;
e=dat;
if(e==0)
{
for(i=0;i<5;i++)
{
show[5-i]=0x11;
}
show[0]=0x00;
}
else if((e>999999)||(e<-999999))
{
for(i=0;i<6;i++)
{
show[i]=err[i];
}
}
else
{
if(e<0)
{
flag1=1;
e=-e;
}
for(i=0;i<6;i++)
{
if(e>=1)
{
show[i]=e%10;
e=e/10;
}
else
{
if(flag1==1)
{
show[i]=0x10;
flag1=0;
}
else
{
show[i]=0x11;
}
}
}
}
}
4.? 仿真proteus8.6
? 本设计采用proteus8.6软件(内附安装包)实现仿真设计,如下图所示。proteus软件一般存在高低版本兼容问题,该仿真是通过proteus8.6导出的,所以请尽量使用proteus8.6打开文件,低于proteus8.6的版本不能够正常使用,高于proteus8.6的版本除了proteus8.8/8.9理论上可以正常使用。
计算过程:
5.? 设计报告
设计报告主要包括硬件电路、软件设计、仿真调试等等,仅供参考。
6.? 资料清单
设计资料主要包括C程序+仿真+设计报告+使用说明+元件清单+操作视频等。
7.? 资料获取链接
百度网盘下载链接:【Q03】百度网盘下载链接
更多单片机仿真设计合集:单片机仿真设计合集
阅读全文
1157