关于51单片机控制SIM900发短信,检测噪声报警程序,一直报错不知道为啥?
2019-07-15 08:21发布
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
#include <reg52.h>#include "LCD1602.h"#define uchar unsigned char#define uint unsigned int#define FOSC_110592M//#define FOSC_12Munsigned char welcome[]={"welcome!"};unsigned char Show0[6]={"Noise:"};unsigned char Show1[5]={"dB"};unsigned long code Countnum[100]={10,11,12,13,15,17,19,22,25,28, 31,35,39,43,48,54,60,67,75,84, 94,105,117,131,146,163,182,204,228,255, 286,320,359,402,451,506,567,636,713,799, 896,1005,1127,1264,1418,1590,1783,2000,2244,2517, 2824,3168,3556,3989,4475,5020,5632,6319,7089,7953, 8923,10011,11232,12602,14139,15863,17798,19969,22405,25138, 28204,31644,35504,39835,44694,50146,56263,63127,70828,79469, 89164,100042,112247,125941,141305,158544,177886,199588,223937,251257, 281910,316303,354891,398187,446765,501270,562424,631039,708025,794404,};unsigned char code dB[100][3]={"031","032","033","034","035","036","037","038","039","040","041","042","043","044","045","046","047","048","049","050","051","052","053","054","055","056","057","058","059","060","061","062","063","064","065","066","067","068","069","070","071","072","073","074","075","076","077","078","079","080","081","082","083","084","085","086","087","088","089","090","091","092","093","094","095","096","097","098","099","100","101","102","103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119","120", "121","122","123","124","125","126","127","128","129","130", }; sbit beep=P2^2;sbit key_1=P2^1;sbit key_2=P2^0;sbit P10=P1^0;sbit P11=P1^1;sbit P12=P1^2;sbit P13=P1^3;sbit P14=P1^4;unsigned long count,c;uchar t,z;uchar shu,ys;void delayms(uint xms) //延时xms{ uint x,y; for(x=xms;x>0;x--) for(y=90;y>0;y--);}
void key(){ if (key_1==0) { delayms(10); if (key_1==0) { while(key_1==0); if (shu<99) shu++; } } if (key_2==0) { delayms(10); if (key_2==0) { while(key_2==0); if (shu>0) shu--; } }
}
void alARM(){ ys++; if (ys>20) { ys=0; beep=!beep; }}void Serial_interrupt() interrupt 4 {
uchar temp; temp=SBUF; rec_data[rec_num++]=temp; if(rec_num>=50) rec_num=0; else ; RI=0;//????????,???????
}void Uart1Sends(uchar *str){ while(*str!='') { SBUF=*str; while(!ti);//????????(TI=1)?? TI=0; str++; }}void Uart1BYTE(uchar temp){ SBUF=temp; while(!TI);//????????(TI=1)?? TI=0;
}
一周热门 更多>