附录:
#include
#define uchar unsigned char #define ulong unsigned long #define uint unsigned int
int zkb1=2,zkb2=2; sbit P13=P2^4; sbit P14=P2^1; sbit CSOut=P1^6;
sbit RS = P2^6; sbit EN = P2^7; sbit LEDL=P1^4; sbit LEDR=P3^1; sbit BELL=P1^5; sbit TEST=P3^0; sbit keyD=P3^4; sbit keyC=P3^5; sbit keyB=P3^6; sbit keyA=P3^7; sbit kk=P3^0;
long int all=0,aa=0,an; ulong DATA,cc,bb; xdata uchar num=0,num1=0,miao1=0,fen1=0,miao2=0,fen2=0,YY1=0,YY2=0,dis=50,i,d,t,jj,h,mod,u,fen=0,miao=0,sj=0,g,j,temp=0,avg=0,j0=0,j1=0,j2=0,j3=0,K,m=0,click=0,a[48],b[4],bcd_dis[4],acd_dis[6],ccd_dis[3];
uchar code FFW[8]={0xfe,0xfc,0xfd,0xf9,0xfb,0xf3,0xf7,0xf6}; //反转 uchar code FFZ[8]={0xf6,0xf7,0xf3,0xfb,0xf9,0xfd,0xfc,0xfe}; //正转 uchar code table1[]=%uchar code table3[]=%uchar code table5[]=%uchar code table2[]=%uchar code table4[]=%uchar code table6[]=%uchar code table7[]=%uchar code table8[]=%uchar code table9[]=%uchar code table0[]=\
void CCOut(void) {
15
TH0=0; TL0=0; TR0=1; //40KHz
CSOut=0;//1
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_(); CSOut=1;
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
CSOut=0;//2
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_(); CSOut=1;
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
CSOut=0;//3
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_(); _nop_(); CSOut=1;
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
CSOut=0;//4
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_(); CSOut=1;
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_(); }
void delayns(uint xms) {
uint a,b;
16
for(a=0;a void writecom(uchar com) { RS=0; P0=com; delayns(1); EN=1; delayns(1); EN=0; } void writedata(uchar data11) { RS=1; P0=data11; delayns(1); EN=1; delayns(1); EN=0; } void initlcd() { EN=0; writecom(0x38); writecom(0x0c); writecom(0x06); writecom(0x01); } void ACD(ulong b) { acd_dis[0]=b/10000+0x30; acd_dis[1]=b/1000+0x30; acd_dis[2]=b/100+0x30; acd_dis[3]=b/10+0x30; acd_dis[4]=b+0x30; acd_dis[5]=0x00; } void BCD(ulong b) 17 { bcd_dis[0]=b/100+0x30; bcd_dis[1]=b/10+0x30; bcd_dis[2]=b+0x30; bcd_dis[3]=0x00; } void CCD(ulong b) { ccd_dis[0]=b/10+0x30; ccd_dis[1]=b+0x30; ccd_dis[2]=0x00; } void init(void) { TMOD=0x11;//T0定时器方式1 T2CON=0X00; TH1=0Xff; TL1=0Xf6; TH2=(65536-45872)/256; TL2=(65536-45872)%6; TH0=0; TL0=0; TR1=1; TR2=1; IT0=1;//INT0负边沿触发 IT1=1; IP=0x01;//INT0高优先级 ET1=1; ET2=1; EX1=1; EX0=1; EA=1;//开总中断 } void LCD_DISP(unsigned char string[]) { int i=0; while(string[i]) { writedata(string[i++]); delayns(1); } } void Receive(void) interrupt 0 18 { TR0=0; EX0=0; } void t1() interrupt 3 { TR1=0; ++click; if(click>100)click=0; if(click<=zkb1)P13=0; else P13=1; if(click<=zkb2)P14=0; else P14=1; TH1=0Xff; TL1=0XF6; TR1=1; } void int1() interrupt 2 { bb++; } void t2() interrupt 5 { TF2=0; sj++; if(sj==20) { sj=0; miao++; if(miao==60) { miao=0; fen++; if(fen==60)fen=0; } } } void beled() { BELL=LEDL=LEDR=0; delayns(150); BELL=LEDL=LEDR=1; 19 百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库毕业设计_完整智能小车(4)在线全文阅读。
相关推荐: