#include<reg52.h>
#include<intrins.h>
sbit s7=P3^0;
sbit s6=P3^1;
sbit s5=P3^2;
sbit s4=P3^3;
int b[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x84,0x8f};//0-f
int a[]={0x7E,0xBE,0xDE,0xEE,0x7D,0xBd,0xDD,0xED,0x7B,0xBB};//
int num;
void Delay30ms() //@11.0592MHz
{
unsigned char i, j, k;
_nop_();
_nop_();
i = 2;
j = 67;
k = 183;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}
void display(int num){
P0=0x01;//Y6??
P2=0xC0;
P2=0x00;
P0=b[num];//y7,?? 1
P2=0xE0;
P2=0x00;
}
void main(){
int i;
P0=0x00;
P2=0xA0;
P2=0x00;
while(1){
Delay30ms();
for(i=0;i<16;i++){
display(i);
Delay30ms();
}
}
}
|