标题: 超声波数码管测距程序的疑问? [打印本页]

作者: king@    时间: 2016-12-13 14:02
标题: 超声波数码管测距程序的疑问?
                     #include <AT89x51.H>                //器件配置文件
                         #include <intrins.h>
                         #define  RX  P0_1
                         #define  TX  P0_2
                         unsigned int  time=0;
                         unsigned int  timer=0;
                         unsigned char posit=0;
                         unsigned long S=0;
                         bit      flag =0;
                         unsigned char const discode[] ={ 0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0xBF,0xff/*-*/};
                         unsigned char const positon[3]={ 0xdf,0xef,0xf7};
                         unsigned char disbuff[4]           ={ 0,0,0,0,};
/********************************************************/
    void Display(void)                                 //扫描数码管
        {
         if(posit==0)
         {P1=(discode[disbuff[posit]])&0x7f;}
         else
         {P1=discode[disbuff[posit]];}
          P2=positon[posit];
          if(++posit>=3)
          posit=0;
        }
/********************************************************/

谁能帮我解释一下扫描数码管这段程序的意思?






欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1