Bem vindo ao Fórum MSBig, se você já é registrado e está vendo essa mensagem basta clicar em Entrar com seu usuário e senha!

Avaliação do Tópico:
  • 0 votos - 0 Média
  • 1
  • 2
  • 3
  • 4
  • 5
UPA Script - Correção de KM Dodge Chrylesr 300C
#1
Script 
program Prog1;
var
  Code_1: string;
  KM: Integer;

procedure ReadKM;
begin
  if not ReadDevice then
  begin
    MsgBox('Erro de Leitura', 'Erro', MB_OK);
  end;
  verifyDevice;
  begin
    AddMsg('Lendo Chrylesr 300C');
    Code_1 := inttohex(GetByteHexEdit($FB4), 2) + inttohex(GetByteHexEdit($FB5), 2);
    KM := strtoint('$' + Code_1) * 27;
    AddMsg('Kilometragem Atual' + ' = ' + IntToStr(KM) + ' km');
    MsgBox(IntToStr(KM) + ' km', 'KM Atual', MB_OK);
  end;
end;

procedure NewKM;
var
  n, n3, new_KM, x, y, x1, y1, a, b: integer;
  n1, n2, n4, code: string;

begin
  SetProgramModifiedOnly(true);
  if InBox('Digite KM', 'Nova KM', code) then
  begin
    if length(code) > 6 then
    begin
      if MsgBox('Um valor de 000001 até 999999', 'Erro', MB_RETRYCANCEL) = IDRETRY then
      begin
        NewKM;
      end;
      exit;
    end;
  end;
  n := StrToInt(code);
  new_KM := (65536 + (n / 27));
  n1 := IntToHex(new_KM, 4);
  n2 := IntToHex(new_KM, 4)[5];
  n3 := strtoint('$' + n2);
  n4 := inttohex(n3, 1);

  Y := 3952;
  while y < 4016 do
  begin
    SetByteHexEdit(y, (strtoint('$' + n1[2] + n1[3])));
    y := y + 4;
  end;
  Y1 := 3953; a := 16
  while y1 < 4016 do
  begin
    SetByteHexEdit(y1, (strtoint('$' + n1[4] + n4) + a));
    y1 := y1 + 4; a := a + 1
  end;
  x := 4016;
  while x < 4078 do
  begin
    SetByteHexEdit(x, (strtoint('$' + n1[2] + n1[3])));
    x := x + 4
  end;
  x1 := 4017; b := 0
  while x1 < 4079 do
  begin
    SetByteHexEdit(x1, (strtoint('$' + n1[4] + n4) + b));
    x1 := x1 + 4; b := B + 1
  end;

  RefreshHexEdit;
  if MsgBox('Programar?', 'Confirme', MB_YESNO) = IDYES then begin
    ProgramDevice;
    VerifyDevice;
    ReadKM;
  end;
end;
begin
  AddDeviceGroup('DASH', 'Select a car');
  AddDevice('300C', 'Motorola MCU', 'DASH', 'MC9S12DG256');
  AddAction('Read KM', 'ReadKM', '300C');
  AddAction('New KM', 'NewKM', '300C');
  SetProductInfo('MSBig', 'Device Script Example'#$D'Copyright'#169' 2020 Fórum MSBig - www.msbig.net');
end.
Administrador
Responder


Possíveis Tópicos Relacionados...
Tópico: Autor Respostas: Visualizações: Última Mensagem
Arquivo Banco de dados de Painéis - DODGE - 001 admin 0 408 24-06-2022, 18:22:09
Última Mensagem: admin
Arquivo Arquivos para painéis - Dodge admin 0 334 15-11-2021, 15:19:38
Última Mensagem: admin
  Ligações para Dodge Ram admin 0 425 12-07-2021, 14:48:28
Última Mensagem: admin
Script UPA Script - Correção de KM FIAT Strada admin 0 615 16-07-2020, 15:15:29
Última Mensagem: admin

Saltar Fórum:


usuários a ver este tópico: 1 Visitante(s)