16-07-2020, 14:49:38
(Esta mensagem foi modificada pela última vez a: 16-07-2020, 15:08:09 por admin.)
Atenção: Esse Script deve ser utilizado apenas para correção de KM em troca de painel.
program Prog1;
var
Code, Code_1: string;
KM: Integer;
procedure ReadKM;
begin
if not ReadDevice then
begin
MsgBox('Erro de Leitura', 'Erro', MB_OK);
end
else
begin
AddMsg('Chevrolet 93C56');
Code_1 := inttohex(GetByteHexEdit($F1), 2) + inttohex(GetByteHexEdit($F0), 2);
KM := ((65535 - strtoint('$' + Code_1)) * 16);
AddMsg('Kilometragem Atual' + ' = ' + IntToStr(KM) + ' km');
MsgBox(IntToStr(KM) + ' km', 'KM Atual', MB_OK);
end;
end;
procedure NewKM;
var
n, new_KM: integer;
n1: string;
begin
SetProgramModifiedOnly(true);
if InBox('Digite o KM', 'Nova KM', code) then begin
end;
if StrToInt(code) > 999999 then
begin
MsgBox('Digite um valor entre 000001-999999', 'Erro', MB_OK);
exit;
end;
n := StrToInt(code);
new_KM := (65535 - (n / 16));
n1 := IntToHex(new_KM, 4);
SetByteHexEdit($F0, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($F1, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($F2, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($F3, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($F4, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($F5, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($F6, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($F7, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($F8, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($F9, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($FA, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($FB, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($FC, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($FD, (strtoint('$' + n1[1] + n1[2])));
SetByteHexEdit($FE, (strtoint('$' + n1[3] + n1[4])));
SetByteHexEdit($FF, (strtoint('$' + n1[1] + n1[2])));
RefreshHexEdit;
if MsgBox('Programar?', 'Confirme', MB_YESNO) = IDYES then
begin
SetProgramModifiedOnly(true);
ProgramDevice;
VerifyDevice;
ReadKM;
end;
end;
begin
AddDeviceGroup('APLICAÇÃO ODÔMETRO', 'Select a car');
AddDevice('ASTRA PAINEL 93C56', '93C56', 'APLICAÇÃO ODÔMETRO', '93C56 x16');
AddAction('Read KM', 'ReadKM', 'ASTRA PAINEL 93C56');
AddAction('New KM', 'NewKM', 'ASTRA PAINEL 93C56');
AddDeviceGroup('APLICAÇÃO GM', 'Select a car');
AddDevice('ZAFIRA PAINEL 93C56', '93C56', 'APLICAÇÃO GM', '93C56 x16');
AddAction('Read KM', 'ReadKM', 'ZAFIRA PAINEL 93C56');
AddAction('New KM', 'NewKM', 'ZAFIRA PAINEL 93C56');
AddMsg('GM - ASTRA & ZAFIRA PAINEL - Installed '#169' 2020 MSBig - www.msbig.net');
SetProductInfo('Sample1', 'Device Script Example'#$D'Copyright'#169' 2020 MSBig - www.msbig.net');
end.
Administrador