资源描述:
《单片机家庭防盗报警系统》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、单片机家庭防盗报警系统(系统图+原理图+电路图+GSM短信+i源程序)-论文单片机家庭防盗报警系统(系统图+原理图+电路图+GSM短信+i源程序)1•程序初始化:;RAM定义BCDUNTDATA07FHTIMERDATA07EHTIMER1DATA07DHTIMER2DATA07CHHOURSDATA07BHHOURGDATA07AHMINUSDATA079HMINUGDATA078HSECOSDATA077HSECOGDATA076HSECX)DATA075HMINUDATA074HHOURDATA073HTENDATA072HFLAGDATA071HDINDA
2、TA020HDOUTDATA021HSLADATA070HSUBADATAOOHACKBITOOH;I/O定义KEYBITP3.2CSBITPl.2CLKBITPl.3DATBITPl.4SCLBITP1.0SDABITPl.lMTDEQU04AHMRDEQU058HMRD1EQU063HORG0000HAJMPSTARTORGOOO3H;外部中断0中断服务子程序入口地址AJMPINTLORG0013H;外部中断1中断服务子程序入口地址AJMPTNTYORG0100HSTART:MOVSP,#3OHMOVPl,#11110011B;initialI/OMOVSLA
3、,#OAOH;FM24C16器件从地址MOVSUBA,#OOH;器件子地址CLRP2.1MOVTMOD,#20H;串行口初始化MOVTH1,#OFDHMOVTL1,#OFDHMOVPCON,#OOHMOVSCON,#40HSETBTRISETBITO;INTO为1,边沿触发方式SETBIT1;INT1为1,边沿触发方式SETBEXOSETBEXISETBPX1;TNT1为高优先级SETBEA;开总中断MAIN:••-AJMPMAIN;主程序INTL:…RETI汐卜部中断0中断服务了程序INTY:…RETI;外部中断1中断服务子程序END2.HD7279键盘显示子程
4、序INTL:MOVDOUT,#15H;读键盘指令ACALLSENDMOVDOUT,#10100001BACALLSENDMOVDOUT,#11001000BACALLSENDMOVDOUT,B;send个位loHD7279AACALLSENDSETBCSRETISEND:MOVBCOUNT,#8;setbitcountei-8CLRCS;CSforlvACALLLDELAY;1ongde1aySLOOP:MOVC,DOUT.7;output1bitMOVDAT,CSETBCLK;setCLKforhvMOVA,DOUT;thedatathatwi11sendlef
5、tmoveRLAMOVDOUT,AACALLSDELAY;shortdelayCLRCLK;setCLKforlvACALLSDELAYDJNZBCOUNT,SLOOP;check8bitsendoverorelseCLRDAT;sendover,returnRETRECV:MOVBCOUNT,#8SETBDAT;sct(DATA)hv(inputstate)ACALLLDELAYRLOOP:SETBCLKACALLSDELAYMOVA,DINRLAMOVDIN,AMOVC,DATMOVDIN.0,C1086单片机家庭防盗报警系统(系统图+原理图+电路图+GSM短
6、信+1源程序)CLRCLKACALLSDELAYDJNZBCOUNT,RL(X)PRETLDELAY:MOVTIMER,#25;delay50uSDELOOP:DJNZTIMER,DELOOPRETSDELAY:MOVTIMER,#4;delay8uSSHOTLOP:DJNZTIMER,SHOTLOPRET3.FM24C16读写子程序START:SETBSDANOPSETBSCL;起始条件建立时间大于4.7usACALLDELAYCLRSDAACALLDELAYCLRSCL;钳住总线,准备发数据NOPRETSTOP:CLRSDANOPSETBSCL;发送结束条件的
7、时钟信号ACALLDELAYSETBSDA;结束总线ACALLDELAYRETMACK:CLRSDA;将SDA置0NOPNOPSETBSCLACALLDELAYCLRSCLNOPNOPRETMNACK:SETBSDANOPNOPSETBSCLACALLDELAYCLRSCLNOPNOPRETCACK:SETBSDANOPNOPSETBSCLCLRACKNOPNOPMOVC,SDAJCCEND;判断应答位SETBACKCEND:NOPCLRSCLNOPRETWRBYTE:MOVR0,#08Hwww.zhoogoo.cnSJMPWLP1WRO:CLRSDANOPSET
8、BSCLA