这个是一个基于51单片机的非接触式红外温度测量的设计,做出算是一个半成品吧,还不是特别完善,但能够实现基本功能。我们组决定用STC89C52来做,其他小组大多用STC8A8K64S4A12来做。个人觉得这一题并不是特别难,主要是学会MLX90615的驱动程序以及各种调用,还有老师专门提供的Nokia5110显示屏来做显示。刚开始做的时候脑子里是有大致电路的,在网上找了挺多资料 ,边找边做。我自己负责程序方面的,然而我程序不是特别突出就会一些基本的调用啥的。随便放一下我们的设计,大家感兴趣可以玩玩哦。
单片机源程序如下:
- #include "nokia_5110.h"
- #include "reg52.h"
- #include "MLX90615.h"
- #include "delay.h"
- #include "stdio.h"
- void Int0Init()
- {
- //设置INT0
- IT0=1;//跳变沿出发方式(下降沿)
- EX0=1;//打开INT0的中断允许。
- EA=1;//打开总中断
- }
- void Int0() interrupt 0 //外部中断0的中断函数
- {
- unsigned char SlaveAddress; // Contains device address
- unsigned char command,j; // Contains the access command
- unsigned int tdata,i; // Contains data value
- command=RAM_Access|RAM_To; // Form RAM access command + RAM address
- LCD_clear();
- while(1)
- {
- LCD_write_english_string(0,2,"Temperature is ");
- tdata=MemRead(SlaveAddress,command); //Read memory
- tdata=tdata*2-27315;
- if(tdata>3700)
- {
- LCD_BL=0xff;
-
- }
- else{LCD_BL=0x00;}
- for(i=1000;i>1;i=i/10)
- {
- j=tdata/i;
- LCD_write_char(j+'0');
- tdata=tdata-i*j;
- if(i<1000&&i>=100)
- {LCD_write_char('.');}
- }
- LCD_write_char(tdata+'0');
- delay_ms(100);
- LCD_clear();
- LCD_write_english_string(42,3,"Celsius");
- }
- }
- void main(void)
- {
-
- MLX90615_init();
- LCD_init();
- LCD_clear();
- LCD_write_chinese_string(0,0,12,5,0,5);
- delay_ms(100);
- Int0Init(); // 设置外部中断0
- while(1);
- }
复制代码
全部资料51hei下载地址:
A1非接触式红外温度测量STC89C52 MLX90615 Nokia5110最终.rar
(5.83 MB, 下载次数: 42)
此处可以直接提取链接:https://pan.baidu.com/s/1fzILGAPBWwNVc5IYaxql7w 提取码:vfdx
|