#include<reg52.h> typedef unsigned int u16; typedef unsigned char u8; sbit LSA=P2^2; sbit LSB=P2^3; sbit LSC=P2^4; u8 code smg[17]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07, 0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}; //P0 0 1 2 3 4 5 6 7 8 9 A b C d E F 空 u8 code smg138[8]={0x00,0x04,0x08,0x0c,0x10,0x14,0x18,0x1c}; //P2 smg0 smg1 smg2 smg3 smg4 smg5 smg6 smg7 void delay(u16 i) { while(i--); } main() { u16 i,j; //P0=smg[0]; /*while(1) { for(i=0;i<8;i++) { P2=smg138[i]; for(j=0;j<16;j++) { P0=smg[j]; delay(20000); } delay(10000); } } */ while(1) { for(j=0;j<16;j++) { for(i=0;i<8;i++) { P0=smg[j]; delay(500); P2=smg138[i]; delay(500); } delay(10000); } } } |