chinese直男口爆体育生外卖, 99久久er热在这里只有精品99, 又色又爽又黄18禁美女裸身无遮挡, gogogo高清免费观看日本电视,私密按摩师高清版在线,人妻视频毛茸茸,91论坛 兴趣闲谈,欧美 亚洲 精品 8区,国产精品久久久久精品免费

您好,歡迎來電子發(fā)燒友網(wǎng)! ,新用戶?[免費注冊]

您的位置:電子發(fā)燒友網(wǎng)>電子元器件>發(fā)光二極管>

源程序 - LED顯示搖棒制作

2011年12月27日 10:56 互聯(lián)網(wǎng) 作者:秩名 用戶評論(0
關(guān)鍵字:led(661777)
以下是源程序:

  /*************************************************************************/

  // ---------------

  // LED顯示搖棒

  // ---------------

  // 作者:nim 于 http://www.21icbbs.com 2005-1-7

  //

  // email: linyige@yahoo.com

  //

  // 本設(shè)計版權(quán)歸作者所有,請勿擅自用于商業(yè)目的,轉(zhuǎn)載請注明作者及出處

  /*************************************************************************/

  #include

  #define SEG 17 //每幀圖片分成17列來顯示

  #define INTERVAL 20 //每幅圖片在左右搖擺20次后換下一幅

  typedef unsigned char uchar;

  typedef unsigned int uint;

  code char pattern[17][3]={ //3幅圖片的字模

  {0xff,0xff,0xff},

  {0xff,0xff,0xff},

  {0xff,0xff,0xff},

  {0xff,0x9f,0xff},

  {0xff,0x6f,0xf9},

  {0xff,0x77,0x65},

  {0xfe,0xbb,0x1e},

  {0x7e,0xdd,0xfe},

  {0x00,0xee,0xfe},

  {0x7e,0xdd,0xfe},

  {0xfe,0xbb,0x1e},

  {0xff,0x77,0x65},

  {0xff,0x6f,0xf9},

  {0xff,0x9f,0xff},

  {0xff,0xff,0xff},

  {0xff,0xff,0xff},

  {0xff,0xff,0xff},

  };

  uchar phase,th1,tl1,index,count;

  main()

  {

  EA=0;

  EX0=1;

  ET1=1;

  PX0=1;

  IT0=1;

  TMOD=0x11;

  index=0;

  EA=1;

  while(1)

  {

  }

  }

  void Int0_Handle(void) interrupt 0 using 2

  {

  uint t0_time;

  TR0=0;

  TR1=0;

  TF1=0;

  t0_time=TH0<<8|TL0;

  TL0=0;

  TH0=0;

  TR0=1;

  t0_time=65535-t0_time/SEG;

  th1=t0_time/256;

  TH1=th1;

  tl1=t0_time % 256;

  TL1=tl1;

  if (count<3*INTERVAL){ //3幅圖片循環(huán)

  count++;

  }

  else{

  count=0;

  }

  index=count/INTERVAL;

  if (th1!=0xff || tl1!=0xff){ //如果擺動特別慢,定時器溢出就不顯示

  phase=0;

  TR1=1;

  }

  else{

  TR1=0;

  }

  }

  void Timer1(void) interrupt 3 using 3

  {

  if (phase

  {

  P1=pattern[phase][index];

  phase++;

  TH1=th1;

  TL1=tl1;

  }

  }

非常好我支持^.^

(78) 98.7%

不好我反對

(1) 1.3%

( 發(fā)表人:小蘭 )

      發(fā)表評論

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

      發(fā)表評論,獲取積分! 請遵守相關(guān)規(guī)定!

      ?