#include< reg51.h> #define uint unsigned int #define uchar unsigned char sfr P0M0 = 0x94; sfr P0M1 = 0x93; sfr P2M0 = 0x96; sfr P2M1 = 0x95; uchar count; uchar i; uchar code leddata[]={ 0xC0, //"0" 0xF9, //"1" 0xA4, //"2" 0xB0, //"3" 0x99, //"4" 0x92, //"5" 0x82, //"6" 0xF8, //"7" 0x80, //"8" 0x90, //"9" 0x88, //"A" 0x83, //"B" 0xC6, //"C" 0xA1, //"D" 0x86, //"E" 0x8E, //"F" 0x89, //"H" 0xC7, //"L" 0xC8, //"n" 0xC1, //"u" 0x8C, //"P" 0xA3, //"o" 0xBF, //"-" 0xFF, //?? 0xFF //??? }; uchar code ledwei[]={ 0x01,0x02,0x04,0x08, 0x10,0x20,0x40,0x80 }; void init(){ EX0 = 1; IT0 = 1; EA = 1; } void display(){ P0 = leddata[count]; P2 = ~ledwei[i]; } void main(){ P0M0 = 0x00; P0M1 = 0x00; P2M0 = 0x00; P2M1 = 0x00; init(); while(1) { display(); } } void int0() interrupt 2{ count++; i++; if(count == 16){ count = 0; } if(i == 8){ i = 0; } }