標(biāo)題: 關(guān)于數(shù)碼管的程序 適合天翔匯凈的板子 [打印本頁]

作者: 朝朝1    時間: 2020-9-21 20:25
標(biāo)題: 關(guān)于數(shù)碼管的程序 適合天翔匯凈的板子
#include<reg52.h>
#define DataPort P0
sbit LATCH1=P2^6;
sbit LATCH2=P2^7;                 
unsigned char code dofly_DuanMa[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,
                                                   0x77,0x7c,0x39,0x5e,0x79,0x71};// ?????0~F
unsigned char code dofly_WeiMa[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//????????????,???
unsigned char TempData[10]; //??????????
void Display(unsigned char FirstBit,unsigned char Num);//???????
void Init_Timer0(void);//??????
/*------------------------------------------------
                    ???
------------------------------------------------*/
void main (void)
{
Init_Timer0();

while (1)         //???
  {

             TempData[0]=0x3f; // "o"
         TempData[1]=0x73; // "p"
                 //TempData[2]=0x79; // "E"
                // TempData[3]=0x54; // "n"
          }
}       
void Display(unsigned char FirstBit,unsigned char Num)
{
      static unsigned char i=0;
       LATCH1=1;     //???
       LATCH1=0;

       DataPort=dofly_WeiMa[i+FirstBit]; //???
       LATCH2=1;     //???
       LATCH2=0;

       DataPort=TempData[i]; //?????,??
       LATCH1=1;     //???
       LATCH1=0;

           i++;
      if(i==Num)
              i=0;


}

void Init_Timer0(void)
{
TMOD |= 0x01;          //????1,16????,??"|"?????????????????                     
//TH0=0x00;              //????
//TL0=0x00;
EA=1;            //?????
ET0=1;           //???????
TR0=1;           //???????
}


void Timer0_isr(void) interrupt 1
{
TH0=(65536-2000)/256;                  //???? 2ms
TL0=(65536-2000)%256;
Display(0,8);       // ???????

}








歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1