色哟哟视频在线观看-色哟哟视频在线-色哟哟欧美15最新在线-色哟哟免费在线观看-国产l精品国产亚洲区在线观看-国产l精品国产亚洲区久久

您好,歡迎來電子發燒友網! ,新用戶?[免費注冊]

您的位置:電子發燒友網>電子元器件>發光二極管>

源代碼 - LED旋轉時鐘制作(有源代碼)

2012年03月19日 12:07 本站整理 作者:秩名 用戶評論(0

源代碼:

  #include

  sbit gate11=P3^0;

  sbit gate12=P3^1;

  #define unit unsigned int

  #define uchar unsigned char

  uchar data BUFFER[]={0,0,0,0,1,1,7};

  uchar data M[]={31,28,31,30,31,30,31,31,30,31,30,31};

  uchar code NUM1[] =

  {

  0x80,0x7F,0xC0,0xFF,0x40,0x90,0x40,0x8C, // -0-

  0x40,0x82,0xC0,0xFF,0x80,0x7F,0x00,0x00,

  0x00,0x00,0x00,0x81,0x80,0x81,0xC0,0xFF, // -1-

  0xC0,0xFF,0x00,0x80,0x00,0x80,0x00,0x00,

  0x80,0xE0,0xC0,0xF0,0x40,0x98,0x40,0x8C, // -2-

  0x40,0x86,0xC0,0xC3,0x80,0xC1,0x00,0x00,

  0x80,0x40,0xC0,0xC0,0x40,0x84,0x40,0x84, // -3-

  0x40,0x84,0xC0,0xFF,0x80,0x7B,0x00,0x00,

  0x00,0x0C,0x00,0x0E,0x00,0x0B,0x80,0x89, // -4-

  0xC0,0xFF,0xC0,0xFF,0x00,0x88,0x00,0x00,

  0xC0,0x47,0xC0,0xC7,0x40,0x84,0x40,0x84, // -5-

  0x40,0x8C,0x40,0xFC,0x40,0x78,0x00,0x00,

  0x00,0x7F,0x80,0xFF,0xC0,0x84,0x40,0x84, // -6-

  0x40,0x84,0x00,0xFC,0x00,0x78,0x00,0x00,

  0xC0,0x00,0xC0,0x00,0x40,0xF0,0x40,0xF8, // -7-

  0x40,0x0C,0xC0,0x07,0xC0,0x03,0x00,0x00,

  0x80,0x7B,0xC0,0xFF,0x40,0x84,0x40,0x84, // -8-

  0x40,0x84,0xC0,0xFF,0x80,0x7B,0x00,0x00,

  0x80,0x03,0xC0,0x87,0x40,0x84,0x40,0x84, // -9-

  0x40,0xC4,0xC0,0x7F,0x80,0x3F,0x00,0x00,

  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63, // -:-

  0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,

  };

  uchar code NUM2[]=

  {

  0x00,0x00,0x7f,0x80,0xff,0xc0,0x82,0x40, // -0-

  0x8c,0x40,0x90,0x40,0xff,0xc0,0x7f,0x80,

  0x00,0x00,0x00,0x00,0x20,0x40,0x60,0x40, // -1-

  0xff,0xc0,0xff,0xc0,0x00,0x40,0x00,0x40,

  0x00,0x00,0x41,0xc0,0xc3,0xc0,0x86,0x40, // -2-

  0x8c,0x40,0x98,0x40,0xf0,0xc0,0x60,0xc0,

  0x00,0x00,0x40,0x80,0xc0,0xc0,0x88,0x40, // -3-

  0x88,0x40,0x88,0x40,0xff,0xc0,0x77,0x80,

  0x00,0x00,0x0c,0x00,0x1c,0x00,0x34,0x00, // -4-

  0x64,0x40,0xff,0xc0,0xff,0xc0,0x04,0x40,

  0x00,0x00,0xf8,0x80,0xf8,0xc0,0x88,0x40, // -5-

  0x88,0x40,0x8c,0x40,0x8f,0xc0,0x87,0x80,

  0x00,0x00,0x3f,0x80,0x7f,0xc0,0xc8,0x40, // -6-

  0x88,0x40,0x88,0x40,0x0f,0xc0,0x07,0x80,

  0x00,0x00,0xc0,0x00,0xc0,0x00,0x83,0xc0, // -7-

  0x87,0xc0,0x8c,0x00,0xf8,0x00,0xf0,0x00,

  0x00,0x00,0x77,0x80,0xff,0xc0,0x88,0x40, // -8-

  0x88,0x40,0x88,0x40,0xff,0xc0,0x77,0x80,

  0x00,0x00,0x70,0x00,0xf8,0x40,0x88,0x40, // -9-

  0x88,0x40,0x88,0xc0,0xff,0x80,0x7f,0x00,

  0x00,0x00,0x00,0xc0,0x01,0x80,0x03,0x00, // -/-

  0x06,0x00,0x0c,0x00,0x18,0x00,0x30,0x00,

  };

  unit disp1,disp2,key1,key2;

  unit ii,jj;

  unit i,sw,xz;

  void Delay(unit ms){

  ms=ms*3;

  while(--ms);

  }

  void num_led(int kk, int tt)

  {

  int jj;

  for(jj=0;jj<8;jj++){

  gate11=key1; gate12=key2;

  P2=~NUM1[kk+jj*2];P1=~NUM1[kk+1+jj*2];

  Delay(20);

  P1=0xff;P2=0xff;

  gate11=key2; gate12=key1;

  P2=~NUM2[tt+15-jj*2];P1=~NUM2[tt+14-jj*2];

  Delay(20);

  P1=0xff;P2=0xff;

  }

  }

  void display_clock(void)

  {

  key1=!key1;key2=!key2;

  disp1=BUFFER[3]/10;disp2=BUFFER[4]-(BUFFER[4]/10)*10;

  ii=disp1*16;jj=disp2*16;

  num_led(ii,jj);

  P2=0xff;P1=0xff;Delay(60);

  disp1=BUFFER[3]-disp1*10;disp2=BUFFER[4]/10;

  ii=disp1*16;jj=disp2*16;

  num_led(ii,jj);

  P2=0xff;P1=0xff;Delay(60);

  ii=160;jj=160;

  num_led(ii,jj);

  P2=0xff;P1=0xff;Delay(60);

  disp1=BUFFER[2]/10;disp2=BUFFER[5]-(BUFFER[5]/10)*10;

  ii=disp1*16;jj=disp2*16;

  num_led(ii,jj);

  P2=0xff;P1=0xff;Delay(60);

  disp1=BUFFER[2]-disp1*10;disp2=BUFFER[5]/10;

  ii=disp1*16;jj=disp2*16;

  num_led(ii,jj);

  P2=0xff;P1=0xff;Delay(60);

  ii=160;jj=160;

  num_led(ii,jj);

  P2=0xff;P1=0xff;Delay(60);

  disp1=BUFFER[1]/10;disp2=BUFFER[6]-(BUFFER[6]/10)*10;

  ii=disp1*16;jj=disp2*16;

  num_led(ii,jj);

  P2=0xff;P1=0xff;Delay(60);

  disp1=BUFFER[1]-disp1*10;disp2=BUFFER[6]/10;

  ii=disp1*16;jj=disp2*16;

  num_led(ii,jj);

  P2=0xff;P1=0xff;Delay(60);

  }

  void timer0(void) interrupt 1 using 1

  {

  TMOD=0x11;

  TH0=-(5000/256);

  TL0=-(5000%256);

  TR0=1;

  BUFFER[0]=BUFFER[0]+1;

  if (BUFFER[6]%4==0) M[1]=M[1]+1;

  if (BUFFER[0]>201+xz){

  BUFFER[0]=0;

  BUFFER[1]=BUFFER[1]+1;

  if (BUFFER[1]==60){

  BUFFER[1]=0;

  BUFFER[2]=BUFFER[2]+1;

  if (BUFFER[2]==60){

  BUFFER[2]=0;

  BUFFER[3]=BUFFER[3]+1;

  if (BUFFER[3]==24){

  BUFFER[3]=0;

  BUFFER[4]=BUFFER[4]+1;

  if (BUFFER[4]>M[BUFFER[5]-1]){

  BUFFER[4]=1;

  BUFFER[5]=BUFFER[5]+1;

  if (BUFFER[5]>12){

  BUFFER[5]=1;

  BUFFER[6]=BUFFER[6]+1;

  if(BUFFER[6]>99) {

  BUFFER[6]=0;

  M[1]=M[1]-1;

  }

  }

  }

  }

  }

  }

  }

  }

  void intersvr0(void) interrupt 0

  {

  sw=1;

  }

  void main(void)

  {

  xz=8;

  key1=1;key2=0;

  EA=1;

  IT0=1;EX0=1;

  IT1=1;ET0=1;

  TMOD=0x11;

  TH0=-5000/256; TL0=-5000%256;

  TR0=1;

  for(;;){

  Delay(10);

  if(sw==1) {display_clock();sw=0;}

  }

  }

非常好我支持^.^

(142) 64.5%

不好我反對

(78) 35.5%

( 發表人:diyfans )

      發表評論

      用戶評論
      評價:好評中評差評

      發表評論,獲取積分! 請遵守相關規定!

      ?
      主站蜘蛛池模板: 欧美午夜福利主线路| 亚洲日韩在线观看| DASD-700美谷朱里| 色橹橹欧美在线观看视频高清 | 在线天天看片免费视频观看| 久久免费视频在线观看6| japanesematur乱儿| 为什么丈夫插我我却喜欢被打着插| 花蝴蝶高清影视视频在线播放| 69ZXX少妇内射无码| 涩涩999| 久久精品国产久精国产果冻传媒 | 超碰 无码 中文字幕| 性VIDEOSTV另类极品| 摸老师丝袜小内内摸出水| 国产精品国产三级国产专区53 | 欧美性暴力变态xxxx| 国产人妻系列无码专区97SS| 最近中文字幕MV高清在线视频| 日本又黄又爽又色又刺激的视频| 狠狠国产欧美在线视频| 啊灬啊灬啊灬快灬深高潮啦| 亚洲日本欧美产综合在线 | 亚洲精品电影天堂网| 嫩草影院成人| 黑人强伦姧人妻日韩那庞大的| 被免费网站在线视频| 影音先锋xfplay影院av| 天海翼精品久久中文字幕| 免费毛片播放| 精品国产乱码久久久久久下载| 成人亚洲视频| 777米奇影院第七色色| 亚洲精品m在线观看| 日韩精品免费在线观看| 麻婆豆腐传媒视频免费| 果冻传媒2021一二三区| 丰满五十六十老熟女HD60| 999资源站| 伊人久久大香线蕉综合bd高清| 偷上邻居熟睡少妇|