Register
Page 82 of 88 FirstFirst ... 32727778798081828384858687 ... LastLast
Results 1,216 to 1,230 of 1306
  1. #1216
    DK Veteran

    Join Date
    May 2017
    Posts
    361
    Thanks Thanks Given 
    252
    Thanks Thanks Received 
    211
    Thanked in
    97 Posts

    Default

    I also want to participate in this great topic, below 3 functions 100/100 working for the calculation of the CRC16
    1.CRC16_KERMIT
    2.CRC16CCITT_False
    3.crc16_mcrf4xx

    function CRC16_KERMIT(cadena : string):word;
    var
    valuehex : word;
    i: integer;
    CRC : word;
    Begin
    CRC := 0;
    While i< length(cadena) do
    begin
    valuehex := ((strtoint('$'+cadena[i+1]+cadena[i+2]) XOR CRC) AND $0F) * $1081;
    CRC := CRC SHR 4;
    CRC := CRC XOR valuehex;
    valuehex := (((strtoint('$'+cadena[i+1]+cadena[i+2]) SHR 4) XOR LO(CRC)) AND $0F);
    CRC := CRC SHR 4;
    CRC := CRC XOR (valuehex * $1081);
    i:=i+2;
    end;
    CRC16_KERMIT:=(LO(CRC) SHL 8) OR HI(CRC);
    end;

    ************************************************** **********
    function crc16CCITT_False(Buffer:String):Cardinal;
    Const polynom=$1021;
    var
    i,j: Integer;
    Initial:word;
    begin
    Initial:=$ffff;
    Result:=Initial;
    i:=0;
    While i< Length(Buffer) do begin
    Result:=Result xor (strtoint('$'+buffer[i+1]+buffer[i+2]) shl 8);
    for j:=0 to 7 do begin
    if (Result and $8000)<>0 then Result:=(Result shl 1) xor Polynom
    else Result:=Result shl 1;
    end;
    i:=i+2;
    end;


    Result:=Result and $ffff ;
    end;

    ************************************************** ******
    function crc16_mcrf4xx( data: string): word;
    var
    i,j: integer;
    crc:word;
    len:int64;
    begin
    crc:=$FFFF;
    len:=length(data);
    i:=0;
    if len <= 0 then exit
    else
    begin
    while i<len do begin
    crc := crc xor strtoint('$'+data[i+1]+data[i+2]);
    for j:=0 to 7 do
    begin
    if odd(crc) then
    crc:=(crc shr 1) xor $8408
    else
    crc:=(crc shr 1);
    end;
    i:=i+2;
    end;


    end;


    crc16_mcrf4xx:=crc;
    end;


    ********************************
    for the use of these functions:
    crc16CCITT_False(Data); // data: must be in Hex
    crc16_mcrf4xx(Data); // data: must be in Hex
    CRC16_KERMIT(Data); // data: must be in Hex


    You can check the results using the site https://crccalc.com/

    these types of crc16 are commonly used, example bsi valeo and continental 95256, JC and Delphi 25128
    Last edited by MYMN; 29th December, 2021 at 05:45 PM.

  2. The Following 5 Users Say Thank You to MYMN For This Useful Post:

    hoangtu (5th January, 2022), Johnner (29th December, 2021), jomberykaso (29th May, 2022), rafa192 (22nd May, 2022)

  3. #1217
    DK Veteran

    Join Date
    May 2017
    Posts
    361
    Thanks Thanks Given 
    252
    Thanks Thanks Received 
    211
    Thanked in
    97 Posts

    Default Example

    Example peugoet 3008 2017, BSI delphi.. mileage : 127000 km

    0x2900............00 13 60 F0 FF EC 9F 0F 00 00 E7 7B

    00 13 60 F0 : Mileage (127000 * 10 >>to Hex ).

    FF EC 9F 0F : =(00 13 60 F0) xor (FF FF FF FF )

    E7 7B : is the CRC, obtained using the function CRC16 CCITT False :

    CRC16 CCITT False('001360F0FFEC9F0F0000') ; // the function returns: E7 7B
    Last edited by MYMN; 29th December, 2021 at 07:54 PM.

  4. The Following 6 Users Say Thank You to MYMN For This Useful Post:

    dashradio (1st January, 2022), Fuller (10th October, 2022), Johnner (31st January, 2022), jomberykaso (29th May, 2022), ncapuccio (25th July, 2023), rafa192 (22nd May, 2022)

  5. #1218
    DK Veteran
    Jardel's Avatar
    Join Date
    Jun 2020
    Location
    Brazil
    Posts
    356
    Thanks Thanks Given 
    135
    Thanks Thanks Received 
    295
    Thanked in
    205 Posts

    Default



    Hello everyone... could someone help me with two questions? If so, the first is how to use a filename saved as the date of the day, for example using this type of command:






    procedure Button4Click(Sender: TObject);

    var e: TXHexEdit
    begin
    e := GetHexEdit();
    if e <> nil then
    if SaveDialog1.Execute(' ') then
    e.SaveFile( SaveDialog1.FileName );
    end;

    The second one I've researched endlessly and I haven't found any way to encrypt the scripts with a .udx extension. Can someone help me?

  6. #1219
    Member
    Join Date
    Apr 2020
    Location
    KSA
    Posts
    86
    Thanks Thanks Given 
    35
    Thanks Thanks Received 
    11
    Thanked in
    9 Posts

    Default

    Quote Originally Posted by hcip View Post
    You can use SaveDialog Filter & filter index in code to show multiple selection of file

    eg:
    SaveDialog1.Filter :='Any File [*.*]|*.*|Binary [bin file]|*.bin|Diga [*.e2p File]|*.E2P|Motorola [S19, S28, S37, mot]|*.S19;*.S28*.S37;*.mot;|Motorola [S19]|*.S19|Motorola [S28]|*.S28|Motorola [S37]|*.S37|Motorola [PonyProg]|*.mot';



    Code:
    procedure Button4Click(Sender: TObject);
    var e: TXHexEdit
    begin
    e := GetHexEdit();
    SaveDialog1.Filter :='Any File [*.*]|*.*|Binary [bin file]|*.bin|Diga [*.e2p File]|*.E2P|Motorola [S19, S28, S37, mot]|*.S19;*.S28*.S37;*.mot;|Motorola [S19]|*.S19|Motorola [S28]|*.S28|Motorola [S37]|*.S37|Motorola [PonyProg]|*.mot';
    if e <> nil then
    if SaveDialog1.Execute(' ') then
    e.SaveFile( SaveDialog1.FileName );
    end;

    See attached picture

    Maraming Salamat Master Ito yung hinahanap ko.

  7. #1220
    DK Veteran
    Jardel's Avatar
    Join Date
    Jun 2020
    Location
    Brazil
    Posts
    356
    Thanks Thanks Given 
    135
    Thanks Thanks Received 
    295
    Thanked in
    205 Posts

    Default

    Quote Originally Posted by cartagena View Post
    Maraming Salamat Master Ito yung hinahanap ko.
    This is a savedialog. I need filename

  8. #1221
    DK Veteran
    hcip's Avatar
    Join Date
    Dec 2009
    Location
    From the heaven of paradise in the middle of happiness|hobby:__Bedtime| Sex:Female|Status:Not_Virgin
    Posts
    1,883
    Thanks Thanks Given 
    197
    Thanks Thanks Received 
    2,478
    Thanked in
    805 Posts

    Default

    Quote Originally Posted by Jardel View Post
    This is a savedialog. I need filename

    you can used expression:

    Savedialog1.filename := DateTimetoStr(now);


    Stupidity is not a disease, because there are no existing hospitals for Idiots!

    ​​

  9. The Following 3 Users Say Thank You to hcip For This Useful Post:

    dashradio (12th January, 2022), Jardel (10th January, 2022), Johnner (10th January, 2022)

  10. #1222
    DK Veteran
    hcip's Avatar
    Join Date
    Dec 2009
    Location
    From the heaven of paradise in the middle of happiness|hobby:__Bedtime| Sex:Female|Status:Not_Virgin
    Posts
    1,883
    Thanks Thanks Given 
    197
    Thanks Thanks Received 
    2,478
    Thanked in
    805 Posts

    Default

    @Jardel

    Because the software doesnt allowed special character of decoded date to string, you can change the special character to acceptable character in code

    I Attached The Full code for Save_File Command
    Attached Files Attached Files


    Stupidity is not a disease, because there are no existing hospitals for Idiots!

    ​​

  11. The Following 2 Users Say Thank You to hcip For This Useful Post:

    dashradio (12th January, 2022), Jardel (11th January, 2022)

  12. #1223
    DK Veteran
    Jardel's Avatar
    Join Date
    Jun 2020
    Location
    Brazil
    Posts
    356
    Thanks Thanks Given 
    135
    Thanks Thanks Received 
    295
    Thanked in
    205 Posts

    Default

    Thank you so much, Hcip once again! The code you posted earlier worked perfectly and this new one will certainly be of great help! I know you've been asked a lot, but in all my searches I didn't find what I was looking for, if it's not too much to ask, how do I encrypt my scrips in udx? No one so far knew how to leave this question in a way that I could understand... (apologies for my English).

  13. #1224
    DK Veteran
    hcip's Avatar
    Join Date
    Dec 2009
    Location
    From the heaven of paradise in the middle of happiness|hobby:__Bedtime| Sex:Female|Status:Not_Virgin
    Posts
    1,883
    Thanks Thanks Given 
    197
    Thanks Thanks Received 
    2,478
    Thanked in
    805 Posts

    Default

    Quote Originally Posted by Jardel View Post
    Thank you so much, Hcip once again! The code you posted earlier worked perfectly and this new one will certainly be of great help! I know you've been asked a lot, but in all my searches I didn't find what I was looking for, if it's not too much to ask, how do I encrypt my scrips in udx? No one so far knew how to leave this question in a way that I could understand... (apologies for my English).

    UDX is used in old UPA software(V1.1), I think somebody here has own the UDX packer soft to share, I dont have it anymore.

    if you are using IDE (V 1.3) to write a code, you can compile it in *.xscr file, From IDE just click File>>>Save Compiled
    Attached Images Attached Images
    Last edited by hcip; 11th January, 2022 at 03:05 AM.


    Stupidity is not a disease, because there are no existing hospitals for Idiots!

    ​​

  14. The Following 3 Users Say Thank You to hcip For This Useful Post:

    cartagena (31st January, 2022), dashradio (12th January, 2022), Jardel (11th January, 2022)

  15. #1225
    DK Veteran
    Jardel's Avatar
    Join Date
    Jun 2020
    Location
    Brazil
    Posts
    356
    Thanks Thanks Given 
    135
    Thanks Thanks Received 
    295
    Thanked in
    205 Posts

    Default

    Exactly what I've been doing! Thank you so much again for your great help!With that explanation it was clear as light!

  16. The Following User Says Thank You to Jardel For This Useful Post:

    Diogo Mello (11th January, 2022)

  17. #1226
    Member
    Join Date
    Apr 2020
    Location
    KSA
    Posts
    86
    Thanks Thanks Given 
    35
    Thanks Thanks Received 
    11
    Thanked in
    9 Posts

    Default

    Hello every one I have to ask what is the problem and how to solve this error, the code is run but when you put text number to the Edit Text and press ok then I get Error, please advise every one.
    Attached Images Attached Images

  18. #1227
    DK Veteran

    Join Date
    May 2017
    Posts
    361
    Thanks Thanks Given 
    252
    Thanks Thanks Received 
    211
    Thanked in
    97 Posts

    Default

    Quote Originally Posted by cartagena View Post
    Hello every one I have to ask what is the problem and how to solve this error, the code is run but when you put text number to the Edit Text and press ok then I get Error, please advise every one.
    I have never used upa, but in pascal language, we must assign the types of variables to the declared variables:
    in your script:
    var n,code:integer;
    Regarding your error, it is normal:
    you did not give a value to your variable 'Code'

    it is necessary to put :
    Code:=strtoint(edit1.text);

    before that you can put the following code, to avoid the error in case of not entering the value in edit1

    if (edit1.text='' ) or ( strtoint(edit1.text)>9999) then begin

    MsgBox( 'Your message Here ', 'Error', MB_OK );
    exit;
    end;

    if you want to prohibit entering non-numeric characters you can use this code:

    Val(edit1.text,code,i) ;// you have to declare the variable I as an integer
    if i<>0 then begin
    MsgBox( 'The entered value is not an integer', 'Error', MB_OK );
    exit;
    end;

    I don't know if the val procedure works in the UPA compiler, but it exists in the pascal language
    Last edited by MYMN; 31st January, 2022 at 01:26 PM.

  19. The Following 2 Users Say Thank You to MYMN For This Useful Post:

    cartagena (31st January, 2022), Johnner (31st January, 2022)

  20. #1228
    Member
    Join Date
    Apr 2020
    Location
    KSA
    Posts
    86
    Thanks Thanks Given 
    35
    Thanks Thanks Received 
    11
    Thanked in
    9 Posts

    Default

    hello mate I have another error variable is not an array and the Val procedure is not work in the IDE what should be the problem
    Attached Images Attached Images

  21. #1229
    DK Veteran

    Join Date
    May 2017
    Posts
    361
    Thanks Thanks Given 
    252
    Thanks Thanks Received 
    211
    Thanked in
    97 Posts

    Default

    Load a clear image, I see nothing,
    put your code here to see where the problem ,,

  22. #1230
    Member
    Join Date
    Apr 2020
    Location
    KSA
    Posts
    86
    Thanks Thanks Given 
    35
    Thanks Thanks Received 
    11
    Thanked in
    9 Posts

    Default

    Hello mate here is the code thank you

    ////////////////////////////////////////////////
    procedure EditCode;
    Var n, Code: integer;
    begin
    SetProgramModifiedOnly( True);
    if (edit1.text='' ) or ( strtoint(edit1.text)>9999) then begin
    if Length(Edit1.Text='')< 4 then begin
    MsgBox( 'Enter 4 Numbers Only ', 'Error', 0 );
    exit;
    end;
    end;
    Code:=StrtoInt(edit1.text);


    SetByteHexEdit($1F6, StrToInt('$'+ Code[1]+Code[2]));
    SetByteHexEdit($1F7, StrToInt('$'+ Code[3]+Code[4]));
    RefreshHexEdit;
    end;
    Attached Images Attached Images

 

 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.