程序部分
( j k F" r Z% c. F#include <reg51.h>; V2 X" n3 i, L, i
void delay (unsigned int i) \. I0 I; Z' N. E, S
{
, R4 T- x9 d; n' Z6 P0 O) vunsigned int k;
9 p* h }: {" W0 dfor (k=0;k<i;k++);7 ^5 P& Y" C3 b: A
}
9 v1 U- L% ^5 O3 Y8 S1 e: K" D, avoid main()9 h+ l3 m3 A2 W9 s( e) ^3 I
{: r5 @; W% K. s, z' \
unsigned char aa,i;
2 R5 t ?2 c0 k/ B8 Uwhile(1)
: r0 j) x' w2 G% x7 `{3 R/ y/ K$ d$ K, i
aa=0x80;
5 {* B9 \8 I4 M, [( G* w, Kfor(i=0;i<8;i++)
9 N% F# D+ A7 K5 {{
1 Y1 U3 {1 o$ f- V s7 j% }; PP1=aa;3 |- b: u1 G- z+ Q& ~0 B F
delay(25000);: d% h2 y! {/ T( B# O, l1 H% V& t
aa>>=1;//左移
9 f% d* h+ Q: ~. ^}
7 R: e4 q. I9 l0 Y# {. `+ ]}/ V# x& h" g: o" I( g
}3 t S8 g; k4 ^* v
8 }% ~) H8 f' F, l, y( _! r: a3 l7 m. ?' w
|