资源描述:
《宠物定时喂食器设计程序.doc》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、sbitDS1302CE=P0^0;sbitDS1302CK=P0^2;sbitDS1302IO=P0^1;externbitDS18B20_Reset(void);externvoidDS18B20_Write(unsignedcharcommand);externunsignedcharDS18B20_Read(void);sbitDQ=P1^0;#defineRSCLRP0_5=0//PORTC&=~BIT(PORTC0)#defineRSSETP0_5=1//PORTC
2、=BIT(PORTC0)#defineRWCLRP0_6=0//PORTC&=~BIT(PORT
3、C1)#defineRWSETP0_6=1//PORTC
4、=BIT(PORTC1)#defineENCLRP0_7=0//PORTC&=~BIT(PORTC2)#defineENSETP0_7=1//PORTC
5、=BIT(PORTC2)externvoidlcd_delay(unsignedintdelaytime);externvoidwrite_lcd_command(unsignedcharwrite_command);externvoidwrite_lcd_data(unsignedcharwrite_data);externvoidinitize_lcd(void
6、);externvoidlcd_displaystr(unsignedcharx,unsignedchary,constunsignedchar*str);externvoidlcd_displaystr_ram(unsignedcharx,unsignedchary,unsignedchar*str);带温度测量LCD显示的实时时钟externvoidInit_DS1302_RTC(void);externunsignedcharRead_DS1302_RTC(unsignedcharRTC_Address);externvoidWrite_DS1302_RTC(unsi
7、gnedcharRTC_Address,unsignedcharRTC_Data);#include#include"1602LCDDriver.h"#include"DS18B20Driver.h"#include"DS1302Driver.h"//#include"tiaozheng.h"#includestructTimerStruct{unsignedcharYear;unsignedcharMonth;unsignedcharDay;unsignedcharWeek;unsignedcharHour;unsignedcha
8、rMinute;unsignedcharSecond;};//constunsignedcharDATECODE1[]={"Tiaosh"};//constunsignedcharDATECODE[]={"Date:"};//constunsignedcharTIMECODE[]={"Time:"};constunsignedcharDATECODE1[]={"TH"};constunsignedcharDATECODE2[]={"DF"};constunsignedcharDATECODE3[]={"DJ"};//constunsignedcharDATECODE4[]=
9、{''};sbitkey1=P1^2;sbitkey2=P1^3;sbitkey3=P1^4;sbitsound=P1^1;sbitk1=P0^3;sbitk2=P0^4;unsignedcharmins,hours,days,months,weeks,years;unsignedchara,b,c,k,flag1,flag2,flag3,flag4,flag5;unsignedcharMinute1,Hour1,Day1,Month1,Week1,Year1;unsignedcharMinute2,Hour2,Day2,Month2,Week2,Year2;unsigne
10、dcharDATECODE22[1]={''};unsignedcharDATECODE33[1]={''};//structTimerStruct*Real;structTimerStructRealClock;unsignedcharDateBuffer1[]={"2006/08/18/5"};unsignedcharTimeBuffer1[]={"23:50:00"};//constunsignedcharDATECODE[]={"Date:"};//constunsignedcharTIMECODE[]={