CBROMSR.rar

  • hpoejine
    了解作者
  • Windows_Unix
    开发工具
  • 9KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1
    下载次数
  • 2018-01-09 19:16
    上传日期
CC100和ML2724的控制;自动化控制
CBROMSR.rar
  • OneLED.c
    368B
  • TwoLED.c
    537B
  • timer.c
    5.4KB
  • bcc1000.C
    14.1KB
  • 5IQC.c
    17.8KB
  • j2724Ctrl.c
    1.9KB
内容介绍
#include<at89x52.h rel='nofollow' onclick='return false;'> #include <intrins.h> typedef unsigned char uchar; typedef unsigned int uint; sbit S1=P1^4; sbit S2=P1^5; sbit S3=P1^6; sbit S4=P1^7; sbit S5=P3^3; sbit DO=P1^0; sbit DI=P1^1; sbit SK=P1^2; sbit CS=P1^3; sbit LED=P3^0; sbit buzzer=P3^1; sbit OUTA=P3^4; sbit OUTB=P3^5; sbit OUTC=P3^6; sbit OUTD=P3^7; uchar bdata w; sbit w7=w^7; sbit w0=w^0; uchar bdata ad; sbit ad0=ad^0; bit INA,INB,INC,IND,IN_T,EXIT,EXIT_S,EXIT_T; bit buzz_a,buzz_b,buzz_c,buzz_d,err; uchar disp,hd,h,sd,udd,fd,vdd,cdd,mdd,tim_ms,tim_d,tim_k; uchar idata arya1[10];//长度数组 uchar idata arya2[10]; uchar idata arya3[10]; uchar idata aryb1[10]; uchar idata aryb2[10]; uchar idata aryb3[10]; uchar idata aryc1[10]; uchar idata aryc2[10]; uchar idata aryc3[10]; uchar idata aryd1[10]; uchar idata aryd2[10]; uchar idata aryd3[10]; uchar idata arye[10]; uchar idata aryf[8]; uchar idata *p1,*p2,*p3; uchar code tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0x8c,0xc7,0xaf,0xce,0x9f,0xb6,0xa3,0xbf,0xad,0x92,0xff,0xd5,0x8d,0xc1}; uchar idata *d; /*0, 1, 2, 3, 4, 5, ,6, 7, 8, 9, a, b, c, d, e, f, 10(P),11(L),12R,13T, 14I,15X, 16O, 17-, 18N, 19S, 1a, 1bV, 1cK,1du*/ void key(); void at93c46(bit com,uchar byte,uchar address,uchar idata *p); void counts(); void sjcl(); bit cjne(uchar add1,uchar add2); void sdt46(uchar k); uchar rdt46(); void msde(uchar ds); void msude(uchar dms); void main() using 0 { TMOD=0x11;P0=P2=P1=P3=0xff; CS=TF2=0;IT0=1;disp=0; TH2=0xfa;TL2=0xab; TH0=0x3c;TL0=0xbc; TH1=0x3c;TL1=0xaf; CS=SK=DI=0;TR1=DO=1; T2CON=0x01;T2MOD=0x00; INA=INB=INC=IND=0; d=arye; at93c46(0,5,0x3a,&arya1);//读长度 arya3[0]=arya2[0]=arya1[0]; arya3[1]=arya2[1]=arya1[1]; arya3[2]=arya2[2]=arya1[2]; arya3[3]=arya2[3]=arya1[3]; arya3[4]=arya2[4]=arya1[4]; arya3[5]=arya2[5]=arya1[5]; arya3[6]=arya2[6]=arya1[6]; arya3[8]=arya2[8]=arya1[8]; at93c46(0,5,0x05,&aryb1);//读长度 aryb3[0]=aryb2[0]=aryb1[0]; aryb3[1]=aryb2[1]=aryb1[1]; aryb3[2]=aryb2[2]=aryb1[2]; aryb3[3]=aryb2[3]=aryb1[3]; aryb3[4]=aryb2[4]=aryb1[4]; aryb3[5]=aryb2[5]=aryb1[5]; aryb3[6]=aryb2[6]=aryb1[6]; aryb3[8]=aryb2[8]=aryb1[8]; at93c46(0,5,0x0a,&aryc1);//读长度 aryc3[0]=aryc2[0]=aryc1[0]; aryc3[1]=aryc2[1]=aryc1[1]; aryc3[2]=aryc2[2]=aryc1[2]; aryc3[3]=aryc2[3]=aryc1[3]; aryc3[4]=aryc2[4]=aryc1[4]; aryc3[5]=aryc2[5]=aryc1[5]; aryc3[6]=aryc2[6]=aryc1[6]; aryc3[8]=aryc2[8]=aryc1[8]; at93c46(0,5,0x0f,&aryd1);//读长度 aryd3[0]=aryd2[0]=aryd1[0]; aryd3[1]=aryd2[1]=aryd1[1]; aryd3[2]=aryd2[2]=aryd1[2]; aryd3[3]=aryd2[3]=aryd1[3]; aryd3[4]=aryd2[4]=aryd1[4]; aryd3[5]=aryd2[5]=aryd1[5]; aryd3[6]=aryd2[6]=aryd1[6]; aryd3[8]=aryd2[8]=aryd1[8]; msde(2); while(1){ OUTA=!INA;OUTB=!INB;OUTC=!INC;OUTD=!IND; IE=0xab;TR1=TR2=S5=S1=S2=S3=S4=1; IN_T=EXIT=EXIT_S=EXIT_T=0; if((INA||INB||INC||IND)==1)TR0=1; else {TR0=0;LED=1; buzz_a=buzz_b=buzz_c=buzz_d=0;d=arye;} if(S5==0){ msde(10);S5=1;//有键按下延时计数 if((S5==0)&&(++cdd>=15)){//超过规定时间进入键处理 cdd=0;d=arye;arye[7]=0x10;arye[1]=arye[0]=0x1a; arye[6]=arye[5]=arye[4]=arye[3]=arye[2]=0;//p do{S5=1; TR0=INA=INB=INC=IND=0;LED=1; OUTA=OUTB=OUTC=OUTD=1;}while(S5==0); at93c46(0,4,0x35,&aryf);//读长度 key(); if(((arye[2]==0x09)&&(arye[3]==0x09)&&(arye[4]==0x09)&&(arye[5]==0x09)&&(arye[6]==0x09))||((aryf[2]==arye[2])&&(aryf[3]==arye[3])&&(aryf[4]==arye[4])&&(aryf[5]==arye[5])&&(aryf[6]==arye[6]))){ EXIT=0; while(EXIT==0){arye[0]=arye[1]=arye[2]=arye[3]=arye[4]=arye[5]=arye[6]=arye[7]=0x17; do{S1=S2=S3=1;d=arye; if(S2==0){IN_T=0;arye[0]=arye[1]=arye[2]=arye[3]=arye[4]=0x1a;arye[5]=0x012;arye[6]=0x11;arye[7]=0x0c;}//clr else if(S3==0){IN_T=1;arye[0]=arye[1]=arye[2]=arye[3]=0x1a;arye[4]=0x0b;arye[5]=0x13;arye[6]=0x0e;arye[7]=0x19;}//setb ; }while(S1==1); do{S1=1;}while(S1==0);////////////////////// if(IN_T==0){EXIT_T=1; do{S1=S4=1;d=arya1;if(S4==0)arya1[0]=arya1[1]=arya1[2]=arya1[3]=arya1[4]=arya1[5]=arya1[6]=arya1[8]=arya1[9]=0;arya1[7]=0x0a;}while(S1==1); do{S1=1;}while(S1==0); do{S1=S4=1;d=aryb1;if(S4==0)aryb1[0]=aryb1[1]=aryb1[2]=aryb1[3]=aryb1[4]=aryb1[5]=aryb1[6]=aryb1[8]=aryb1[9]=0;aryb1[7]=0x1d;}while(S1==1); do{S1=1;}while(S1==0); do{S1=S4=1;d=aryc1;if(S4==0)aryc1[0]=aryc1[1]=aryc1[2]=aryc1[3]=aryc1[4]=aryc1[5]=aryc1[6]=aryc1[8]=aryc1[9]=0;aryc1[7]=0x0c;}while(S1==1); do{S1=1;}while(S1==0); do{S1=S4=1;d=aryd1;if(S4==0)aryd1[0]=aryd1[1]=aryd1[2]=aryd1[3]=aryd1[4]=aryd1[5]=aryd1[6]=aryd1[8]=aryd1[9]=0;aryd1[7]=0x0d;}while(S1==1); do{S1=1;}while(S1==0); } else {EXIT_S=1; d=arya3;at93c46(0,5,0x20,&arya3);//读长度 arya3[7]=0x0a;key(); d=aryb3;at93c46(0,5,0x25,&aryb3);//读长度 aryb3[7]=0x1d;key(); d=aryc3;at93c46(0,5,0x2a,&aryc3);//读长度 aryc3[7]=0x0c;key(); d=aryd3;at93c46(0,5,0x2f,&aryd3);//读长度 aryd3[7]=0x0d;key(); d=aryf;at93c46(0,4,0x35,&aryf);//读长度 aryf[7]=0x10;key(); } msde(1); arye[7]=0x0e;arye[6]=0x15;arye[5]=0x14;arye[4]=0x13;arye[3]=0x17;arye[2]=0x16;arye[1]=0x0f;arye[0]=0x0f;//exit d=arye; do{S1=S2=S3=1; if(S2==0){EXIT=1;arye[2]=0x1a;arye[1]=0x16;arye[0]=0x18;}//on else if(S3==0){EXIT=0;arye[2]=0x16;arye[1]=0x0f;arye[0]=0x0f;}//off }while(S1==1); do{S1=1;}while(S1==0);} arya1[7]=arya3[7]=0x0a;arya3[1]=arya3[0]=0; aryb1[7]=aryb3[7]=0x1d;aryb3[1]=aryb3[0]=0; aryc1[7]=aryc3[7]=0x0c;aryc3[1]=aryc3[0]=0; aryd1[7]=aryd3[7]=0x0d;aryd3[1]=aryd3[0]=0; if(EXIT_T==1){ at93c46(1,5,0x3a,&arya1); at93c46(1,5,0x05,&aryb1); at93c46(1,5,0x0a,&aryc1); at93c46(1,5,0x0f,&aryd1); } if(EXIT_S==1){at93c46(1,5,0x20,&arya3); at93c46(1,5,0x25,&aryb3); at93c46(1,5,0x2a,&aryc3); at93c46(1,5,0x2f,&aryd3); at93c46(1,4,0x35,&aryf); } } else {arye[7]=0x19;arye[6]=0x0a;arye[5]=0x1b; arye[4]=0x0e;arye[3]=arye[2]=0x1a;arye[1]=0x16;arye[0]=0x1c;msde(10);} } } else { if(S1==0){ S1=1;cdd=0; msude(0x20);if(S1==0){ if(INA==1){INA=0;OUTA=1;} else{INA=1;OUTA=0;d=&arya1;} do{ S1=1;if(tim_ms>=20){tim_ms=0;LED=!LED; if(INA==1){p1=arya1;counts(); p1=arya2;counts(); p1=arya3;counts(); p1=arya1;p2=arya2;p3=arya3; sjcl(); buzz_a=cjne(0x3a,0x20);} if(INB==1){p1=aryb1;counts(); p1=aryb2;counts(); p1=aryb3;counts(); p1=aryb1;p2=aryb2;p3=aryb3; sjcl(); buzz_b=cjne(0x05,0x25);} if(INC==1){p1=aryc1;counts(); p1=aryc2;counts(); p1=aryc3;counts(); p1=aryc1;p2=aryc2;p3=aryc3; sjcl(); buzz_c=cjne(0x0a,0x2a);} if(IND==1){p1=aryd1;counts(); p1=aryd2;counts(); p1=aryd3;counts(); p1=aryd1;p2=aryd2;p3=aryd3; sjcl(); buzz_d=cjne(0x0f,0x2f);} } }while(S1==0); } } if(S2==0){ S2=1; msude(0x20);if(S2==0){ if(INB==1){INB=0;OUTB=1;} else{INB=1;OUTB=0;d=&aryb1;} do{ S2=1;if(tim_ms>=20){tim_ms=0;LED=!LED; if(INA==1){p1=arya1;counts(); p1=arya2;counts(); p1=arya3;counts(); p1=arya1;p2=arya2;p3=arya3; sjcl(); buzz_a=cjne(0x3a,0x20);} if(INB==1){p1=aryb1;counts(); p1=aryb2;c
评论
    相关推荐