|
程序部分% ^9 h1 ` F {8 f
#include <reg51.h>
6 i5 w. [ W( w5 w* j- svoid delay (unsigned int i)
1 q% |$ K, v- M+ U1 r{
+ G5 x1 t; G4 I$ ?9 v4 L) Z& Gunsigned int k;7 w1 N4 m# f! L. S% u+ }
for (k=0;k<i;k++);
& Q' B4 y( K' n) K% I$ p# t. u) a/ u}
7 s+ O. A/ F+ [8 x- Uvoid main()% k9 f# ~# Y* B! Y5 T: {0 c0 f* l* l
{" r6 [& b+ x, J( u8 c- p7 k
unsigned char aa,i;0 v1 x& M8 y8 s* {6 l: x
while(1)4 @8 I5 b6 p( m2 @1 z* K
{% ~+ Z9 U3 m; \" t. Z. \. \
aa=0x80;9 B5 V& t P4 c8 |/ i
for(i=0;i<8;i++)
. B$ _) P& b; ]! g( h9 I# I{! N( h! F! c j
P1=aa;9 S+ s" D a1 y' B: j( ~/ e
delay(25000);
& W) G7 Z& o7 C p! S% J+ laa>>=1;//左移. Y& m, M' l: E7 [; G% a* `4 A6 |& D. n
}" K, J$ y$ b( e& t: R7 l/ \/ g% T
}# T: [8 D( @$ O: P8 K* J; R
}
- _ S8 t) Z4 k; @- r$ c; q. Y$ q7 i3 U. `% a# O) R! @! w# F
# S; ~6 ~+ w1 b) X
|
|