此文章对于刚接触51系列单片机的小白来说 那是最好不过了, 基于51系列的AT89C52 显示今天的日期 但是需要改参数比如说 见图
#include<reg52.h>
#include <intrins.h>
void delay(unsigned int z)
{
unsigned char x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
unsigned char code SMG_table[16]=
{0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
char table1[8]={2,0,1,8,0,4,2,4};
void main()
{
char I=0;
unsigned char temp=0;
while(1)
{
//temp=0x80;
for(I=0;I<8;I++)
{
P3=0x00;
temp=(0x01<<I);
P3=temp;
P2=SMG_table[table1[I]];
delay(6);
}
}
}
|