#include "../App_Headers/includes.h"

// byte test;
/*void Show_prndnum(byte num){ //0123456  prnds  //双循环，针对4字节的rpnd
byte m,n,x,y,tmp;
     for(m=0;m<4;m++)
     {
          tmp=prnd_num[num][m];
          for(n=0;n<8;n++)
          { x= prnd[m][n] >>   3;
            y= prnd[m][n] & 0x07;
           if(tmp & 0x80)     tb_add[x].bbyte |=   1<<y ;
           else                       tb_add[x].bbyte &= ~(1<<y);
           tmp<<=1;
          }
     }
} */

/*void Show_num(byte grp,byte num){  /二维数组，固定循环，针对0-9这种8字段
byte n,tmp,x,y;
tmp=mod_num[num];

          for(n=0;n<7;n++)
          { x= tb_num[grp][n] >>   3;
            y= tb_num[grp][n] & 0x07;
           if(tmp & 0x01)     tb_add[x].bbyte |=   1<<y ;
           else                        tb_add[x].bbyte &= ~(1<<y);
           tmp>>=1;
          }
} */

//测试通信协议和断码屏io的对应关系

void test_group(unsigned char num)
{

  // Test_gpio(num,1,1);
  // Test_gpio(num,2,1);
  // Test_gpio(num,3,1);
  Test_gpio(num, 4, 1); //点
  Test_gpio(num, 5, 1);
  Test_gpio(num, 6, 1);
  Test_gpio(num, 7, 1);
  // Test_gpio(num,0,1);
}

void Test_gpio(unsigned char group_num, unsigned char io_num, unsigned char status)
{

  unsigned char k = 1;
  if (status == 1)
  {
    tb_add[group_num].bbyte |= (1 << io_num);
  }
  else
  {
    tb_add[group_num].bbyte &= ~(1 << io_num);
  }
}

void test_write_byte(unsigned char group_num, unsigned char data)
{

  tb_add[group_num].bbyte |= data;
}
void T_BOX_Show_num(byte grp, byte num)
{
  LCD_RAMTYPE tmp;
  tmp.bbyte = T_BOX[num];

  switch (grp)
  {
  case 1:
  {
    tb_add[14].bbit.a0 = tmp.bbit.a0; // a
    tb_add[8].bbit.a1 = tmp.bbit.a1;  // b
    tb_add[8].bbit.a3 = tmp.bbit.a2;  // c
    tb_add[14].bbit.a3 = tmp.bbit.a3; // d
    tb_add[14].bbit.a2 = tmp.bbit.a4; // e
    tb_add[14].bbit.a1 = tmp.bbit.a5; // f
    tb_add[8].bbit.a2 = tmp.bbit.a6;  // g

    break;
  }
  case 2:
  {
    tb_add[7].bbit.a4 = tmp.bbit.a0; // a
    tb_add[7].bbit.a0 = tmp.bbit.a1; // b
    tb_add[7].bbit.a2 = tmp.bbit.a2; // c
    tb_add[7].bbit.a7 = tmp.bbit.a3; // d
    tb_add[7].bbit.a6 = tmp.bbit.a4; // e
    tb_add[7].bbit.a5 = tmp.bbit.a5; // f
    tb_add[7].bbit.a1 = tmp.bbit.a6; // g

    break;
  }
  case 3: //右1
  {
    tb_add[6].bbit.a4 = tmp.bbit.a0; // a
    tb_add[6].bbit.a0 = tmp.bbit.a1; // b
    tb_add[6].bbit.a2 = tmp.bbit.a2; // c
    tb_add[6].bbit.a7 = tmp.bbit.a3; // d
    tb_add[6].bbit.a6 = tmp.bbit.a4; // e
    tb_add[6].bbit.a5 = tmp.bbit.a5; // f
    tb_add[6].bbit.a1 = tmp.bbit.a6; // g

    break;
  }
  default:;
  }
}

/*-------------------------------------------------------------------------
* Function Name  : Show_num
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void Show_num(byte grp, byte num)
{
  LCD_RAMTYPE tmp;
  tmp.bbyte = mod_num[num];

  switch (grp)
  {
  //大计显示
  case 1: //左1
  {
    tb_add[16].bbit.a4 = tmp.bbit.a0; // a
    tb_add[16].bbit.a5 = tmp.bbit.a1; // b
    tb_add[16].bbit.a6 = tmp.bbit.a2; // c
    tb_add[16].bbit.a7 = tmp.bbit.a3; // d
    tb_add[17].bbit.a3 = tmp.bbit.a4; // e
    tb_add[17].bbit.a1 = tmp.bbit.a5; // f
    tb_add[17].bbit.a2 = tmp.bbit.a6; // g

    break;
  }
  case 2:
  {
    tb_add[15].bbit.a4 = tmp.bbit.a0; // a
    tb_add[15].bbit.a5 = tmp.bbit.a1; // b
    tb_add[15].bbit.a6 = tmp.bbit.a2; // c
    tb_add[15].bbit.a7 = tmp.bbit.a3; // d
    tb_add[16].bbit.a2 = tmp.bbit.a4; // e
    tb_add[16].bbit.a0 = tmp.bbit.a5; // f
    tb_add[16].bbit.a1 = tmp.bbit.a6; // g

    break;
  }
  case 3:
  {
    tb_add[14].bbit.a4 = tmp.bbit.a0; // a
    tb_add[14].bbit.a5 = tmp.bbit.a1; // b
    tb_add[14].bbit.a6 = tmp.bbit.a2; // c
    tb_add[14].bbit.a7 = tmp.bbit.a3; // d
    tb_add[15].bbit.a2 = tmp.bbit.a4; // e
    tb_add[15].bbit.a0 = tmp.bbit.a5; // f
    tb_add[15].bbit.a1 = tmp.bbit.a6; // g

    break;
  }
  case 4:
  {
    tb_add[14].bbit.a0 = tmp.bbit.a0; // a
    tb_add[8].bbit.a1 = tmp.bbit.a1;  // b
    tb_add[8].bbit.a3 = tmp.bbit.a2;  // c
    tb_add[14].bbit.a3 = tmp.bbit.a3; // d
    tb_add[14].bbit.a2 = tmp.bbit.a4; // e
    tb_add[14].bbit.a1 = tmp.bbit.a5; // f
    tb_add[8].bbit.a2 = tmp.bbit.a6;  // g

    break;
  }
  case 5:
  {
    tb_add[7].bbit.a4 = tmp.bbit.a0; // a
    tb_add[7].bbit.a0 = tmp.bbit.a1; // b
    tb_add[7].bbit.a2 = tmp.bbit.a2; // c
    tb_add[7].bbit.a7 = tmp.bbit.a3; // d
    tb_add[7].bbit.a6 = tmp.bbit.a4; // e
    tb_add[7].bbit.a5 = tmp.bbit.a5; // f
    tb_add[7].bbit.a1 = tmp.bbit.a6; // g

    break;
  }
  case 6: //右1
  {
    tb_add[6].bbit.a4 = tmp.bbit.a0; // a
    tb_add[6].bbit.a0 = tmp.bbit.a1; // b
    tb_add[6].bbit.a2 = tmp.bbit.a2; // c
    tb_add[6].bbit.a7 = tmp.bbit.a3; // d
    tb_add[6].bbit.a6 = tmp.bbit.a4; // e
    tb_add[6].bbit.a5 = tmp.bbit.a5; // f
    tb_add[6].bbit.a1 = tmp.bbit.a6; // g

    break;
  }
    //油耗显示
  case 7: //左1
  {
    tb_add[12].bbit.a7 = tmp.bbit.a0; // a
    tb_add[12].bbit.a6 = tmp.bbit.a1; // b
    tb_add[12].bbit.a5 = tmp.bbit.a2; // c
    tb_add[12].bbit.a4 = tmp.bbit.a3; // d
    tb_add[12].bbit.a0 = tmp.bbit.a4; // e
    tb_add[12].bbit.a2 = tmp.bbit.a5; // f
    tb_add[12].bbit.a1 = tmp.bbit.a6; // g
    break;
  }
  case 8:
  {
    tb_add[13].bbit.a7 = tmp.bbit.a0; // a
    tb_add[13].bbit.a6 = tmp.bbit.a1; // b
    tb_add[13].bbit.a5 = tmp.bbit.a2; // c
    tb_add[13].bbit.a4 = tmp.bbit.a3; // d
    tb_add[13].bbit.a0 = tmp.bbit.a4; // e
    tb_add[13].bbit.a2 = tmp.bbit.a5; // f
    tb_add[13].bbit.a1 = tmp.bbit.a6; // g

    break;
  }
  case 9:
  {
    tb_add[4].bbit.a3 = tmp.bbit.a0; // a
    tb_add[4].bbit.a7 = tmp.bbit.a1; // b
    tb_add[4].bbit.a5 = tmp.bbit.a2; // c
    tb_add[4].bbit.a0 = tmp.bbit.a3; // d
    tb_add[4].bbit.a1 = tmp.bbit.a4; // e
    tb_add[4].bbit.a2 = tmp.bbit.a5; // f
    tb_add[4].bbit.a6 = tmp.bbit.a6; // g
    break;
  }
  case 10: //右1
  {
    tb_add[5].bbit.a3 = tmp.bbit.a0; // a
    tb_add[5].bbit.a6 = tmp.bbit.a1; // b
    tb_add[5].bbit.a4 = tmp.bbit.a2; // c
    tb_add[5].bbit.a0 = tmp.bbit.a3; // d
    tb_add[5].bbit.a1 = tmp.bbit.a4; // e
    tb_add[5].bbit.a2 = tmp.bbit.a5; // f
    tb_add[5].bbit.a5 = tmp.bbit.a6; // g

    break;
  }

  //时间显示
  case 11: //左1
  {
    tb_add[0].bbit.a3 = tmp.bbit.a0; // a
    tb_add[0].bbit.a7 = tmp.bbit.a1; // b
    tb_add[0].bbit.a5 = tmp.bbit.a2; // c
    tb_add[0].bbit.a0 = tmp.bbit.a3; // d
    tb_add[0].bbit.a1 = tmp.bbit.a4; // e
    tb_add[0].bbit.a2 = tmp.bbit.a5; // f
    tb_add[0].bbit.a6 = tmp.bbit.a6; // g

    break;
  }
  case 12:
  {
    tb_add[1].bbit.a3 = tmp.bbit.a0; // a
    tb_add[1].bbit.a7 = tmp.bbit.a1; // b
    tb_add[1].bbit.a5 = tmp.bbit.a2; // c
    tb_add[1].bbit.a0 = tmp.bbit.a3; // d
    tb_add[1].bbit.a1 = tmp.bbit.a4; // e
    tb_add[1].bbit.a2 = tmp.bbit.a5; // f
    tb_add[1].bbit.a6 = tmp.bbit.a6; // g

    break;
  }
  case 13:
  {
    tb_add[2].bbit.a3 = tmp.bbit.a0; // a
    tb_add[2].bbit.a7 = tmp.bbit.a1; // b
    tb_add[2].bbit.a5 = tmp.bbit.a2; // c
    tb_add[2].bbit.a0 = tmp.bbit.a3; // d
    tb_add[2].bbit.a1 = tmp.bbit.a4; // e
    tb_add[2].bbit.a2 = tmp.bbit.a5; // f
    tb_add[2].bbit.a6 = tmp.bbit.a6; // g

    break;
  }
  case 14: //右1
  {
    tb_add[3].bbit.a3 = tmp.bbit.a0; // a
    tb_add[3].bbit.a7 = tmp.bbit.a1; // b
    tb_add[3].bbit.a5 = tmp.bbit.a2; // c
    tb_add[3].bbit.a0 = tmp.bbit.a3; // d
    tb_add[3].bbit.a1 = tmp.bbit.a4; // e
    tb_add[3].bbit.a2 = tmp.bbit.a5; // f
    tb_add[3].bbit.a6 = tmp.bbit.a6; // g

    break;
  }
  }
}
/*-------------------------------------------------------------------------
* Function Name  : Show_QY1
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void Show_QY1(byte num)
{ //二维数组，固定循环，针对0-9这种8字段
  // byte n;
  LCD_RAMTYPE tmp;
  tmp.bbyte = mod_num[num];

  switch (num)
  {
  case 1:
  {
    tb_add[19].bbyte = 0x10;
    tb_add[17].bbyte = 0;

    break;
  }
  case 2:
  {

    tb_add[17].bbyte = 0;
    tb_add[19].bbyte = 0x30;

    break;
  }
  case 3:
  {

    tb_add[17].bbyte = 0;
    tb_add[19].bbyte = 0x70;

    break;
  }
  case 4:
  {

    tb_add[17].bbyte = 0;
    tb_add[19].bbyte = 0xf0;

    break;
  }
  case 5:
  {

    tb_add[17].bbyte = 0;
    tb_add[19].bbyte = 0xf8;

    break;
  }
  case 6:
  {

    tb_add[17].bbyte = 0;
    tb_add[19].bbyte = 0xfc;

    break;
  }
  case 7:
  {

    tb_add[17].bbyte = 0;
    tb_add[19].bbyte = 0xfe;
    break;
  }
  case 8:
  {

    tb_add[19].bbyte = 0xff;
    tb_add[17].bbyte = 0;
    break;
  }
  case 9:
  {
    tb_add[19].bbyte = 0xff;
    tb_add[17].bbyte = 0x10;

    break;
  }
  case 10:
  {
    tb_add[19].bbyte = 0xff;
    tb_add[17].bbyte = 0x30;

    break;
  }
  case 11:
  {
    tb_add[19].bbyte = 0xff;
    tb_add[17].bbyte = 0x70;

    break;
  }
  case 12:
  {
    tb_add[19].bbyte = 0xff;
    tb_add[17].bbyte = 0xf0;

    break;
  }
  default:
    tb_add[19].bbyte = 0x00;
    tb_add[17].bbyte = 0x00;
  }
}
void Show_QY2(byte num)
{ //??????飬???????????0-9????8???
  // byte n;
  LCD_RAMTYPE tmp;
  tmp.bbyte = mod_num[num];

  switch (num)
  {
  case 1:
  {
    tb_add[20].bbyte &= 0xf0;
    tb_add[20].bbyte |= 0x01;
    tb_add[18].bbyte = 0;

    break;
  }
  case 2:
  {
    tb_add[20].bbyte &= 0xf0;
    tb_add[20].bbyte |= 0x03;
    tb_add[18].bbyte = 0;

    break;
  }
  case 3:
  {
    tb_add[20].bbyte &= 0xf0;
    tb_add[20].bbyte |= 0x07;
    tb_add[18].bbyte = 0;

    break;
  }
  case 4:
  {

    tb_add[20].bbyte |= 0x0f;
    tb_add[18].bbyte = 0;

    break;
  }
  case 5:
  {

    tb_add[20].bbyte |= 0x0f;
    tb_add[18].bbyte = 0x80;

    break;
  }
  case 6:
  {

    tb_add[20].bbyte |= 0x0f;
    tb_add[18].bbyte = 0xc0;

    break;
  }
  case 7:
  {

    tb_add[20].bbyte |= 0x0f;
    tb_add[18].bbyte = 0xe0;
    break;
  }
  case 8:
  {

    tb_add[20].bbyte |= 0x0f;
    tb_add[18].bbyte = 0xf0;
    break;
  }
  case 9:
  {

    tb_add[20].bbyte |= 0x0f;
    tb_add[18].bbyte = 0xf1;

    break;
  }
  case 10:
  {

    tb_add[20].bbyte |= 0x0f;
    tb_add[18].bbyte = 0xf3;

    break;
  }
  case 11:
  {

    tb_add[20].bbyte |= 0x0f;
    tb_add[18].bbyte = 0xf7;

    break;
  }
  case 12:
  {
    tb_add[20].bbyte &= 0xf0;
    tb_add[20].bbyte |= 0x0f;
    tb_add[18].bbyte = 0xff;

    break;
  }
  default:
    tb_add[20].bbyte &= 0xf0;
    tb_add[18].bbyte = 0x00;
  }
}
#pragma CODE_SEG OTHER_ROM
/*-------------------------------------------------------------------------
* Function Name  : Gui_time_Disp
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void Gui_time_Disp(void)
{

  //(左1)
  if (G_Button.SET_TIME == 0)
  {
    Show_num(11, (Clock.Hours) / 10);
  }
  else
  {
    if (G_Button.JUMP == 0)
    {
      if (Clock.HalfSeconds < 5)
      {
        Show_num(11, (Clock.Hours) / 10);
      }
      else
      {
        Show_num(11, 10);
      }
    }
    else
    {
      Show_num(11, (Clock.Hours) / 10);
    }
  }

  //
  if (G_Button.SET_TIME == 0)
  {
    Show_num(12, (Clock.Hours) % 10);
    if (Clock.HalfSeconds < 5)
    {
      tb_add[1].bbyte |= 0x10; //冒号sp
    }
    else
    {
      tb_add[1].bbyte &= ~0x10;
    }
  }
  else
  {
    if (G_Button.JUMP == 0)
    {
      if (Clock.HalfSeconds < 5)
      {
        Show_num(12, (Clock.Hours) % 10);
        tb_add[1].bbyte |= 0x10; //冒号sp
      }
      else
      {
        Show_num(12, 10);
        tb_add[1].bbyte |= 0x10; //冒号sp
      }
    }
    else
    {
      Show_num(12, (Clock.Hours) % 10);
      tb_add[1].bbyte |= 0x10; //冒号sp
    }
  }

  //
  if (G_Button.SET_TIME == 0)
  {
    Show_num(13, (Clock.Minutes) / 10);
  }
  else
  {
    if (G_Button.JUMP == 1)
    {
      if (Clock.HalfSeconds < 5)
      {
        Show_num(13, (Clock.Minutes) / 10);
      }
      else
      {
        Show_num(13, 10);
      }
    }
    else
    {
      Show_num(13, (Clock.Minutes) / 10);
    }
  }

  //(右1)
  if (G_Button.SET_TIME == 0)
  {
    Show_num(14, (Clock.Minutes) % 10);
  }
  else
  {
    if (G_Button.JUMP == 1)
    {
      if (Clock.HalfSeconds < 5)
      {
        Show_num(14, (Clock.Minutes) % 10);
      }
      else
      {
        Show_num(14, 10);
      }
    }
    else
    {
      Show_num(14, (Clock.Minutes) % 10);
    }
  }
}

void T_BOX_Disp(void)
{
  if (T_BOX_Status == 1)
  {
    T_BOX_Show_num(3, 1);
    T_BOX_Show_num(2, 0);
    T_BOX_Show_num(1, 2);
    Show_num(1, 10);
    Show_num(2, 10);
    Show_num(3, 10);
  }
  else if (T_BOX_Status == 2)
  {
    T_BOX_Show_num(3, 1);
    T_BOX_Show_num(2, 0);
    T_BOX_Show_num(1, 3);
    Show_num(1, 10);
    Show_num(2, 10);
    Show_num(3, 10);
  }
  else
  {
    Gui_Tirp_Disp();
  }
}

/*-------------------------------------------------------------------------
* Function Name  : Gui_Tirp_Disp                              glz--20180322
* Description    :                                            小计显示--ok
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void Gui_Tirp_Disp(void)
{
  //右1
  Show_num(6, ((AccKm.ShortAccKm) % 10));
  //
  Show_num(5, ((AccKm.ShortAccKm) / 10) % 10);
  //
  if (AccKm.ShortAccKm < 100)
  {
    //清零
    Show_num(4, 10);
  }
  else
  {
    Show_num(4, ((AccKm.ShortAccKm) / 100) % 10);
  }
  //
  if (AccKm.ShortAccKm < 1000)
  {
    //清零
    Show_num(3, 10);
  }
  else
  {
    Show_num(3, (AccKm.ShortAccKm) / 1000);
  }
  /////////
  //清零
  Show_num(1, 10);
  //清零
  Show_num(2, 10);
}
/*-------------------------------------------------------------------------
* Function Name  : Gui_ODO_Disp                               glz--20180322
* Description    :                                            ??????--ok
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void Gui_ODO_Disp(void)
{
  //右1
  Show_num(6, ((AccKm.LongAccKm / 10) % 10));
  //
  if (AccKm.LongAccKm < 100)
  {
    //清零
    Show_num(5, 10);
  }
  else
  {
    Show_num(5, ((AccKm.LongAccKm / 10) / 10) % 10);
  }
  //
  if (AccKm.LongAccKm < 1000)
  {
    //清零
    Show_num(4, 10);
  }
  else
  {
    Show_num(4, ((AccKm.LongAccKm / 10) / 100) % 10);
  }
  //
  if (AccKm.LongAccKm < 10000)
  {
    //清零
    Show_num(3, 10);
  }
  else
  {
    Show_num(3, ((AccKm.LongAccKm / 10) / 1000) % 10);
  }
  //
  if (AccKm.LongAccKm < 100000)
  {
    //清零
    Show_num(2, 10);
  }
  else
  {
    Show_num(2, ((AccKm.LongAccKm / 10) / 10000) % 10);
  }
  // (左1)
  if (AccKm.LongAccKm < 1000000)
  {
    //清零
    Show_num(1, 10);
  }
  else
  {
    Show_num(1, ((AccKm.LongAccKm / 10) / 100000));
  }
}
/*-------------------------------------------------------------------------
* Function Name  : Gui_SetRadio
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void Gui_SetRadio(void)
{
  if (SetRadioWei == 0)
  {
    //右1
    if (SetRadioTime > 5)
    {
      SetRadioTime = 0;

      if (SetRadioTimeFlag == 0)
      {
        SetRadioTimeFlag = 1;
      }
      else if (SetRadioTimeFlag == 1)
      {
        SetRadioTimeFlag = 0;
      }
    }
    if (SetRadioTimeFlag == 1)
    {
      Show_num(6, 10);
    }
    else
    {
      Show_num(6, Radio.VehRadio % 10);
    }
    //
    Show_num(5, (Radio.VehRadio / 10) % 10);
    Show_num(4, (Radio.VehRadio / 100) % 10);
    Show_num(3, (Radio.VehRadio / 1000) % 10);
  }
  else if (SetRadioWei == 1)
  {
    Show_num(6, Radio.VehRadio % 10);
    //
    if (SetRadioTime > 5)
    {
      SetRadioTime = 0;

      if (SetRadioTimeFlag == 0)
      {
        SetRadioTimeFlag = 1;
      }
      else if (SetRadioTimeFlag == 1)
      {
        SetRadioTimeFlag = 0;
      }
    }
    if (SetRadioTimeFlag == 1)
    {
      Show_num(5, 10);
    }
    else
    {
      Show_num(5, (Radio.VehRadio / 10) % 10);
    }

    //第4个数码管
    Show_num(4, (Radio.VehRadio / 100) % 10);
    Show_num(3, (Radio.VehRadio / 1000) % 10);
  }
  else if (SetRadioWei == 2)
  {
    //第6个数码管
    Show_num(6, Radio.VehRadio % 10);

    //第5个数码管
    Show_num(5, (Radio.VehRadio / 10) % 10);

    //第4个数码管
    if (SetRadioTime > 5)
    {
      SetRadioTime = 0;

      if (SetRadioTimeFlag == 0)
      {
        SetRadioTimeFlag = 1;
      }
      else if (SetRadioTimeFlag == 1)
      {
        SetRadioTimeFlag = 0;
      }
    }

    if (SetRadioTimeFlag == 1)
    {
      Show_num(4, 10);
    }
    else
    {
      Show_num(4, (Radio.VehRadio / 100) % 10);
    }
    //??3???????
    Show_num(3, (Radio.VehRadio / 1000) % 10);
  }
  else if (SetRadioWei == 3)
  {
    //??6???????
    Show_num(6, Radio.VehRadio % 10);

    //??5???????
    Show_num(5, (Radio.VehRadio / 10) % 10);

    //??4???????
    Show_num(4, (Radio.VehRadio / 100) % 10);
    //
    if (SetRadioTime > 5)
    {
      SetRadioTime = 0;

      if (SetRadioTimeFlag == 0)
      {
        SetRadioTimeFlag = 1;
      }
      else if (SetRadioTimeFlag == 1)
      {
        SetRadioTimeFlag = 0;
      }
    }

    if (SetRadioTimeFlag == 1)
    {
      Show_num(3, 10);
    }
    else
    {
      Show_num(3, (Radio.VehRadio / 1000) % 10);
    }
  }
  ////////////////////////////////////////////////////////////////////////

  //??2???????
  Show_num(2, 10);

  //??1???????
  Show_num(1, 10);
}
/*-------------------------------------------------------------------------
* Function Name  : Gui_InstFuel_Disp
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void Gui_InstFuel_Disp(void)
{
}
/*-------------------------------------------------------------------------
* Function Name  : Gui_AvgFuel_Disp
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void Gui_AvgFuel_Disp(void)
{
}
/*-------------------------------------------------------------------------
* Function Name  : Gui_Icon
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void Gui_Icon(void)
{
  if ((QY1Meter.CurBoardVal < 63) && (QY2Meter.CurBoardVal < 63))
  {
    tb_add[11].bbyte &= ~0x80; // kk
    //
    QY1_Section = 0;
    InitQYFlag1 = 1;
    QY1Meter.CurPosition = 0;
    QY1Meter.DestPosition = 0;
    QY1_Section = 0;

    QY2_Section = 0;
    QY2Meter.CurPosition = 0;
    QY2Meter.DestPosition = 0;
    QY2_Section = 0;
  }
  else
  {
    tb_add[11].bbyte |= 0x80; // kk
  }
  //
  tb_add[11].bbyte |= 0x40; // clk
  //
  if (G_Button.SubMenu0 == 0)
  {
    if ((T_BOX_Status == 1)||(T_BOX_Status == 2))
    {
      tb_add[17].bbyte |= 0x01; // trip
      tb_add[6].bbyte &= ~0x08;  // km2
      tb_add[7].bbyte &= ~0x08;  // dp3
      tb_add[16].bbyte &= ~0x08;
    }
    else
    {
      tb_add[17].bbyte |= 0x01; // trip
      tb_add[6].bbyte |= 0x08;  // km2
      tb_add[7].bbyte |= 0x08;  // dp3
      tb_add[16].bbyte &= ~0x08;
    }
  }
  else if (G_Button.SubMenu0 == 1)
  {
    tb_add[16].bbyte |= 0x08; // ODO
    tb_add[6].bbyte |= 0x08;  // km2
    tb_add[17].bbyte &= ~0x01;
    tb_add[7].bbyte &= ~0x08;
  }
  //
  if ((CanClk.Signal.ExistFE563D == Enable) || (CanClk.Signal.ExistFE5600 == Enable))
  {
    tb_add[18].bbyte |= 0x80; // FUK
    tb_add[18].bbyte |= 0x40; // FUH
    tb_add[18].bbyte |= 0x20; // ADD
    tb_add[18].bbyte |= 0x10; // EF
  }
}
/*-------------------------------------------------------------------------
* Function Name  : Show_TLY
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void Show_TLY(byte num)
{
  //设定过了初次上电之后走的速度
  if (VehMeter.CurBoardVal == null)
  {
    if (AdbuleMeter.DestPosition > AdbuleMeter.CurPosition)
    {
      AdbuleMeter.DelayTime = T_700ms;
    }
    else
    {
      AdbuleMeter.DelayTime = T_700ms;
    }
  }
  else
  {
    AdbuleMeter.DelayTime = T_700ms;
  }
  //初次上电 或 超过延时时间
  if ((AdbuleMeter.Time >= AdbuleMeter.DelayTime) || (InitAdblueFlag == 1))
  {
    //初次上电
    if (InitAdblueFlag == 1)
    {
      if (AdblueInitTime >= AdblueInitDealyTime)
      {
        AdblueInitTime = null;
        if (AdbuleMeter.CurPosition < AdbuleMeter.DestPosition)
        {
          AdbuleMeter.CurPosition++;
        }
      }
    }
    //超过延时时间
    else
    {
      AdbuleMeter.Time = null;

      if (VehMeter.CurBoardVal == null)
      {
        if (AdbuleMeter.CurPosition < AdbuleMeter.DestPosition)
        {
          AdbuleMeter.CurPosition++;
        }
      }
      else
      {
        if ((AdbuleMeter.CurPosition < AdbuleMeter.DestPosition))
        {
          AdbuleMeter.CurPosition++;
        }
      }
      if (AdbuleMeter.CurPosition > AdbuleMeter.DestPosition)
      {
        AdbuleMeter.CurPosition--;
      }
    }
  }
  //////////////   显示 /////////////////////////////////////////////////////////
  // if(g_fuelMeter.CurPosition)
  {

    if (AdbuleMeter.CurPosition <= 15) // 0
    {
      Adbule_Section = 0;
    }
    else if ((AdbuleMeter.CurPosition >= 20) && (AdbuleMeter.CurPosition <= 35)) // 1
    {
      Adbule_Section = 1;
    }
    else if ((AdbuleMeter.CurPosition >= 40) && (AdbuleMeter.CurPosition <= 55)) // 2
    {
      Adbule_Section = 2;
    }
    else if ((AdbuleMeter.CurPosition >= 60) && (AdbuleMeter.CurPosition <= 75)) // 3
    {
      Adbule_Section = 3;
    }
    else if ((AdbuleMeter.CurPosition >= 80) && (AdbuleMeter.CurPosition <= 95)) // 4
    {
      Adbule_Section = 4;
    }
    else if ((AdbuleMeter.CurPosition >= 100) && (AdbuleMeter.CurPosition <= 115)) // 5
    {
      Adbule_Section = 5;
    }
    else if ((AdbuleMeter.CurPosition >= 120) && (AdbuleMeter.CurPosition <= 135)) // 6
    {
      Adbule_Section = 6;
    }
    else if ((AdbuleMeter.CurPosition >= 140) && (AdbuleMeter.CurPosition <= 155)) // 7
    {
      Adbule_Section = 7;
    }
    else if (AdbuleMeter.CurPosition >= 160) // 8
    {
      Adbule_Section = 8;
    }
  }
  //显示
  if (Adbule_Section == 0) // 0
  {
    tb_add[18].bbyte &= ~0x01;
    tb_add[18].bbyte &= ~0x02;
    tb_add[18].bbyte &= ~0x04;
    tb_add[18].bbyte &= ~0x08;
    tb_add[17].bbyte &= ~0x10;
    tb_add[17].bbyte &= ~0x20;
    tb_add[17].bbyte &= ~0x40;
    tb_add[17].bbyte &= ~0x80;
  }
  else if (Adbule_Section == 1) // 1
  {
    tb_add[18].bbyte |= 0x01;
    tb_add[18].bbyte &= ~0x02;
    tb_add[18].bbyte &= ~0x04;
    tb_add[18].bbyte &= ~0x08;
    tb_add[17].bbyte &= ~0x10;
    tb_add[17].bbyte &= ~0x20;
    tb_add[17].bbyte &= ~0x40;
    tb_add[17].bbyte &= ~0x80;
  }
  else if (Adbule_Section == 2) // 2
  {
    tb_add[18].bbyte |= 0x01;
    tb_add[18].bbyte |= 0x02;
    tb_add[18].bbyte &= ~0x04;
    tb_add[18].bbyte &= ~0x08;
    tb_add[17].bbyte &= ~0x10;
    tb_add[17].bbyte &= ~0x20;
    tb_add[17].bbyte &= ~0x40;
    tb_add[17].bbyte &= ~0x80;
  }
  else if (Adbule_Section == 3) // 3
  {
    tb_add[18].bbyte |= 0x01;
    tb_add[18].bbyte |= 0x02;
    tb_add[18].bbyte |= 0x04;
    tb_add[18].bbyte &= ~0x08;
    tb_add[17].bbyte &= ~0x10;
    tb_add[17].bbyte &= ~0x20;
    tb_add[17].bbyte &= ~0x40;
    tb_add[17].bbyte &= ~0x80;
  }
  else if (Adbule_Section == 4) // 4
  {
    tb_add[18].bbyte |= 0x01;
    tb_add[18].bbyte |= 0x02;
    tb_add[18].bbyte |= 0x04;
    tb_add[18].bbyte |= 0x08;
    tb_add[17].bbyte &= ~0x10;
    tb_add[17].bbyte &= ~0x20;
    tb_add[17].bbyte &= ~0x40;
    tb_add[17].bbyte &= ~0x80;
  }
  else if (Adbule_Section == 5) // 5
  {
    tb_add[18].bbyte |= 0x01;
    tb_add[18].bbyte |= 0x02;
    tb_add[18].bbyte |= 0x04;
    tb_add[18].bbyte |= 0x08;
    tb_add[17].bbyte |= 0x10;
    tb_add[17].bbyte &= ~0x20;
    tb_add[17].bbyte &= ~0x40;
    tb_add[17].bbyte &= ~0x80;
  }
  else if (Adbule_Section == 6) // 6
  {
    tb_add[18].bbyte |= 0x01;
    tb_add[18].bbyte |= 0x02;
    tb_add[18].bbyte |= 0x04;
    tb_add[18].bbyte |= 0x08;
    tb_add[17].bbyte |= 0x10;
    tb_add[17].bbyte |= 0x20;
    tb_add[17].bbyte &= ~0x40;
    tb_add[17].bbyte &= ~0x80;
  }
  else if (Adbule_Section == 7) // 7
  {
    tb_add[18].bbyte |= 0x01;
    tb_add[18].bbyte |= 0x02;
    tb_add[18].bbyte |= 0x04;
    tb_add[18].bbyte |= 0x08;
    tb_add[17].bbyte |= 0x10;
    tb_add[17].bbyte |= 0x20;
    tb_add[17].bbyte |= 0x40;
    tb_add[17].bbyte &= ~0x80;
  }
  else if (Adbule_Section == 8) // 8
  {
    tb_add[18].bbyte |= 0x01;
    tb_add[18].bbyte |= 0x02;
    tb_add[18].bbyte |= 0x04;
    tb_add[18].bbyte |= 0x08;
    tb_add[17].bbyte |= 0x10;
    tb_add[17].bbyte |= 0x20;
    tb_add[17].bbyte |= 0x40;
    tb_add[17].bbyte |= 0x80;
  }

  // 3秒之后  且  走到位之后
  if (InitAdblueTime >= T_5s)
  {
    if (AdbuleMeter.CurPosition >= AdbuleMeter.DestPosition)
    {
      InitAdblueFlag = Disable; //认为初次上电完成
    }
  }
}
/*-------------------------------------------------------------------------
?????????QY1_Disp
??    ???
??    ????None
?????????None
????????
--------------------------------------------------------------------------*/
void QY1_Disp(void)
{
  //设定过了初次上电之后走的速度
  if (VehMeter.CurBoardVal == null)
  {
    if (QY1Meter.DestPosition > QY1Meter.CurPosition)
    {
      QY1Meter.DelayTime = T_100ms;
    }
    else
    {
      QY1Meter.DelayTime = T_100ms;
    }
  }
  else
  {
    QY1Meter.DelayTime = T_100ms;
  }

  //初次上电 或 超过延时时间
  if ((QY1Meter.Time >= QY1Meter.DelayTime) || (InitQYFlag1 == 1))
  {
    //初次上电
    if (InitQYFlag1 == 1)
    {
      if (QY1InitTime >= QY1InitDealyTime)
      {
        QY1InitTime = null;
        if (QY1Meter.CurPosition < QY1Meter.DestPosition)
        {
          QY1Meter.CurPosition++;
        }
      }
    }
    //超过延时时间
    else
    {
      QY1Meter.Time = null;
      if (VehMeter.CurBoardVal == null)
      {
        if (QY1Meter.CurPosition < QY1Meter.DestPosition)
        {
          QY1Meter.CurPosition++;
        }
      }
      else
      {
        if ((QY1Meter.CurPosition < QY1Meter.DestPosition))
        {
          QY1Meter.CurPosition++;
        }
      }
      //--------------------------------------------------
      if (QY1Meter.CurPosition > QY1Meter.DestPosition)
      {
        QY1Meter.CurPosition--;
      }
    }
  }
  //	QY1Meter.CurPosition++;	   //lzs--jia
  //////////////   显示 /////////////////////////////////////////////////////////
  // if(g_fuelMeter.CurPosition)
  {
    if (QY1Meter.CurPosition <= 15) // 0
    {
      QY1_Section = 0;
    }
    else if ((QY1Meter.CurPosition >= 20) && (QY1Meter.CurPosition <= 35)) // 1
    {
      QY1_Section = 1;
    }
    else if ((QY1Meter.CurPosition >= 40) && (QY1Meter.CurPosition <= 55)) // 2
    {
      QY1_Section = 2;
    }
    else if ((QY1Meter.CurPosition >= 60) && (QY1Meter.CurPosition <= 75)) // 3
    {
      QY1_Section = 3;
    }
    else if ((QY1Meter.CurPosition >= 80) && (QY1Meter.CurPosition <= 95)) // 4
    {
      QY1_Section = 4;
    }
    else if ((QY1Meter.CurPosition >= 100) && (QY1Meter.CurPosition <= 115)) // 5
    {
      QY1_Section = 5;
    }
    else if ((QY1Meter.CurPosition >= 120) && (QY1Meter.CurPosition <= 135)) // 6
    {
      QY1_Section = 6;
    }
    else if ((QY1Meter.CurPosition >= 140) && (QY1Meter.CurPosition <= 155)) // 7
    {
      QY1_Section = 7;
    }
    else if ((QY1Meter.CurPosition >= 160) && (QY1Meter.CurPosition <= 175)) // 8
    {
      QY1_Section = 8;
    }
    else if ((QY1Meter.CurPosition >= 180) && (QY1Meter.CurPosition <= 195)) // 9
    {
      QY1_Section = 9;
    }
    else if ((QY1Meter.CurPosition >= 200) && (QY1Meter.CurPosition <= 215)) // 10
    {
      QY1_Section = 10;
    }
    else if ((QY1Meter.CurPosition >= 220) && (QY1Meter.CurPosition <= 235)) // 11
    {
      QY1_Section = 11;
    }
    else if (QY1Meter.CurPosition >= 240) // 12
    {
      QY1_Section = 12;
    }
  }

  //显示
  if (QY1_Section == 0) // 0
  {
    tb_add[11].bbyte &= ~0x01;
    tb_add[11].bbyte &= ~0x02;
    tb_add[11].bbyte &= ~0x04;
    tb_add[11].bbyte &= ~0x08;
    tb_add[9].bbyte &= ~0x80;
    tb_add[9].bbyte &= ~0x40;
    tb_add[9].bbyte &= ~0x20;
    tb_add[9].bbyte &= ~0x10;
    tb_add[9].bbyte &= ~0x01;
    tb_add[9].bbyte &= ~0x02;
    tb_add[9].bbyte &= ~0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 1) // 1
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte &= ~0x02;
    tb_add[11].bbyte &= ~0x04;
    tb_add[11].bbyte &= ~0x08;
    tb_add[9].bbyte &= ~0x80;
    tb_add[9].bbyte &= ~0x40;
    tb_add[9].bbyte &= ~0x20;
    tb_add[9].bbyte &= ~0x10;
    tb_add[9].bbyte &= ~0x01;
    tb_add[9].bbyte &= ~0x02;
    tb_add[9].bbyte &= ~0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 2) // 2
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte |= 0x02;
    tb_add[11].bbyte &= ~0x04;
    tb_add[11].bbyte &= ~0x08;
    tb_add[9].bbyte &= ~0x80;
    tb_add[9].bbyte &= ~0x40;
    tb_add[9].bbyte &= ~0x20;
    tb_add[9].bbyte &= ~0x10;
    tb_add[9].bbyte &= ~0x01;
    tb_add[9].bbyte &= ~0x02;
    tb_add[9].bbyte &= ~0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 3) // 3
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte |= 0x02;
    tb_add[11].bbyte |= 0x04;
    tb_add[11].bbyte &= ~0x08;
    tb_add[9].bbyte &= ~0x80;
    tb_add[9].bbyte &= ~0x40;
    tb_add[9].bbyte &= ~0x20;
    tb_add[9].bbyte &= ~0x10;
    tb_add[9].bbyte &= ~0x01;
    tb_add[9].bbyte &= ~0x02;
    tb_add[9].bbyte &= ~0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 4) // 4
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte |= 0x02;
    tb_add[11].bbyte |= 0x04;
    tb_add[11].bbyte |= 0x08;
    tb_add[9].bbyte &= ~0x80;
    tb_add[9].bbyte &= ~0x40;
    tb_add[9].bbyte &= ~0x20;
    tb_add[9].bbyte &= ~0x10;
    tb_add[9].bbyte &= ~0x01;
    tb_add[9].bbyte &= ~0x02;
    tb_add[9].bbyte &= ~0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 5) // 5
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte |= 0x02;
    tb_add[11].bbyte |= 0x04;
    tb_add[11].bbyte |= 0x08;
    tb_add[9].bbyte |= 0x80;
    tb_add[9].bbyte &= ~0x40;
    tb_add[9].bbyte &= ~0x20;
    tb_add[9].bbyte &= ~0x10;
    tb_add[9].bbyte &= ~0x01;
    tb_add[9].bbyte &= ~0x02;
    tb_add[9].bbyte &= ~0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 6) // 6
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte |= 0x02;
    tb_add[11].bbyte |= 0x04;
    tb_add[11].bbyte |= 0x08;
    tb_add[9].bbyte |= 0x80;
    tb_add[9].bbyte |= 0x40;
    tb_add[9].bbyte &= ~0x20;
    tb_add[9].bbyte &= ~0x10;
    tb_add[9].bbyte &= ~0x01;
    tb_add[9].bbyte &= ~0x02;
    tb_add[9].bbyte &= ~0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 7) // 7
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte |= 0x02;
    tb_add[11].bbyte |= 0x04;
    tb_add[11].bbyte |= 0x08;
    tb_add[9].bbyte |= 0x80;
    tb_add[9].bbyte |= 0x40;
    tb_add[9].bbyte |= 0x20;
    tb_add[9].bbyte &= ~0x10;
    tb_add[9].bbyte &= ~0x01;
    tb_add[9].bbyte &= ~0x02;
    tb_add[9].bbyte &= ~0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 8) // 8
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte |= 0x02;
    tb_add[11].bbyte |= 0x04;
    tb_add[11].bbyte |= 0x08;
    tb_add[9].bbyte |= 0x80;
    tb_add[9].bbyte |= 0x40;
    tb_add[9].bbyte |= 0x20;
    tb_add[9].bbyte |= 0x10;
    tb_add[9].bbyte &= ~0x01;
    tb_add[9].bbyte &= ~0x02;
    tb_add[9].bbyte &= ~0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 9) // 9
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte |= 0x02;
    tb_add[11].bbyte |= 0x04;
    tb_add[11].bbyte |= 0x08;
    tb_add[9].bbyte |= 0x80;
    tb_add[9].bbyte |= 0x40;
    tb_add[9].bbyte |= 0x20;
    tb_add[9].bbyte |= 0x10;
    tb_add[9].bbyte |= 0x01;
    tb_add[9].bbyte &= ~0x02;
    tb_add[9].bbyte &= ~0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 10) // 10
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte |= 0x02;
    tb_add[11].bbyte |= 0x04;
    tb_add[11].bbyte |= 0x08;
    tb_add[9].bbyte |= 0x80;
    tb_add[9].bbyte |= 0x40;
    tb_add[9].bbyte |= 0x20;
    tb_add[9].bbyte |= 0x10;
    tb_add[9].bbyte |= 0x01;
    tb_add[9].bbyte |= 0x02;
    tb_add[9].bbyte &= ~0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 11) // 11
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte |= 0x02;
    tb_add[11].bbyte |= 0x04;
    tb_add[11].bbyte |= 0x08;
    tb_add[9].bbyte |= 0x80;
    tb_add[9].bbyte |= 0x40;
    tb_add[9].bbyte |= 0x20;
    tb_add[9].bbyte |= 0x10;
    tb_add[9].bbyte |= 0x01;
    tb_add[9].bbyte |= 0x02;
    tb_add[9].bbyte |= 0x04;
    tb_add[9].bbyte &= ~0x08;
  }
  else if (QY1_Section == 12) // 12
  {
    tb_add[11].bbyte |= 0x01;
    tb_add[11].bbyte |= 0x02;
    tb_add[11].bbyte |= 0x04;
    tb_add[11].bbyte |= 0x08;
    tb_add[9].bbyte |= 0x80;
    tb_add[9].bbyte |= 0x40;
    tb_add[9].bbyte |= 0x20;
    tb_add[9].bbyte |= 0x10;
    tb_add[9].bbyte |= 0x01;
    tb_add[9].bbyte |= 0x02;
    tb_add[9].bbyte |= 0x04;
    tb_add[9].bbyte |= 0x08;
  }

  // 3秒之后  且  走到位之后
  if (InitQy1Time >= T_3s)
  {
    if (QY1Meter.CurPosition >= QY1Meter.DestPosition)
    {
      InitQYFlag1 = Disable; //认为初次上电完成
    }
  }
}
/*-------------------------------------------------------------------------
?????????QY2_Disp                                  glz--20170704
??    ???
??    ????None
?????????None
????????
--------------------------------------------------------------------------*/
void QY2_Disp(void)
{
  //设定过了初次上电之后走的速度
  if (VehMeter.CurBoardVal == null)
  {
    if (QY2Meter.DestPosition > QY2Meter.CurPosition)
    {
      QY2Meter.DelayTime = T_100ms;
    }
    else
    {
      QY2Meter.DelayTime = T_100ms;
    }
  }
  else
  {
    QY2Meter.DelayTime = T_100ms;
  }

  //初次上电 或 超过延时时间
  if ((QY2Meter.Time >= QY2Meter.DelayTime) || (InitQYFlag2 == 1))
  {
    //初次上电
    if (InitQYFlag2 == 1)
    {
      if (QY2InitTime >= QY2InitDealyTime)
      {
        QY2InitTime = null;
        if (QY2Meter.CurPosition < QY2Meter.DestPosition)
        {
          QY2Meter.CurPosition++;
        }
      }
    }
    //超过延时时间
    else
    {
      QY2Meter.Time = null;

      if (VehMeter.CurBoardVal == null)
      {
        if (QY2Meter.CurPosition < QY2Meter.DestPosition)
        {
          QY2Meter.CurPosition++;
        }
      }
      else
      {
        if ((QY2Meter.CurPosition < QY2Meter.DestPosition))
        {
          QY2Meter.CurPosition++;
        }
      }
      if (QY2Meter.CurPosition > QY2Meter.DestPosition)
      {
        QY2Meter.CurPosition--;
      }
    }
  }
  //////////////   显示 /////////////////////////////////////////////////////////
  // if(g_fuelMeter.CurPosition)
  {
    if (QY2Meter.CurPosition <= 15) // 0
    {
      QY2_Section = 0;
    }
    else if ((QY2Meter.CurPosition >= 20) && (QY2Meter.CurPosition <= 35)) // 1
    {
      QY2_Section = 1;
    }
    else if ((QY2Meter.CurPosition >= 40) && (QY2Meter.CurPosition <= 55)) // 2
    {
      QY2_Section = 2;
    }
    else if ((QY2Meter.CurPosition >= 60) && (QY2Meter.CurPosition <= 75)) // 3
    {
      QY2_Section = 3;
    }
    else if ((QY2Meter.CurPosition >= 80) && (QY2Meter.CurPosition <= 95)) // 4
    {
      QY2_Section = 4;
    }
    else if ((QY2Meter.CurPosition >= 100) && (QY2Meter.CurPosition <= 115)) // 5
    {
      QY2_Section = 5;
    }
    else if ((QY2Meter.CurPosition >= 120) && (QY2Meter.CurPosition <= 135)) // 6
    {
      QY2_Section = 6;
    }
    else if ((QY2Meter.CurPosition >= 140) && (QY2Meter.CurPosition <= 155)) // 7
    {
      QY2_Section = 7;
    }
    else if ((QY2Meter.CurPosition >= 160) && (QY2Meter.CurPosition <= 175)) // 8
    {
      QY2_Section = 8;
    }
    else if ((QY2Meter.CurPosition >= 180) && (QY2Meter.CurPosition <= 195)) // 9
    {
      QY2_Section = 9;
    }
    else if ((QY2Meter.CurPosition >= 200) && (QY2Meter.CurPosition <= 215)) // 10
    {
      QY2_Section = 10;
    }
    else if ((QY2Meter.CurPosition >= 220) && (QY2Meter.CurPosition <= 235)) // 11
    {
      QY2_Section = 11;
    }
    else if (QY2Meter.CurPosition >= 240) // 12
    {
      QY2_Section = 12;
    }
  }
  //显示
  if (QY2_Section == 0) // 0
  {
    tb_add[10].bbyte &= ~0x10;
    tb_add[10].bbyte &= ~0x20;
    tb_add[10].bbyte &= ~0x40;
    tb_add[10].bbyte &= ~0x80;
    tb_add[10].bbyte &= ~0x08;
    tb_add[10].bbyte &= ~0x04;
    tb_add[10].bbyte &= ~0x02;
    tb_add[10].bbyte &= ~0x01;
    tb_add[8].bbyte &= ~0x10;
    tb_add[8].bbyte &= ~0x20;
    tb_add[8].bbyte &= ~0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 1) // 1
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte &= ~0x20;
    tb_add[10].bbyte &= ~0x40;
    tb_add[10].bbyte &= ~0x80;
    tb_add[10].bbyte &= ~0x08;
    tb_add[10].bbyte &= ~0x04;
    tb_add[10].bbyte &= ~0x02;
    tb_add[10].bbyte &= ~0x01;
    tb_add[8].bbyte &= ~0x10;
    tb_add[8].bbyte &= ~0x20;
    tb_add[8].bbyte &= ~0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 2) // 2
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte |= 0x20;
    tb_add[10].bbyte &= ~0x40;
    tb_add[10].bbyte &= ~0x80;
    tb_add[10].bbyte &= ~0x08;
    tb_add[10].bbyte &= ~0x04;
    tb_add[10].bbyte &= ~0x02;
    tb_add[10].bbyte &= ~0x01;
    tb_add[8].bbyte &= ~0x10;
    tb_add[8].bbyte &= ~0x20;
    tb_add[8].bbyte &= ~0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 3) // 3
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte |= 0x20;
    tb_add[10].bbyte |= 0x40;
    tb_add[10].bbyte &= ~0x80;
    tb_add[10].bbyte &= ~0x08;
    tb_add[10].bbyte &= ~0x04;
    tb_add[10].bbyte &= ~0x02;
    tb_add[10].bbyte &= ~0x01;
    tb_add[8].bbyte &= ~0x10;
    tb_add[8].bbyte &= ~0x20;
    tb_add[8].bbyte &= ~0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 4) // 4
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte |= 0x20;
    tb_add[10].bbyte |= 0x40;
    tb_add[10].bbyte |= 0x80;
    tb_add[10].bbyte &= ~0x08;
    tb_add[10].bbyte &= ~0x04;
    tb_add[10].bbyte &= ~0x02;
    tb_add[10].bbyte &= ~0x01;
    tb_add[8].bbyte &= ~0x10;
    tb_add[8].bbyte &= ~0x20;
    tb_add[8].bbyte &= ~0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 5) // 5
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte |= 0x20;
    tb_add[10].bbyte |= 0x40;
    tb_add[10].bbyte |= 0x80;
    tb_add[10].bbyte |= 0x08;
    tb_add[10].bbyte &= ~0x04;
    tb_add[10].bbyte &= ~0x02;
    tb_add[10].bbyte &= ~0x01;
    tb_add[8].bbyte &= ~0x10;
    tb_add[8].bbyte &= ~0x20;
    tb_add[8].bbyte &= ~0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 6) // 6
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte |= 0x20;
    tb_add[10].bbyte |= 0x40;
    tb_add[10].bbyte |= 0x80;
    tb_add[10].bbyte |= 0x08;
    tb_add[10].bbyte |= 0x04;
    tb_add[10].bbyte &= ~0x02;
    tb_add[10].bbyte &= ~0x01;
    tb_add[8].bbyte &= ~0x10;
    tb_add[8].bbyte &= ~0x20;
    tb_add[8].bbyte &= ~0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 7) // 7
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte |= 0x20;
    tb_add[10].bbyte |= 0x40;
    tb_add[10].bbyte |= 0x80;
    tb_add[10].bbyte |= 0x08;
    tb_add[10].bbyte |= 0x04;
    tb_add[10].bbyte |= 0x02;
    tb_add[10].bbyte &= ~0x01;
    tb_add[8].bbyte &= ~0x10;
    tb_add[8].bbyte &= ~0x20;
    tb_add[8].bbyte &= ~0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 8) // 8
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte |= 0x20;
    tb_add[10].bbyte |= 0x40;
    tb_add[10].bbyte |= 0x80;
    tb_add[10].bbyte |= 0x08;
    tb_add[10].bbyte |= 0x04;
    tb_add[10].bbyte |= 0x02;
    tb_add[10].bbyte |= 0x01;
    tb_add[8].bbyte &= ~0x10;
    tb_add[8].bbyte &= ~0x20;
    tb_add[8].bbyte &= ~0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 9) // 9
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte |= 0x20;
    tb_add[10].bbyte |= 0x40;
    tb_add[10].bbyte |= 0x80;
    tb_add[10].bbyte |= 0x08;
    tb_add[10].bbyte |= 0x04;
    tb_add[10].bbyte |= 0x02;
    tb_add[10].bbyte |= 0x01;
    tb_add[8].bbyte |= 0x10;
    tb_add[8].bbyte &= ~0x20;
    tb_add[8].bbyte &= ~0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 10) // 10
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte |= 0x20;
    tb_add[10].bbyte |= 0x40;
    tb_add[10].bbyte |= 0x80;
    tb_add[10].bbyte |= 0x08;
    tb_add[10].bbyte |= 0x04;
    tb_add[10].bbyte |= 0x02;
    tb_add[10].bbyte |= 0x01;
    tb_add[8].bbyte |= 0x10;
    tb_add[8].bbyte |= 0x20;
    tb_add[8].bbyte &= ~0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 11) // 11
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte |= 0x20;
    tb_add[10].bbyte |= 0x40;
    tb_add[10].bbyte |= 0x80;
    tb_add[10].bbyte |= 0x08;
    tb_add[10].bbyte |= 0x04;
    tb_add[10].bbyte |= 0x02;
    tb_add[10].bbyte |= 0x01;
    tb_add[8].bbyte |= 0x10;
    tb_add[8].bbyte |= 0x20;
    tb_add[8].bbyte |= 0x40;
    tb_add[8].bbyte &= ~0x80;
  }
  else if (QY2_Section == 12) // 12
  {
    tb_add[10].bbyte |= 0x10;
    tb_add[10].bbyte |= 0x20;
    tb_add[10].bbyte |= 0x40;
    tb_add[10].bbyte |= 0x80;
    tb_add[10].bbyte |= 0x08;
    tb_add[10].bbyte |= 0x04;
    tb_add[10].bbyte |= 0x02;
    tb_add[10].bbyte |= 0x01;
    tb_add[8].bbyte |= 0x10;
    tb_add[8].bbyte |= 0x20;
    tb_add[8].bbyte |= 0x40;
    tb_add[8].bbyte |= 0x80;
  }
  // 3秒之后  且  走到位之后
  if (InitQy2Time >= T_3s)
  {
    if (QY2Meter.CurPosition >= QY2Meter.DestPosition)
    {
      InitQYFlag2 = Disable; //认为初次上电完成
    }
  }
}

#pragma CODE_SEG DEFAULT
/*-------------------------------------------------------------------------
* Function Name  : Show_Grp
* Description    :
* Input          : None
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void Show_Grp(const byte *ptr, byte size_long, byte onoff)
{ //?????飬??????????????????
  byte n, x, y;

  for (n = 0; n < size_long; n++)
  {
    x = *ptr >> 3;
    y = *ptr & 0x07;
    if (onoff)
      tb_add[x].bbyte |= 1 << y;
    else
      tb_add[x].bbyte &= ~(1 << y);
    ptr++;
  }
}

void Show_Liner(const byte *ptr, byte size_long, byte num)
{ //?????飬??????????????????
  byte n, x, y, onoff;

  for (n = 0; n < size_long; n++)
  {
    if (n < num)
      onoff = ON;
    else
      onoff = OFF;
    x = *ptr >> 3;
    y = *ptr & 0x07;
    if (onoff)
      tb_add[x].bbyte |= 1 << y;
    else
      tb_add[x].bbyte &= ~(1 << y);
    ptr++;
  }
}

void Show_Elm(byte elm, byte onoff) //??????飬??Σ???????????
{
  byte x, y;
  x = elm >> 3;
  y = elm & 0x07;
  if (onoff)
    tb_add[x].bbyte |= 1 << y;
  else
    tb_add[x].bbyte &= ~(1 << y);
}

void Api_LCD_Clear_Symbol(void)
{
  SEG_TRIP = 0;
  SEG_DP1 = 0;
  SEG_ODO = 0;
}

///////////////////////关于8字段的计算从  2-14用的是数组拆分方法
#pragma MESSAGE DISABLE C4200 //放到提示箭头之前就行
#pragma CONST_SEG DEFAULT     //    //属性//名称    //MFAR_SEG //           N_VOID  N_STANDBY

// 0      1       2       3     4         5       6        7       8     9        10      11
// const byte mod_num[12]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x00,0x40};
const byte base_part[10] = {0x17, 0x77, 0x7B, 0x7F, 0x81, 0x9C, 0xB4, 0xDA, 0xDC, 0xCE};
const byte ful_part[8] = {0x16, 0x15, 0xD8, 0xD9, 0xDB, 0xDF, 0xDE, 0xDD};
const byte tep_part[8] = {0x7A, 0x79, 0x83, 0x82, 0x80, 0x7C, 0x7D, 0x7E};
const byte blk_part[7] = {0xC8, 0xCD, 0xCC, 0xCF, 0x1C, 0xC9, 0xCA};
const byte a_part[8] = {0x38, 0x39, 0x3A, 0x3B, 0x4C, 0x5C, 0x5D, 0x87};
const byte b_part[8] = {0x44, 0x3C, 0x54, 0x5E, 0x5F, 0x9D, 0x8F, 0x97};
const byte part1[6] = {0xD3, 0xD7, 0xB8, 0xC4, 0xBC, 0xC0};
const byte part2[6] = {0xD2, 0xD6, 0xB9, 0xC5, 0xBD, 0xC1};
const byte part3[6] = {0xD1, 0xD5, 0xBA, 0xC6, 0xBE, 0xC2};
const byte part4[6] = {0xD0, 0xD4, 0xBB, 0xC7, 0xBF, 0xC3};

// 32λ??prnd???????????4?????±???4?????
//??????????????±???λ
const byte prnd[4][8] = {0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30,
                         0x2F, 0x2E, 0x2D, 0x00, 0x2B, 0x2A, 0x29, 0x00,
                         0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20,
                         0x1F, 0x1E, 0x1D, 0x00, 0x1B, 0x1A, 0x19, 0x18};
// prnd_num?????????????
const byte prnd_num[12][4] = {
    0x67, 0xA8, 0x99, 0xE0, // 0
    0x11, 0x20, 0x11, 0x63, // 1
    0x64, 0x8E, 0x61, 0xE0, // 2
    0x67, 0x26, 0x71, 0xE0, // 3
    0x11, 0x2E, 0x79, 0x63, // 4
    0x67, 0x2E, 0xE8, 0x80, // 5
    0x67, 0xAE, 0xE8, 0xE0, // 6
    0xCC, 0x8E, 0xE9, 0xE0, // p-7
    0xDF, 0xCE, 0xE9, 0xE0, // r-8
    0xDF, 0xE8, 0xDD, 0x6B, // n-9
    0xEF, 0xA8, 0x99, 0xEC, // d-10
    0x67, 0x2E, 0x68, 0xE0  // s-11
};
/*
const byte tb_num[15][7]={
//A    B    C    D    E     F    G
0x00,0x00,0x00,0x00,0x00,0x00,0x00,           //0
0x00,0x00,0x00,0x00,0x00,0x00,0x00,           //1
0x57,0x56,0x55,0x58,0x59,0x5B,0x5A,          //2
0x4F,0x4E,0x4D,0x50,0x51,0x53,0x52,            //3
0x47,0x46,0x45,0x48,0x49,0x4B,0x4A,            //4
0x3F,0x3E,0x3D,0x40,0x41,0x43,0x42,            //5
0xA7,0xA6,0xA5,0xA0,0xA1,0xA3,0xA2,          //6
0xAF,0xAE,0xAD,0xA8,0xA9,0xAB,0xAA,          //7
0xB7,0xB6,0xB5,0xB0,0xB1,0xB3,0xB2,             //8
0x64,0x65,0x66,0x63,0x62,0x60,0x61,             //9
0x6C,0x6D,0x6E,0x6B,0x6A,0x68,0x69,            //10
0x74,0x75,0x76,0x73,0x72,0x70,0x71,           //11
0x94,0x95,0x96,0x9B,0x9A,0x98,0x99,          //12
0x8C,0x8D,0x8E,0x93,0x92,0x90,0x91,          //13
0x84,0x85,0x86,0x8B,0x8A,0x88,0x89};         //14
//每一行代表一个8字组，需要-2使用；
//每组7个字节，每个节高5位对应内存号，低3位对应位号码，依据mod_num数值 3f为0011 1111代表只有第6位G是0，其他全是1，以此为GFEDCBA
  */

//*******quwenlong*********
const byte tb_num[16][7] = {

    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 1
    0xDC, 0xDD, 0xDF, 0xDE, 0xDE, 0x00, 0xDE, // 2
    0xD4, 0xD5, 0xD6, 0xDB, 0xDA, 0xD8, 0xD9, // 3

    0xCC, 0xCD, 0xCE, 0xD3, 0xD2, 0xD0, 0xD1, // 4
    0xC4, 0xC5, 0xC6, 0xCB, 0xCA, 0xC8, 0xC9, // 5
    0x5B, 0x56, 0x54, 0x58, 0x59, 0x5A, 0x55, // 6
    0xA3, 0xA2, 0xA1, 0xA0, 0x9C, 0x9E, 0x9D, // 7
    0xAB, 0xAA, 0xA9, 0xA4, 0xA5, 0xA7, 0xA6, // 8
    0xB3, 0xB2, 0xB1, 0xAC, 0xAD, 0xAF, 0xAE, // 9
    0x60, 0x61, 0x63, 0x5F, 0x5E, 0x5D, 0x62, // 10
    0x68, 0x69, 0x6B, 0x67, 0x66, 0x65, 0x6A, // 11
    0x70, 0x71, 0x73, 0x6F, 0x6E, 0x6D, 0x72, // 12
    0x94, 0x90, 0x92, 0x97, 0x96, 0x95, 0x91, // 13
    0x8C, 0x88, 0x8A, 0x8F, 0x8E, 0x8D, 0x89, // 14
    0x84, 0x80, 0x82, 0x87, 0x86, 0x85, 0x81, // 15

};

//数字                   //0    1    2    3    4    5    6    7    8    9
const byte mod_num[12] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x00, 0x00};
// T-BOX显示            0     1    E   F
const byte T_BOX[4] = {0x3F, 0x06, 0x79, 0x71};

const byte TLY[8] = {0x74, 0x75, 0x76, 0x77, 0x7F, 0x7E, 0x7D, 0x7C}; // FU1-FU8

const byte radar_left[3] = {0xBA, 0xB9, 0xB8};
const byte radar_center[3] = {0xBE, 0xBD, 0xBC};
const byte radar_right[3] = {0xC2, 0xC1, 0xC0};

const byte ENG_part[6] = {0x49, 0x4A, 0xB7, 0xB6, 0xB5, 0xB4};

const byte QYB_UP[12] = {0x33, 0x32, 0x31, 0x30, 0x2C, 0x2D, 0x2E, 0x2F, 0x23, 0x22, 0x21, 0x20}; // TE1-TE12

const byte QYB_DOWN[12] = {0x37, 0x36, 0x35, 0x34, 0x28, 0x29, 0x2A, 0x2B, 0x27, 0x26, 0x25, 0x24}; // TE24-TE13

//****************************

#pragma CODE_SEG DEFAULT

void Show_always_center_lcd(void)
{

  SEG_100KPA = 1;

  SEG_FUEL = 1;
  // SEG_KM1=1;    //小计大计千米
  SEG_L100KM = 1;
  SEG_QF = 1;

  // SEG_CAR     ;
  // SEG_TO      ;
  // SEG_KEY3   ;
  SEG_G3 = 1;

  SEG_G2 = 1;
  // SEG_DP     ;

  SEG_CT = 1;
  SEG_FUF = 1;
  SEG_FUK = 1;
}
#if 0
void Ht16c23_CT_Init(byte on )
{
  byte i;

  if (on)
  {
    I2C_sendcmd(DMOD, BIASDUTY_NORMAL);
    I2C_sendcmd(0x88, 0x00);
    I2C_sendcmd(FRAME, FRAME_160);
    // I2C_sendcmd(IVA,IVA_NORMAL);
    I2C_sendcmd(SYSMOD, SYSMOD_ON);
    for (i = 0; i < 28; i++)
      tb_add[i].bbyte = 0;

    SEG_CT = 1;
    SEG_ZQ = 1;
    SEG_YQ = 1;

    I2C_senddat(ADD_ORIG); //刷屏
  }
  else
  {
    for (i = 0; i < 28; i++)
      tb_add[i].bbyte = 0;
    I2C_senddat(ADD_ORIG);           //刷屏
    I2C_sendcmd(SYSMOD, SYSMOD_OFF); //关闭
  }
}
#endif

///////////////////////////////////////////////////////////////////////////
void Ht16c23_Init(byte on)
{
  byte i;

  if (on)
  {
      I2C_sendcmd(0x9C);    //1/3bias,Display on and enable Internal System oscillator,160Hz
      I2C_sendcmd(0x40);    //The Segment/ VLCD shared pin is set as VLCD pin
      I2C_sendcmd(0xC0);    //Blinking off
      //I2C_sendcmd1(0x00);    //the address is set to 00H
     
      //I2C_sendcmd(DMOD,BIASDUTY_NORMAL);
      //I2C_sendcmd(0x88,0x00);
      //I2C_sendcmd(FRAME,FRAME_160);
      //I2C_sendcmd(IVA,IVA_NORMAL);
      
      //I2C_sendcmd(SYSMOD,SYSMOD_ON);
      for (i=0; i<22; i++)    
          tb_add[i].bbyte = 0;   

    I2C_senddat(ADD_ORIG); //刷屏
  }
  else
  {
      for(i=0;i<22;i++)    tb_add[i].bbyte  =  0; 
      I2C_senddat(ADD_ORIG);        //刷屏
      I2C_sendcmd(0x90);
      //I2C_sendcmd(SYSMOD,SYSMOD_OFF);              //关闭
  }
}


//SLAVE  默认为0x7C
void I2C_senddat(byte orig) 
{
  byte i;
  I2C_Start();
  I2C_Send(SLAVE);
  I2C_Ack();
  //I2C_Send(DATAIN);
  //I2C_Ack();
  I2C_Send(orig);  
  I2C_Ack();
  
  for(i=orig;i<22;i++) 
  {
    I2C_Send(tb_add[i].bbyte); 
    if(i == 21) 
      I2C_NAck();
    else
      I2C_Ack();
  }
  I2C_Stop();
}

void I2C_sendcmd(byte para)
{  
  I2C_Start();
  I2C_Send(SLAVE);
  I2C_Ack();
  //I2C_Send(cmd);  
  //I2C_Ack();
  I2C_Send(para); 
  I2C_NAck();
  I2C_Stop();
}

///////////////////////////////////////////////////////////////////////////
void I2C_Start(void)
{
  // IO_OUTEN();
  LCD_SDA = 1;    // 4p-120  ???????????11??
  LCD_SCL = 1;    // 4P--120
  delay_900ns();  // start???????
  LCD_SDA = 0;    // SCL=1?????SDA????start
  delay_900ns();  // start???????
  LCD_SCL = 0;    //?λ???????sda???????scl??????????????
  delay_1600ns(); //???????????
}

void I2C_Stop(void)
{
  // IO_OUTEN();        //??????????io?????????????????????????????
  LCD_SCL = 0; //??????????00??
  LCD_SDA = 0;
  // delay_900ns();   //ò????????
  LCD_SCL = 1;   // 4P--120//???????????????????????sda=0??
  delay_900ns(); // stop???????
  LCD_SDA = 1;
  delay_1600ns(); //???????????????
}
///////////////////////////////////////////////////////////////////////////
//???????????????ack
void I2C_Send(byte txd)
{
  byte i = 0;
  // IO_OUTEN();             //??????????io?????????????????????????????
  for (i; i < 8; i++) //?????λ
  {
    if (txd & 0x80) //???????IIC_SDA=(txd&0x80)>>7;?????
      LCD_SDA = 1;  // txd & 0x80????bitA #IMM??????;(txd&0x80)>>7???7??RORA;?
    else
      LCD_SDA = 0;
    txd <<= 1;   //???????100ns????????SCL,TXD????洢??3p??100ns???????
    LCD_SCL = 1; //????????
    delay_900ns();
    LCD_SCL = 0;    //????????
    delay_1600ns(); //???????????
  }
  // I2C_Ack();
}

///////////////////////////////////////////////////////////////////////////
void I2C_Ack(void)
{
  byte txd = 0X01;
  LCD_SCL = 0;    //??????????????
  LCD_SDA = 0;    //???
  txd <<= 1;      //???????????????100ns?????txd????????????,?????±????????
  LCD_SCL = 1;    //????????
  delay_900ns();  //???????????
  LCD_SCL = 0;    //????????
  delay_1600ns(); //???????????
}

void I2C_NAck(void)
{
  byte txd = 0X01;
  LCD_SCL = 0;    //??????????????
  LCD_SDA = 1;    //?????
  txd <<= 1;      //???????????????100ns?????txd????????????,?????±????????
  LCD_SCL = 1;    //????????
  delay_900ns();  //???????????
  LCD_SCL = 0;    //????????
  delay_1600ns(); //???????????
}

///////////////////////////////////////////////////////////////////////////
// 1??????????31.25ns?????????300ns?????
//???JSR????delay????????4??tbus??120ns
// nop   1??tbus                    30ns
//?????180ns??rts 5tbs            150ns
void delay_300ns(void)
{
  asm NOP;
}
void delay_900ns(void)
{
  delay_300ns();
  delay_300ns();
  asm NOP;
}
void delay_1600ns(void)
{
  delay_300ns();
  delay_300ns();
  delay_300ns();
  delay_300ns();
  asm NOP;
  asm NOP;
  asm NOP;
  asm NOP;
}