喜欢的看看吧
原理图+工程
制作出来的实物图如下:
单片机源程序如下:
- #include "main.h"
- #include "LCD1602.h"
- #include "clock.h"
- #include "key.h"
- #include "DS18B20.h"
- #include "temp.h"
- #include "BEEP.h"
- #include "ISD1420.h"
- #include "speakTEMP.h"
- //unsigned char code str0[]={"--- : : -----"};
- //unsigned char code str1[]={"temp: . oC-----"};
- /*********延时K*1ms,12.000mhz**********/
- void delayMs(unsigned int ms)
- {
- unsigned char j;
- while(ms--)
- {
- for(j=0; j<=125; j++);
- }
- }
- /***************初始化*******************/
- void init()
- {
- P1=0xff; //初始化p1口,全设为1
- P3=0xff;
- top_temp = 30;
- bottom_temp = 1;
- delayMs(500);
- initLCM( );
- initClock();
- initTemp();
- // initSpeakTemp();
- BEEP = 1;
- }
- /***************the main funtion****************/
- void main(void)
- {
- init( ); //初始化
- while (1)
- {
- scan_key();
- delayMs(10);
- ReadTemperature( );
- if(temp > top_temp || temp < (char)bottom_temp) beep();
- displayTemp();
- if(DisplayTimeFlag)
- displayClock();
- else
- displayTempLim();
- delayMs(10);
- }
- }
复制代码- #include "speakTEMP.h"
- /*********初始化语音播报温度子程序**********/
- /*void initSpeakTemp()
- {
- TCON = 0x01 ; //触发方式为脉冲负边沿触发
- EA=1;
- EX0=1;
- }
- */
- /*********语音播报温度子程序**********/
- void speak_temp(unsigned int temp_t){
- int digit1,digit0;
- digit1 = temp_t / 10; //十位
- digit0 = temp_t % 10; //个位
- if(digit1==0){
-
- speak_isd1420(speak_world[digit0]);
- speak_isd1420(speak_world[11]);
-
- }
- else{
- speak_isd1420(speak_world[digit1]);
- speak_isd1420(speak_world[10]); //播十
- if(digit0!=0)
- speak_isd1420(speak_world[digit0]);
- speak_isd1420(speak_world[11]); //播度
- }
- }
- /***************语音播报(外部中断0)*******************/
- /*void sp_temp_control() interrupt 0 using 1
- {
- EA = 0;
- speak_temp(temp);
- EA = 1;
- }*/
复制代码
所有资料51hei提供下载:
new.rar
(803.17 KB, 下载次数: 66)
|