微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 单片机应用实例:LED显示电脑电子钟

单片机应用实例:LED显示电脑电子钟

时间:02-07 来源:互联网 点击:

te,hour */

  n=a(i);

  n=n and 0fh;

  data=aco(n);

  call send595;

  n=a(i);

  n=shr(n,4);

  data=aco(n);

  call send595;

  end;

  do i=5 to 6; /* send month,year */

  n=a(i);

  n=n and 0fh;

  data=aco(n);

  call send595;

  n=a(i);

  n=shr(n,4);

  data=aco(n);

  call send595;

  end;

  n=a(8); /* send 19 or 20 */

  n=n and 0fh;

  data=aco(n);

  call send595;

  n=a(8);

  n=shr(n,4);

  data=aco(n);

  call send595;

  do m=0 to 5;

  n=ab(m);

  n=n and 0fh;

  data=aco(n);

  call send595_1;

  n=ab(m);

  n=shr(n,4);

  data=aco(n);

  call send595_1;

  end;

  ale=0;

  ale=1;

  end display;

  beginset:procedure;

  a(0)=06h;a(1)=58h;a(2)=59h;a(3)=23h;

  a(4)=30h;a(5)=06h;a(6)=97h;a(7)=00;

  a(8)=19h; /* set date/time (1997,7,1,8:00:00,week 3) */

  call wbyt1(8eh,0); /* write enable*/

  call wbyt1(80h,00h);/* start colock */

  call wbyt1(0beh,0abh);/*两个二极管与8K电阻串联充电*/

  command=0beh; /* write colock/date */

  call wbyt8;

  call wbyt1(0c0h,a(8));

  call wbyt1(8eh,80h); /* set write protect bit */

  end beginset;

  key:procedure;

  declare (i,time1,k1,tem) byte;

  call time(100);

  k1=7;time1=30;

  if mk=0 then

  do;

  do while time1>0;

  week: if k1=0 then

  do;

  do i=0 to 5;

  /* call hz(a(0)); */

  end;

  do i=0 to 3;

  /* call hz0; */

  end;

  end;

  tem=a(k1);

  if k1=7 then tem=a(8);

  a(k1)=0aah;

  if k1=7 then a(8)=0aah;

  call display;

  call time(254);

  call time (254);

  a(k1)=tem;

  if k1=7 then a(8)=tem;

  call display;

  call time(254);

  call time(254);

  call time(254);

  time1=time1-1;

  if mk=0 then

  do;call time(100); /*MOD KEY PROCESS*/

  TIME1=30;

  IF MK=0 THEN

  DO;

  k1=k1-1;

  DO WHILE K1=0FFH;

  K1=7;

  END;

  END;

  end;

  IF SK=0 THEN

  DO;CALL TIME(100); /*SET KEY PROCESS*/

  TIME1=30;

  IF SK=0 THEN

  DO;

  tem=tem+1;

  tem=dec(tem);

  DO CASE K1;

  DO WHILE tem=7;/*week*/

  tem=0;

  END;

  DO WHILE tem=60H;/*scond*/

  tem=0;

  END;

  DO WHILE tem=60H;/*minute*/

  tem=0;

  END;

  DO WHILE tem=24H;/*hour*/

  tem=0;

  END;

  DO WHILE tem=32H;/*date*/

  tem=1;

  END;

  DO WHILE tem=13H;/*month*/

  tem=1;

  END;

  DO while tem=100h; /* YEAR */

  tem=00;

  END;

  DO WHILE TEM>=21H;

  tem=19H;

  END;

  END;

  A(K1)=tem;

  if k1=7 then a(8)=tem;

  END;

  END;

  END;

  END;

  end key;

  main$program:

  mk=1;sk=1;temp1=0;num=0;p32=1;

  if sk=0 then call beginset;

  clk=0;da=0;ale=1;

  loop:

  do while mk=1 ;

  if a(0)>6 then a(0)=0;

  command=0bfh;

  call rbyt8;

  call display;

  do while mk=0;

  call key;

  call wbyt1(8eh,0);

  command=0beh;

  call wbyt8;

  call wbyt1(0C0H,A(8));

  call wbyt1(8eh,80h);

  end;

  end;

  goto loop;

  end start;

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top