#include <regx51.h> unsigned char x=0; void hien_thi(char x); void main() { while (1) { hien_thi(x); if (P2_7==0) x=x+1; if (x>9) x=0; while (P2_7==0) hien_thi(x); } } void hien_thi(char x) { switch (x) { case 0: P0 = 0x40;break; case 1: P0 = 0x79;break; case 2: P0 = 0x24;break; case 3: P0 = 0x30 ;break; case 4: P0 = 0x19;break; case 5: P0 = 0x12;break; case 6: P0 = 0x02;break; case 7: P0 = 0x78 ;break; case 8: P0 = 0x00;break; case 9: P0 = 0x10 ;break; } }