此文章對于剛接觸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);
}
}
}
|