PDA

View Full Version : UPA SCRIPT KM MILEAGE



autosoftbrasil
2nd October, 2021, 03:48 AM
Hello,


How do I convert HEX to DEC.
To accept on eproom 24c04
Someone would have an upa script or a UDS file.


I am trying to do this in UPA.
But the reading of HEX 4711 is giving 26538, the correct one would be 28488


Script UPA


Program Prog1;
var
Code,Code_1: string;
KM: Integer;




Procedure ReadKM;
begin
if not ReadDevice then
begin
MsgBox( 'Erro na Leitura', 'Atenção', MB_OK );
end
else
begin
AddMsg('Honda PCX 150');
Code_1:=inttohex(GetByteHexEdit($178),2)+inttohex( GetByteHexEdit($177),2);
KM:= (strtoint('$'+Code_1))*6;
AddMsg('Km Original' + ' = '+ IntToStr(KM)+' km');
MsgBox(IntToStr(KM) +' km', 'Km Original', MB_OK);
end;
end;

Jardel
2nd October, 2021, 11:02 AM
Your calculation is incorrect.