[Dashboard\Volkswagen\Touran 24C16 var2]



Size(280,300); 

Form
{
       Group("Пробег",5,5,140,50)
    {
        Digit(Distance," ",5,18,90);
        Label(lb1,"KM",110,20);
        
    }
    Group("VAG P/N. DATE",5,70,270,40)
    {
        Label(pn," ",0,15);	
    } 
    Group("Информация",5,120,270,45)
    {
        Label(msg," ",0,18);
    }
    Group("Описание",5,160,270,100) 
    {
        Label(lb4,"Калькулятор пробега для Touran var2.",0,20);
        Label(lb5,"EEPROM 24C16",0,35);
        Label(lb2,"Введите нужное значение в окне <Пробег>.",0,55);
        Label(lb3,"и нажмите кнопку <Применить>.",0,70);
    }
    Picture(Logo,"vw.bmp",190,17,0,0);
}
OnShow
{
    Var0=0;
    Var1=(@0x3f6);
    Var2=(@0x3f7);
    if(Var1 = 0x31) { Var0 = 1;}
    if(Var2 = 0x54) { Var0 =Var0 + 1;}
    if(Var0 = 2)
      {
        Var5 = (((@0x5ad << 8)+@0x5ac) ^ 0xFFFF) << 5;
        Distance = Var5;
        pn = "P/N: "+#c.@0x3f6+#c.@0x3f7+#c.@0x3f8+#c.@0x3f9+#c.@0x3fa+#c.@0x3fb+#c.@0x3fc+#c.@0x3fd+#c.@0x3fe+#c.@0x3ff+#c.@0x400+"  "+#c.@0x392+#c.@0x393+#c.@0x394+"   DATE: "+#c.@0x39a+#c.@0x39b+#c.@0x39c+#c.@0x39d+#c.@0x39e+#c.@0x39f+#c.@0x3a0+#c.@0x3a1;
        msg.Color = 0xFF0000;
        msg.Bold = 1;
        msg = "Дамп ОК. Введите пробег.";
        
       }
       else
       {
        msg.Color = 0x0000FF;
        msg.Bold = 1;
        msg = "Неверный дамп!";
        Distance = 0;
       }
}

OnApply 
{
    Var5 = 0;
    Var2 = Distance;
    Var7 = Var2 >> 5 & 65535 ^ 0xFFFF;
    if(Var2 > 999900) {Var5 = 1;}
    if(Var2 < 100)   {Var5 = 1;}
    if(Var5 != 0)
    {
        msg.Color = 0x0000FF;
        msg.Bold = 1;
        msg = "Пробег должен быть от 100 до 999900 км";
    }
    else
    {
        Var3 = 0x5ac;
        while(Var3 != 0x5cc)
        {
            
            @Var3 = Var7 & 255;
            @Var3.mismatch = 1;
            Var3 = Var3 + 1;
            @Var3 = Var7 >> 8 & 255;
            @Var3.mismatch = 1;
            Var3 = Var3 + 1;
            Var6 = Var7 * 2;
            Var7 = (Var6 >> 16 + Var6) & 65535;
            msg.Color = 0xFF0000;
            msg.Bold = 1;
            msg = "Новый пробег записан.";
        }
       
    }
}
