#include <STC15F2K60S2.h> #define uint unsigned int #define uchar unsigned char #define ulong unsigned long uchar code seg[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; sbit key1=P0^0; #define LED1 P1 uint n; void delayms(uint ms){ uint i,j; for(i=ms;i>0;i--) for(j=110;j>0;j--); } void main(){ P1M0=0XFF; P1M1=0X00; n=0; while(1){ LED1=seg[n]; if(key1==0){ delayms(50); while(!key1); n++;} if(n>9) n=0; } }