#include  "reg51.h"
#define uint unsigned int
void delay1ms();		//延时约1ms函数声明
void main()
{
   unsigned char code led[]={0xf7,0xf7,0x80,0xf7,0xeb,0xdd,0xbe,0xff};		
   unsigned char w[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};                       
   uint  i,m;  
   while(1) {
     for(m=0;m<400;m++)	//每个字符扫描显示400次，控制每个字符显示时间
         {        	
            for(i=0;i<8;i++)
            { 
               P2=w[i];		//行数据送P1口
               P1=~led[i];	//列数据送P0口
               delay1ms(); 
            }
         }        
      }  
}
//函数名：delay1ms
void delay1ms()
{
uint i;
for(i=0;i<200;i++);  	
}