51单片机ADC0831+LCD12864+DAC0808+DS1302+24C64+Proteus仿真

51单片机ADC0831+LCD12864+DAC0808+DS1302+24C64


  • Proteus仿真
    在这里插入图片描述

LCD12864汉字取模方法

  • 取模软件:PCtoLCD2002
    在这里插入图片描述

主程序代码(由于包含的头文件比较多,不在此一一贴出,占用篇幅,资源放到文末尾)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <absacc.h>
#include <intrins.h>
#include <reg51.h>
#include "HZcode.h"
#include "LCD.h"
#include "1302.h"
#include "key.h"
#include "adc0831.h"

uchar time0_count; //time0计数器

//time0初始化
void time0\_init(void)
{
EA = 1;
ET0 = 1;
TMOD = 0x01;
PT0 = 1;
TH0 = 0x3C;
TL0 = 0xB0;
TR0 = 1;
}

void main(void)
{

I\_init();
InitLCD();
time0\_init();
show\_hz();
// show\_date\_time();
while(1)
{

judge\_key();
}

}
void time0\_interrupt(void)interrupt 1 using 0
{
TH0 = 0x3c;
TL0 = 0xb0;
time0_count++;
if(time0_count==20)
{
time0_count=0;
show\_date\_time();
a = readadc();
b1 = a/100;
b2 = (a%100)/10;
b3 = (a%100)%10;
show\_ad();
P3 = a; //进行数模转换
}
}


仿真资源和程序源码

1
2
3
链接:https://pan.baidu.com/s/13f5nVbvwBkQuGNEqy7aHUA 
提取码:s08q

关于源程序代码补充说明

源代码发布前,并没有解决关于工程项目编译后一个函数重载的警告信息。至于编译后产生7个报警信息当中6个报警信息源是函数没有调用的警告,这个种警告不影响程序的执行,只是浪费了空间,另一个警告是关于函数重入的问题,分享前,并没有解决这个警告,现在做补充:

  • LCD.h头文件,重入函数CheckState( ),后面添加关键字reentrant,来消除这条重入函数报警信息。
1
2
3
4
5
6
7
8
9
10
//状态检查
void CheckState(void) reentrant
{

uchar dat;
dat = 0x00;
di=0;
rw=1;
}

关于了解更多51单片机重入函数报警信息:https://blog.csdn.net/weixin_42880082/article/details/121330121