/*****************************
*设计者:李文
*功能:共阴的数码管显示0-f
*
*
*
*******************************/
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
uchar code table[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,
0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71};//0-f的数码管编码
void delay(uint x)//延时函数
{
uchar y;
while(x--)
{
for(y=0;y<125;y++);
}
}
void main()
{
uchar i;
P0=0xfe;
wela=1;
wela=0;
while(1)
{
for(i=0;i<16;i++)
{
dula=0;
P0=table[i]; //
dula=1;
delay(500);
}
}
}