|
7七段數(shù)碼管.png (17.18 KB, 下載次數(shù): 40)
下載附件
2018-6-22 16:40 上傳
8 k* P9 @2 ?5 z
#include<reg51.h>; s& C7 N8 V. n) g& P
#include<intrins.h>
w+ k# N1 e6 L/ g+ h#define uchar unsigned char
' O S9 z& `7 Q/ h' s#define uint unsigned int- T t, {9 _1 t
uchar code DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};
8 J! I) f7 @2 [8 ^) g7 m/ A$ B//延時" [; o ?4 |* Y) I' g
void DelayMS(uint x)
0 H. r/ ?) G) t{+ K' e/ K" \6 H, y4 t9 S
uchar t;: X: N" I# F# i& k
while(x--) for(t=0;t<120;t++);% h, w" @7 l3 f
}
' w a. u' h R3 ?* U0 F; p//主程序
. k! E# n$ ?4 k8 l/ \7 mvoid main()
: v3 W- U$ {, u! M0 ?3 n( k{
, |& [2 ^1 |9 }( u, Y+ fuchar i=0;
x. O: D. l6 {9 c6 j1 z) fP0=0x00;! R u" y+ B# E% K3 e" }- @0 v
while(1)9 G% \$ \" U- Y. L" l, F+ W
{
( {" V5 k8 J$ O( ~, O* ~P0=~DSY_CODE;8 }; g0 s0 J' b9 |* n! g
i=(i+1)%10;* d# y: t* [+ s; Z
DelayMS(300);7 d2 n3 s9 c/ @9 B1 M# r
}
, y# c; m/ d0 C1 D- A- ]} 6 A+ q6 N7 S6 X8 x. _, T( ~8 e
; f0 m& }1 {0 r) ?* @2 K* u
|
|