[Dashboard\Volkswagen\Transporter\T4\T4 93C86 tacho off WestUA]

Size(280,315);
Form
{
    Group("Пробег",5,5,140,50)
    {
        Digit(Distance," ",5,18,90);
        Label(lb1,"KM",110,20);
    }	
	ComboBox(TachoRequest," Tachograf ",32,62,50,"On","Off");
    Group("Идентификация",5,85,270,40)
    {
        Label(vag," ",55,15);
    }
    Group("Информация",5,125,270,45)
    {
        Label(message," ",0,18);
    }
    Group("Описание",5,170,270,80)
    {
        Label(lb2,"Калькулятор пробега для VW Transporter.",0,15);
        Label(lb3,"VDO. EEPROM 93C86.",0,30);
        Label(lb4,"Введите нужное значение в окне ПРОБЕГ",0,45);
	Label(lb5,"и нажмите кнопку <Применить>.",0,60);
    }
	Picture(Picture,"VW.bmp",180,5,0,0);
    {
        Label(msg," ",0,255);
    } 

OnShow {
	msg.Color=0x0000FF; msg.Bold=1;	msg="комплект WestUA калькулятори";
	Var0 = 0;
	if(@0x128 = 0x54) { Var0 = Var0+1;} 
    	if(@0x129 = 0x34) { Var0 = Var0+1;} 
	if(Var0 != 2) {message.Bold = 1; message.Color = 0x0000FF; message = "Неверный дамп !"; Distance = 0; }
    else
    {	TachoRequest=1;
	if(@0x1EC = 0xC0) {TachoRequest=0;}
	Distance = 0;
	vag = "VAG P/N : "+#c.@0x11c+#c.@0x11d+#c.@0x11e+" "+#c.@0x11f+#c.@0x120+#c.@0x121+" "+#c.@0x122+#c.@0x123+#c.@0x124+#c.@0x125+"   "+#c.@0x12a+#c.@0x12c+"."+#c.@0x12d;
			
	Var1 = 0;
    Var2 = (@0xeb <<8) | @0xea;
    Var3 = (@0xed <<8) | @0xec;
    Var4 = (@0xef <<8) | @0xee;
    Var5 = (@0xf1 <<8) | @0xf0;
    Var6 = (@0xf3 <<8) | @0xf2;
    Var7 = (@0xf5 <<8) | @0xf4;
    Var8 = (@0xf7 <<8) | @0xf6;
    Var9 = (@0xf9 <<8) | @0xf8;
	
    if (Var2 > Var3) {Var1 = Var2;}
    if (Var2 = Var3) {Var1 = Var2;}
    if (Var3 > Var1) {Var1 = Var3;}
    if (Var3 = Var1) {Var1 = Var3;}
    if (Var4 > Var1) {Var1 = Var4;}
    if (Var4 = Var1) {Var1 = Var4;}
    if (Var5 > Var1) {Var1 = Var5;}
    if (Var5 = Var1) {Var1 = Var5;}
    if (Var6 > Var1) {Var1 = Var6;}
    if (Var6 = Var1) {Var1 = Var6;}
    if (Var7 > Var1) {Var1 = Var7;}
    if (Var7 = Var1) {Var1 = Var7;}
    if (Var8 > Var1) {Var1 = Var8;}
    if (Var8 = Var1) {Var1 = Var8;}
    if (Var9 > Var1) {Var1 = Var9;}
    if (Var9 = Var1) {Var1 = Var9;}
    if (Var9 > Var2) {Var1 = Var9;}
    if (Var9 = Var2) {Var1 = Var9;}	

	Var10 = (0xFFFF - var1) * 16;
	Distance = Var10;
	message.Color = 0xFF0000; message.Bold = 1; message = "Дамп ОК. Введите новый пробег.";	
    }
}


OnApply {
	Var0 = 0;
	if(@0x128 = 0x54) { Var0 = Var0+1;} 
    	if(@0x129 = 0x34) { Var0 = Var0+1;} 
	if(Var0 != 2) {message.Bold = 1; message.Color = 0x0000FF; message = "Неверный дамп !  Запись прекращена !"; Distance = 0; }
    else
    {	if(TachoRequest=0) {@0x1EC = 0xC0;}
	if(TachoRequest=1) {@0x1EC = 0x33;}
	Var1 = Distance;
    Var0 = 0;

    if(Var1 < 100)      { Var0 = Var0 + 1; }
    if(Var1 > 999990)   { Var0 = Var0 + 1; }

    if(Var0 != 0)
    {
       message.Color = 0x0000FF;
       message = "Пробег должен быть от 100 до 999990 км.";
    }
    else
    {
		Var11 = Distance / 16;
		Var5= Var11 ^ 0xFFFF;
		Var6 = Var11 ^ 0xFFFF >>8;
		@0xea=Var5; @0xeb=Var6;
		@0xec=Var5; @0xed=Var6;
		@0xee=Var5; @0xef=Var6;
		@0xf0=Var5; @0xf1=Var6;
		@0xf2=Var5; @0xf3=Var6;
		@0xf4=Var5; @0xf5=Var6;
		@0xf6=Var5; @0xf7=Var6;
		@0xf8=Var5; @0xf9=Var6;
	message.Color=0xFF0000; message.Bold=1; message="Дамп OK. Новый пробег записан.";
    }
    }
}
	