1.
AT89C52
7SEG-COM-ANODE
2.
AT89C52
7SEG-MPX6-CA
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar code seg[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
uchar code shift[]={0x01,0x02,0x04,0x08,0x10,0x20};
void delay(uint i){
uint j;
while(--i){
j=255;
while(--j);
}
}
void main(){
uint i=0,j=0;
while(1){
P0=seg[i];
P2=shift[j];
delay(150);
i++;
j++;
if(i==10) i=0;
if(j==6) j=0;
}
}