|
h0 Q5 d7 @; Y+ O #include<reg51.h>
; Q% [% B h, H9 _#include<intrins.h>4 g. h k! R; F1 t
#define uchar unsigned char
/ c3 @# L- }6 n" F! G0 h. {4 A#define uint unsigned int) |5 L% a) `8 y; h' Q) @2 D
uchar code DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};; K8 q' T3 _7 }8 K
//延时9 G! T7 V k: Z8 x6 y/ x& Q
void DelayMS(uint x)4 w# a+ b6 S& s% L2 ~; c1 l' I
{
3 A% f: D* p8 w* V: h. |, suchar t;
7 _0 ]; y2 w3 k; |! {" D' B: A% O: Kwhile(x--) for(t=0;t<120;t++);9 A1 W$ Y$ B, ]! t8 ^8 H: p5 l
}7 k/ D' w8 ^3 s8 x7 Z( E
//主程序* l6 b- W7 Y* \% z+ T, N
void main()2 Z8 R' D, n+ Z9 }. j" l+ T0 Y
{. ]6 s1 h1 p" O6 F; N1 ?, M) B
uchar i=0; q- |' p1 ~9 _! K8 B1 p# w" _8 }1 E
P0=0x00;
. c9 U7 x2 ~4 t* Q' Q8 N% r' E/ Ewhile(1)
8 q. f8 U# p2 x- [{
$ Q6 s9 _& t& ^" D8 R/ |2 SP0=~DSY_CODE;0 c/ y& d' b0 Z9 i* j
i=(i+1)%10;
% e$ ^5 m: V3 d" }2 Z' C g7 {. n2 xDelayMS(300);
/ D0 h6 H* i9 }5 h) {6 J/ d}
% V0 B% [ z1 R}
( h( f% N, y$ j$ B8 e
. W( A$ |+ L0 H6 K( H5 v( \ |
|