|
程序部分
! G5 S0 m5 \' ^; V#include <reg51.h>
8 r5 J! y/ k9 k4 p; gvoid delay (unsigned int i)
! T* q5 m# B' g, j2 j{0 C4 B+ T% O6 @9 ]& j3 s$ c" a
unsigned int k;* Z* R! z; ~+ S, s' P- P, E* F( Y6 t
for (k=0;k<i;k++);9 O/ S- x! O" U+ V2 d9 h' I
}
* V* I* Z0 O6 q5 L% R" Jvoid main()
3 A! f5 T9 V9 ~7 x{
) r, z' ]* O! [8 l) d& s2 d# Wunsigned char aa,i;
& m1 j! L/ `9 y+ y4 ]$ Bwhile(1)0 I3 E/ z9 K! m- K/ Q
{) `5 u+ P: h/ S) @/ N+ g! a# j
aa=0x80;
7 a8 P+ C. H2 @for(i=0;i<8;i++)- i( y3 `0 U( }) x* D; R: u
{
3 I* A) A# J4 v6 F) WP1=aa;
1 P3 f7 c [# N$ Vdelay(25000);: X. N7 T0 d) I3 `+ H
aa>>=1;//左移9 w2 W8 y% t6 Z
}
6 `$ m) P& |: g0 I* D+ d}. C: x' K2 _- L$ P# ?: n8 @' H
}7 C: o- @: b! l5 U
7 ?9 r' F) W- a
, s3 W9 ?3 J* u9 X. q7 x2 E4 w+ {
|
|