资源描述:
《出租车计价器毕业论文附录》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、北京信息科技大学毕业设计(论文)附录题目:学院:专业:学生姓名:班级/学号指导老师/督导老师:起止时间:2012年月日至2012年月日目录附件1原理图············································共1页附件2PCB图···········································共1页附件3程序代码·········································共19页附件4外文资料翻译·····································共11页原理图PCB图程序代码#include
2、#defineucharunsignedchar#defineuintunsignedintuchartable2[]="abcdef";sbitlcdwr=P2^6;sbitlcdrs=P2^5;sbitlcden=P2^7;sbitbeep=P2^4;sbitsclk=P3^7;sbitio=P3^6;sbitrst=P3^5;sbitscl=P3^0;sbitsda=P3^1;ucharmodel;//模式标志位ucharyue,ri,xq,shi,fen,miao;//月,日,星期,时,分,秒ucharqibu=50,danjia=5;uintzongji
3、a,lucheng,zzongjia,zlucheng;ucharxiugai;//修改时间和起步价单价标志uintzj;uintzlc;ucharzu;//组数uintcount;//定时器中的数uintwaitmiao,waitfen;//等待时间uintcount1,count2;//外部中断中的数ucharxsfen,xsmiao;//行驶时间ucharwait;//等待标志uintspeed;//速度标志ucharcycount;//速度采样值voiddelayms(uintx){uinti,j;for(i=x;i>0;i--)for(j=110;j>0;j--);}void
4、delay(){;;}/******************************1602液晶部分******************************/voidyjwrite_com(ucharcom){lcdrs=0;P0=com;delayms(5);lcden=1;delayms(5);lcden=0;}voidyjwrite_date(uchardate){lcdrs=1;P0=date;delayms(5);lcden=1;delayms(5);lcden=0;}voidyjinit(){lcdwr=0;lcden=0;yjwrite_com(0x38);yjwri
5、te_com(0x0c);yjwrite_com(0x06);yjwrite_com(0x01);//显示清0,指针清0}/***************************************************************************************DS1302时间部分***************************************************************************************/voidwrite_byte(ucharcom,uchardate)//向DS1302模地址写数据
6、{uchari;rst=0;sclk=0;rst=1;for(i=0;i<8;i++){if(com&0x01)io=1;elseio=0;com>>=1;sclk=0;delayms(1);sclk=1;}sclk=0;for(i=0;i<8;i++){if(date&0x01)io=1;elseio=0;date>>=1;sclk=0;delayms(1);sclk=1;}sclk=0;rst=0;}ucharread_byte(ucharcom){uchari,date;rst=0;sclk=0;rst=1;for(i=0;i<8;i++){if(com&0x01)io=1;el
7、seio=0;com>>=1;sclk=0;delayms(1);sclk=1;}for(i=0;i<8;i++){if(io)date
8、=0x80;date>>=1;sclk=1;delayms(1);sclk=0;}sclk=0;rst=0;returndate;}voidds1302init(){sclk=0;rst=0;write_byte(0x8e,0);//写保护寄存器,最高位WP=1,写保护,WP=0,不写保护//write_by