标题: 从左到右的流水灯流水灯的仿真 [打印本页]

作者: 枫未名    时间: 2017-5-10 18:20
标题: 从左到右的流水灯流水灯的仿真
是不是很好玩
  1. #include <reg52.h>
  2. #include <intrins.h>
  3. #define uchar unsigned char
  4. #define uint unsigned int

  5. void DelayMS(uint x)
  6. {
  7.         uchar i;
  8.         while(x--)
  9.         {
  10.                  for(i=120;i>0;i--);
  11.         }
  12. }

  13. void main()
  14. {
  15.         P0 = 0xFE;
  16.         while(1)
  17.         {
  18.                  P0 = _crol_(P0,1);
  19.                 DelayMS(150);
  20.         }
  21. }
复制代码

下载:
02 从左到右的流水灯.zip (45.4 KB, 下载次数: 12)






欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1