#include <reg52.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar code DSY_CODE[]=
{
0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90
}
void DelayMS(uint x)
{
uchar i
while(x--)
{
for(i=200i>0i--)
}
}
void main()
{
uchar i,k=0x80
while(1)
{
for(i=8i>0i--)
{
P2=0xff
k=_crol_(k,1)
P0=DSY_CODE[8-i]
P2=k
DelayMS(3)
}
}
}
DISPLAY: MOV DPTR,#DAT1查表显示程序,利用P0口做段选码口输出/P2低三位做位选码 输出MOV A,R3
MOVC A,@A+DPTR
MOV P2,#01H
MOV P0,A
ACALL DELAY2
MOV DPTR,#DAT2
MOV A,R5
MOVC A,@A+DPTR
MOV P2,#02H
MOV P0,A
ACALL DELAY2
MOV A,R4
MOVC A,@A+DPTR
MOV P2,#04H
MOV P0,A
ACALL DELAY2
RET
DAT1: DB 0ffh,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h,0ffH,8eH
"灭","1","2","3","4","5","6","7","8","9","灭","F"
DAT2: DB 0c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h,0ffH,8eH
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)