|
程序部分
7 s+ d) ~' e: A#include <reg51.h>
0 M% L- }* n: r7 G d' g9 Svoid delay (unsigned int i)) f0 x. a5 Q; t5 L3 i
{0 ~# E' I7 e5 E1 x5 X3 w; h( e* }
unsigned int k; H. E5 D- |. y( J9 u( A
for (k=0;k<i;k++);" D0 v' S4 P& r0 O3 O
}
4 x& n2 l+ s! D, [void main()
( i0 e9 a$ k L{3 N- b5 ]; U4 t, K) C; g s/ V
unsigned char aa,i;
" K7 n: o+ `8 M8 l% @4 l' I- x/ Zwhile(1)1 ]7 X; S! ?$ q& ?
{
1 P8 Z. R' m0 f- N1 V: [8 Naa=0x80;
' B1 \8 M0 t0 e# @1 ^for(i=0;i<8;i++)
5 e( ?1 ~" ^( h- r5 k; [$ V{" t- n# C; G# e4 D7 L: R
P1=aa;! Z+ R, v4 H) _
delay(25000);
. J7 U9 k- s7 [0 Q2 d# w, q( y$ naa>>=1;//左移
& r2 b5 W a3 X# M, J} T- D& m; Z# A" X. _ ~6 l
}
. G9 H6 H' ]8 @' C8 @, ^}+ F6 Q) ?- j5 i) P+ z
c+ S j7 o/ M/ X
b! T% F4 \; A- T* h
|
|