间隔1S发光管循环闪烁
源代码在线查看: 延时1s闪烁led.lst
C51 COMPILER V6.12 ____1S____LED 03/21/2009 22:00:22 PAGE 1
C51 COMPILER V6.12, COMPILATION OF MODULE ____1S____LED
OBJECT MODULE PLACED IN .\延时1S闪烁LED.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE .\延时1S闪烁LED.c DEBUG OBJECTEXTEND
stmt level source
1 #include
2 #include
3 #define uint unsigned int
4 #define uchar unsigned char
5 void del(uint);
6 void main()
7 {
8 1 uint sum=0xfe;
9 1 while(1)
10 1 {
11 2 P1=sum;
12 2 del(10);//延时1S,注意del中的y初值,这种无法精确定时,要精确定时可用定时器
13 2 P1=0xff;
14 2 del(10);
15 2 P1=sum;
16 2 del(10);
17 2 P1=0xff;
18 2 sum=_crol_(sum,2);
19 2 del(10);
20 2 }
21 1
22 1 }
23
24 void del(uint z)
25 {
26 1 uint x,y;
27 1 for(x=z;x>0;x--)
28 1 for(y=12500;y>0;y--);
29 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 79 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 2
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)