[Dashboard\Ford\Tranzit\Tranzit 93C76]

Size(280,250); 

Form
{
    Group("Пробег",5,5,140,50)
    {
        Digit(Distance," ",5,18,90);
        Label(lb1,"KM",110,20);
    }
        
     Group("Информация",5,58,270,45)
    {
        Label(message," ",0,18);
    }
    Group("Описание",5,105,270,100) 
    {
        Label(lb4,"Калькулятор для Ford Tranzit.",0,20);
        Label(lb5,"EEPROM 93C76",0,35);
        Label(lb2,"Введите нужное значение в окне ПРОБЕГ",0,55);
        Label(lb3,"и нажмите кнопку <Применить>.",0,70);
    }
    Picture(Picture1,"Ford.bmp",170,10,0,0);
}

OnShow 
{
    Message.Bold = 1;
    Var0 = 0;
    Var1 = (@0x48 << 24) | (@0x49 << 16) | (@0x46 << 8) | @0x47;
    Var2 = (@0x4e << 24) | (@0x4f << 16) | (@0x4c << 8) | @0x4d;
    Var3 = (@0x54 << 24) | (@0x55 << 16) | (@0x52 << 8) | @0x53;
    Var4 = (@0x5a << 24) | (@0x5b << 16) | (@0x58 << 8) | @0x59;
    Var7 = (((@0x48 << 8) | @0x49) & 0xffff) + (((@0x46 << 8) | @0x47) & 0xFFFF);
    Var5 = ((@0x44 << 8) | @0x45) ^ 0xFFFF;
    // if (Var7 != Var5) {Var0 = Var0 +1;}
 
    if(Var0 != 0)
    {
        message.Color = 0x0000FF; 	
        Message = "Неверный дамп!";     
        Distance = 0;                   
    }
    else
    {
      var6 = 0;
        if(Var2 > Var1) {Var6 = Var2;} if(Var2 = Var1) {Var6 = Var2;}
        if(Var3 > Var6) {Var6 = Var3;} if(Var3 = Var6) {Var6 = Var3;}
        if(Var4 > Var6) {Var6 = Var4;} if(Var4 = Var6) {Var6 = Var4;}
        if(Var1 > Var6) {Var6 = Var1;} if(Var1 = Var6) {Var6 = Var1;}
        message.Color = 0xFF0000;                    
        message = "Дамп ОК. Введите новый пробег.";  
        Distance =  Var6 / 1000;  
    }                          
}

OnApply
{
    Var0 = 0;
    Var1 = Distance; 
    if(Var1 > 999900)   { Var0 = Var0 + 1; }
    if(Var0 != 0)
    {
        message.Color = 0x0000FF; 
        Message = "Пробег должен быть до 999900 км.";
    }
    else
    {
      Var0 = Distance; Var0 = Var0 * 1000;
      Var1 = Var0 >> 24; 
      Var2 = Var0 >> 16; 
      Var3 = Var0 >> 8; 
      Var4 = Var0 & 255;

        Var5=  ((var1 <<8) | var2)+((var3 <<8) | var4);
        Var5=  Var5^0xFFFF;
        


    
      Var8 = 0x44;      
      while (Var8 !=0x5c)
      {
  

       @Var8 = Var5>>8 ; Var8 = Var8 + 1;
       @Var8 = Var5 ; Var8 = Var8 + 1;
       @Var8 = Var3; Var8 = Var8 + 1;
       @Var8 = Var4; Var8 = Var8 + 1;
       @Var8 = Var1; Var8 = Var8 + 1;
       @Var8 = Var2; Var8 = Var8 + 1;
      }
        message.Color = 0xFF0000;  
        message = "Новый пробег записан. Дамп ОК.";
    }
}


