资源描述:
《有关ds1302时钟和8051中断c程序的问题》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、有关dsl302时钟和8051中断c程序的问题大家好,我现在再做一个关于dsl302时钟和8051外部中断结合在-•起的问题,我要的,当有外部中断来的时候,会记录到当时的时间,存到一个自己定义的存储空间,并显示在1602led上而。如果没有中断,dsl302会正常运行,像一个时钟一样。我把两部分都已经做好了,不知道为什么,当把主程序和中段程序结合到一起的时候,就是不能正常运行,led现实的东西会乱码,时间和日期都是85。请哪位高人指点一下,谢谢!!!我把我笊程序贴出来了。请大家帮忙看看。第一次发贴,请多关照关照!
2、!#includevreg51.h>#include#defineLINE10#defineLINE21#defineLINE1_HEAD0x80#defineLINE2_HEADOxCO#defineLCD_DELAY_TIME500#defineDATA.MODE0X38#defineOPEN_SCREENOxOC#defineDISPLAY_ADDRESS0x80#defineCLEARSCREENLCD_en_command(0x01)#defineHIGH1#defineLOW0#
3、defineTRUE1#defineZERO0#defineMSB0x80#defineLSB0x01#defineDS1302_WP0x8E#defineDS1302_RESETRST=LOW;SCL=LOW;RST=HIGH#defineDS1302_WP_ENABLEWrite_Dsl302(DS1302_WPz0X00)#defineDS1302_WP_DISENABLEWrite_Dsl302(DS1302_WPz0x80)#defineLCDIOP2sbitLCD16O2_RS=P1A5;sbitLC
4、D16O2_RW=P1A6;sbitLCD16O2_EN=P1A7;sbitSCL=P1AO;sbitSDA=P1A1;sbitRS~=P1A2;//sbitout=P0A6;voidLCD_delay(void);//leddelayfunctionvoidLCD_en_command(unsignedcharcommand);//writecommandfucntionvoidLCD_en_dat(unsignedchartemp);//writedatafunctionvoidLCD_set_xy(unsi
5、gnedcharxzunsignedchary);//setdisplayaddressfunctionvoidLCD_write_char(unsignedx,unsignedchary,unsignedchardat);//writeledacharacterfunctionvoidLCD_write_string(unsignedcharX,unsignedcharYzunsignedchar*s);//writeledstringfunctionvoidLCDJnit(void);//ledinitize
6、functionvoidmsec(unsignedintx);//delayfunctionvoidWrite_Dsl302_byte(unsignedchartemp);voidWrite_Dsl302(unsignedcharaddress,unsignedchardat);unsignedcharRead_Dsl302(unsignedcharaddress);voidRead_RTC(void);//readRTCvoidSet_RTC(void);//setRTCvoidInitial(void);//
7、systeminitizefunctionvoiddisplay(void);//RTCdisplayfunctioncodeunsignedcharset_rtc_code[7]={0x00,0x20,0x18,0x04,0x02,0x07,0x08};//settheinitialvaluecodeunsignedcharwrite_rtc_address[7]={0x80,0x82,0x84,0x86,0x88,0x8a,0x8c};//setthewriteaddresscodeunsignedcharr
8、ead_rtc_address[7]={0x81,0x83,0x85,0x87,0x89z0x8b,0x8d};//setthereadaddresscodeunsignedchar*day[7]={"Mon,7,Tue",“Wen“,”Th『,“Frf「Sat罗Sun”};unsignedcharread_rtc_code[7];unsignedcharaaaaaa[7