欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 51單片機流水燈從左到右 源程序+電路圖 [打印本頁]

作者: Scorpionx    時間: 2019-10-12 12:33
標題: 51單片機流水燈從左到右 源程序+電路圖
流水燈左右走程序.docx (12.96 KB, 下載次數: 7)
圖加程序


單片機源程序如下:
  1. #include <REG52.H>
  2. void Delay1ms(unsigned int count)
  3. {
  4.     unsigned int i,j;
  5.     for(i=0;i<count;i++)
  6.     for(j=0;j<120;j++);
  7. }
  8. main()
  9. {
  10.     unsigned char LEDIndex = 0;
  11.     bit LEDDirection = 1;
  12.     while(1)【滿足條件執行下面程序】
  13.     {
  14.         if(LEDDirection)
  15.             P1 = ~(0x01<<LEDIndex);【滿足】<<表示邏輯移位
  16.         else
  17.             P1 = ~(0x80>>LEDIndex);【不滿足】~表示按位取反
  18.         if(LEDIndex==7)
  19.             LEDDirection = !LEDDirection;
  20.         LEDIndex = (LEDIndex+1)%8;    【%】取余數
  21.         Delay1ms(100);
  22.     }
  23. }

復制代碼







歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1