⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csyg.c

📁 ADSL测试仪
💻 C
📖 第 1 页 / 共 3 页
字号:
  Col=0;
  Disp1608(); */  //显示程序
    if(!Languageflag) //Languageflag=0吗?(汉语)
        strncpy_P(Line_str,DiplayTwoMenu1,5);// "下行:"
    else
        strncpy_P(Line_str,DiplayTwoMenu1E,5);//  "Down:  :"
    Line=1;
    Line_nums=5;
    Col=0;
    Disp1608();  //显示程序
    if(!Languageflag) //Languageflag=0吗?(汉语)
        strncpy_P(Line_str,&DiplayTwoMenu2[5],5);//"上行:"
    else
        strncpy_P(Line_str,&DiplayTwoMenu2E[5],5);// "UP  :"
    Line_nums=5;
    Line=2;
    Col=0;
    Disp1608();  //显示程序
    if(!Synflag)  //Synflag=0?
    {
        strncpy(Line_str,"--   ",5);
        Line=1;
        Line_nums=5;
        Col=5;
        Disp1608();  //显示程序
        Line=2;
        Disp1608();  //显示程序
    }
    else//Synflag=1
    {
       strncpy(Line_str, Dsl.Down_Svalue,4);//36.0???????线路容量    下行   ()换
       Line=1;
       Line_nums=6;
       Col=8;
       Line_str[4]='d';
       Line_str[5]='B';
       Disp1608();  //显示程序
       strncpy(Line_str, Dsl.Up_Svalue,4);//17.0 ?????线路容量     上行  ()换
       Line=2;
       Col=8;
       Disp1608();  //显示程序
    }
  Line_str[0]=24;//    向上降键头
  Line=0;  // 第一行
  Col=15; // 第15列
  Line_nums=1;//一个字
  Disp1608();  //显示程序
  Line_str[0]=25;     //向下降键头
  Line=3;  // 第四行
  Disp1608();  //显示程序
}

void DisplayThree(void) //显示3面    ?????功率
{
  if(!Languageflag) //Languageflag=0吗?(汉语)
      strncpy_P(Line_str,DisplayThreeMenu1,15);//功率(dBm)"
   else
      strncpy_P(Line_str,DisplayThreeMenu1E,15);//"Power(dBm)"
  Line=0;
  Line_nums=15;
  Col=0;
  Disp1608();   //显示程序
  
  if(!Languageflag) //Languageflag=0吗?(汉语)
      strncpy_P(Line_str,DisplayThreeMenu3,15);//"噪声余量(dB)"
   else
      strncpy_P(Line_str,DisplayThreeMenu3E,15);//"Snr  Mgn(dB)"
  Line=0;
  Line_nums=15;
  Col=0;
  Disp1608();   //显示程序
  
  Line_str[0]=24;//向上键头
  Line=0;
  Col=15;
  Line_nums=1;
  Disp1608();  //显示程序
  Line_str[0]=25;//向下键头
  Line=3;
  Disp1608();  //显示程序
   if(!Languageflag) //Languageflag=0吗?(汉语)
        strncpy_P(Line_str,DiplayThreeMenu2,3);//"下:上:"
    else
        strncpy_P(Line_str,DiplayThreeMenu2E,3);//"D:U:"
    Line=1;
    Line_nums=3;
    Col=0;
    Disp1608();  //显示程序
    Line=1;
    Disp1608();  //显示程序
    if(!Languageflag) //Languageflag=0吗?(汉语)
        strncpy_P(Line_str,&DiplayThreeMenu2[3],3);//"下:上:"
    else
        strncpy_P(Line_str,&DiplayThreeMenu2E[3],3);//"D:U:"
    Line=3;
    Line_nums=3;
    Col=8;
    Disp1608();  //显示程序
    Line=1;
    Disp1608();  //显示程序
  if(!Synflag)   //Synflag=0?
  {
    strncpy(Line_str," --  ",4);
    Line=1;
    Line_nums=4;
    Col=3;
    Disp1608();  //显示程序
     Col=11;
    Disp1608();  //显示程序
    strncpy(Line_str,"--   ",4);
    Line=3;
    Line_nums=4;
    Col=11;
    Disp1608();  //显示程序
    Col=3;
    Disp1608();  //显示程序
  }
  else
  {
    strncpy(Line_str,Dsl.Remote_Tx_Power,4);//20.5 
    Line=1;
    Col=3;
    Line_nums=4;
    Disp1608();  //显示程序
    strncpy(Line_str,Dsl.Remote_Tx_Power,4);//20.5 
    Col=11;
    Line_nums=4;
    Disp1608();  //显示程序
    strncpy(Line_str,Dsl.Remote_SNR_Margin,4);//9.5 
    Line=3;
    Col=3;
    Line_nums=4;
    Disp1608();  //显示程序
    strncpy(Line_str,Dsl.Local_SNR_Margin,4);//6.0 
    Line=3;
    Col=11;
    Line_nums=4;
    Disp1608();  //显示程序
  }    
}

void DisplayFour(void)  //显示4面
{
  if(!Languageflag) //Languageflag=0吗?(汉语)
      strncpy_P(Line_str,DisplayFourMenu1,15);//"    线路衰减    "
   else
      strncpy_P(Line_str,DisplayFourMenu1E,15);//"   Line Atten   "
  Line=0;
  Line_nums=15;
  Col=0;
  Disp1608();   //显示程序
 /* if(!Languageflag) //Languageflag=0吗?(汉语)
      strncpy_P(Line_str,DisplayThreeMenu2,15);
   else
      strncpy_P(Line_str,DisplayThreeMenu2E,15);
  Line=2;
  Line_nums=15;
  Col=0;
  Disp1608(); */  //显示程序
    if(!Languageflag) //Languageflag=0吗?(汉语)
        strncpy_P(Line_str,DiplayTwoMenu1,5);// "下行:      "
    else
        strncpy_P(Line_str,DiplayTwoMenu1E,5);//  "Down:     "
    Line=1;
    Line_nums=5;
    Col=0;
    Disp1608();  //显示程序
   /* if(!Languageflag) //Languageflag=0吗?(汉语)
        strncpy_P(Line_str,&DiplayTwoMenu2[5],5);//"下行:上行:"
    else
        strncpy_P(Line_str,&DiplayTwoMenu2E[5],5);// "Down:UP  :"*/
        if(!Languageflag) //Languageflag=0吗?(汉语)
        strncpy_P(Line_str,DiplayTwoMenu2,5);//"下行:上行:"
    else
        strncpy_P(Line_str,DiplayTwoMenu2E,5);// "Down:UP  :"
    Line_nums=5;
    Line=2;
    Col=0;
    Disp1608();  //显示程序
    if(!Synflag)  //Synflag=0?
    {
        strncpy(Line_str,"--   ",5);
        Line=1;
        Line_nums=5;
        Col=5;
        Disp1608();  //显示程序
        Line=2;
        Disp1608();  //显示程序
    }
    else//Synflag=1
    {
       strncpy(Line_str,Dsl.Local_Line_Att,4);//36.0
       Line=1;
       Line_nums=6;
       Col=8;
       Line_str[4]='d';
       Line_str[5]='B';
       Disp1608();  //显示程序
       strncpy(Line_str,Dsl.Remote_Line_Att,4);//17.0 
       Line=2;
       Col=8;
       Disp1608();  //显示程序
    }
  Line_str[0]=24;
  Line=0;
  Col=15;
  Line_nums=1;
  Disp1608();  //显示程序
  Line_str[0]=25;
  Line=3;
  Disp1608();  //显示程序
}

void DisplayFive(void)  //显示5面
{
   if(!Languageflag) //Languageflag=0吗?(汉语)
      strncpy_P(Line_str,DisplayFiveMenu,15);//"    电池电量    "
   else
      strncpy_P(Line_str,DisplayFiveMenuE,15);//"    Battery     "
   Line=0;
   Line_nums=15;
   Col=0;
   Disp1608();  //显示程序      显示"    电池电量    "
   
   Line_str[0]=25;//向下键头
  Line=3;
  Col=15;
  Line_nums=1;
  Disp1608();  //显示程序
  
  Line_str[0]=24;//向上键头
  Line=0;
  Disp1608();  //显示程序
   Disp2();
  
}


void DisplaySix(void)  //显示6面
{
   unsigned char i;
   if(!Languageflag) //Languageflag=0吗?(汉语)
      strncpy_P(Line_str,DisplaySixMenu,15);//" 历史记录(D/U)  "
   else
      strncpy_P(Line_str,DisplaySixMenuE,15);//"   Record(D/U)  "
   Line=0;            //第一行
   Line_nums=15;      //15个字
   Col=0;             //从1列开始
   Disp1608();   //显示程序        " 历史记录(D/U)  "
   
   Line_str[0]=24;//向上键头
   Line=0;         //1行
   Col=15;          //15列
   Line_nums=1;     //一个字
   Disp1608();  //显示程序
       
 //  RecordDown=EE_RecordDown1;
 //  RecordUP=EE_RecordUP1;
  // sprintf(BUF,"%#5dK",RecordDown);
  // strncpy(&Line_str[3],BUF,6);
  // sprintf(BUF,"%#5dK",RecordUP);
  // strncpy(&Line_str[10],BUF,6);
   for(i=0;i<5;i++)
   {  
       Line_str[3+i]=EE_RecordDown1[i];  //第一次下行速率
       Line_str[10+i]=EE_RecordUP1[i];   //第一次上行速率
   }

   strncpy_P(Line_str,number,2);//"⑴⑵⑶     "flash char number[]="⑴⑵⑶";
   Line_str[2]=' ';//数组付值 空格
   Line_str[8]='K';//数组付值 K
   Line_str[9]='/';//数组付值 /
   Line_str[15]='K';//数组付值 K
   Line=1;
   Line_nums=16;
   Col=0;
   Disp1608();   //显示程序
  // RecordDown=EE_RecordDown2;
  // RecordUP=EE_RecordUP2;
  //sprintf(BUF,"%#5dK",RecordDown);
  // strncpy(&Line_str[3],BUF,6);
  // sprintf(BUF,"%#5dK",RecordUP);
   //strncpy(&Line_str[10],BUF,6);
   for(i=0;i<5;i++)
   {  
       Line_str[3+i]=EE_RecordDown2[i];    //第二次下行速率    从EEPROM中调入
       Line_str[10+i]=EE_RecordUP2[i];     //第二次上行速率
   }
   strncpy_P(Line_str,&number[2],2);//"⑴⑵⑶"   &number[2] 数组元素地址
   Line=2;
   Disp1608();   //显示程序
  // RecordDown=EE_RecordDown3;
  // RecordUP=EE_RecordUP3;
  // sprintf(BUF,"%#5dK",RecordDown);
  // strncpy(&Line_str[3],BUF,6);
  // sprintf(BUF,"%#5dK",RecordUP);
  // strncpy(&Line_str[10],BUF,6);
   for(i=0;i<5;i++)
   {  
       Line_str[3+i]=EE_RecordDown3[i];  //第三次下行速率
       Line_str[10+i]=EE_RecordUP3[i];   //第三次上行速率
   }                                                         //**第四次速率将进入第三次速率第一速率
   strncpy_P(Line_str,&number[4],2);//"⑴⑵⑶"
   Line=3;
   Disp1608();   //显示程序
}

void Disp2(void)//电源块
{
  char i,j,k;
  for(i=0;i<113;i++)
  {
     DrawDot(31,7+i);//画点
     DrawDot(48,7+i);//画点
  }
  for(i=0;i<2;i++)
  {
     DrawLine(4+i,7);//画线
     DrawLine(4+i,119);//画线
  }
   k=Battery;//*8;
  for(i=0;i<2;i++)
  {
    for(j=0;j<k;j++)
      DrawLine(4+i,7+j);//画线
  }
  
}

void DrawLine(unsigned char x,unsigned char y)//画线
{
  //signed char  temp;
  char CSY_addr;
  //char dot[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
  IniLCD();   //屏幕初始化
 // X_address=x/8;
 // Y_address=y;
  SET_CS1;
  CLR_CS2;
  //Y_address++;
  CSY_addr=y;//;Y_address;
  if(CSY_addr>63)//Y_address>63)
  {
        CSY_addr-=64;//CSY_addr=CSY_addr-64
        SET_CS2;
        CLR_CS1;
  }
  Read_BF();  //判断显示器忙?
  DDRB=0xff;
  CLR_RW;
  CLR_RS;
  PORTB=CSY_addr+0x40;
  SET_E;
  CLR_E;
  Read_BF();  //判断显示器忙?
  DDRB=0xff;
  CLR_RW;
  CLR_RS;
  PORTB=x+0xb8;//X_address+0xb8;
  SET_E;
  CLR_E;
  Read_BF();  //判断显示器忙?
  CLR_RW;
  SET_RS;
  DDRB=0xff;
  PORTB=0xff;
  SET_E;
  CLR_E;
}
void DrawDot(unsigned char x,unsigned char y)//画点
{
  //signed char  temp;
  char CSY_addr;
  char dot[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
  IniLCD();   //屏幕初始化
 // X_address=x/8;
 // Y_address=y;
  SET_CS1;
  CLR_CS2;
  //Y_address++;
  CSY_addr=y;//;Y_address;
  if(CSY_addr>63)//Y_address>63)
  {
        CSY_addr-=64;
        SET_CS2;
        CLR_CS1;
  }
  Read_BF();  //判断显示器忙?
  DDRB=0xff;
  CLR_RW;
  CLR_RS;
  PORTB=CSY_addr+0x40;
  SET_E;
  CLR_E;
  Read_BF();  //判断显示器忙?
  DDRB=0xff;
  CLR_RW;
  CLR_RS;
  PORTB=x/8+0xb8;//X_address+0xb8;
  SET_E;
  CLR_E;
  Read_BF();  //判断显示器忙?
  CLR_RW;
  SET_RS;
  DDRB=0xff;
  PORTB=dot[x%8];
  SET_E;
  CLR_E;
}
void DelayTime(unsigned int Time)   //延时
{
  unsigned int count,i;
  for(i=0;i<Time;i++)
      for(count=0;count<1730;count++);
}  
void Initial(void)//初始化
{
   unsigned int i=0;
  //nsigned char temp;
  //nt temp1;
   
  WDTCR=(1<<4)|(1<<3);
  WDTCR=0x00;
  MCUCR=0;
 
  for(i=0;i<10000;i++);
  Clr_LCD();    //清列
  PORTD&=0xdf;
  Key();      //判断有键按下吗?
  if(Key_pressed)//Key_pressed=1有键按下
  {
     Get_Keycode();//取键值
     if(KeyCode==BG_KEY)//键值=BG_KEY吗?
     {
           SetupLanguage(); //设置中英
     }
  }
  PORTD|=0x03;
  UBRRH=0x00;
  UBRRL=5;
  UCSRA=0x02;
  UCSRB=0x18;
  UCSRC=0x86; 
  
  
  TCCR1B=0x1a;//??
  TCCR1A=2;//
  ICR1=15000;
  TIMSK=0x04; 
  _SEI();//开中断

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -