1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Is there any calculator to calculate checksum

Discussion in 'Homework Help' started by poojapatel2210, Jan 21, 2016.

  1. poojapatel2210

    poojapatel2210 New Member

    Joined:
    Nov 5, 2015
    Messages:
    25
    Likes:
    0
    I have a hex file
    :020000040000FA
    :0A0000004028000000000000D42892
    :1000800064008B13A020C73095003C308C000330F7
    :1000900096004A3099009101A3209701A6208C0177
    :1000A0009E208B01AC20AC209120A9209116111626
    :1000B0009301A02017149E20B401B601B501A92018
    :1000C00093019E208B170B168B15640063000000B4
    :1000D000031A7328640001308C06361C7328B70B92
    :1000E0007328912036108B130B128B11B4188728AC
    :1000F000341C8928A92013089E20B500351E8428A9
    :100100001430B70036148928B51A36108928912082
    :10011000AC200C198928C1200C198928B401B5011B
    :100120005F28A0201C308C009E208C16C120C1208E
    :100130008C12A0203C308C009E2008008801080012
    :100140000130880008000230880008000330880071
    :1001500008000730880008000130B000B9200B1DEE
    :10016000AF280A3095000B110730B005B00BAF284F
    :100170000800A020073095049E200A3095000B113E
    :1001800008000130B000A0201511951415109E2014
    :10019000D83095000B110B1DCB28B00BC828A02020
    :1001A000073095049E200800B300030EB2000B0830
    :0E01B000B400320E8300B30E330E8B01090033
    :020000040001F9
    :02000E006C097B
    :02001000FF1CD3
    :00000001FF

    I want to clculate the total check sum Is ther any way to find out i have program on MPLAB IDE
    If there is a way to find out total checksum please explain it step by step.
     
  2. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    I think this might be what you're looking for:

    http://onlinemd5.com/

    You can import a file, or copy and paste the text.
     
  3. poojapatel2210

    poojapatel2210 New Member

    Joined:
    Nov 5, 2015
    Messages:
    25
    Likes:
    0
    i tried but nothing happens as i click on compare.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)

    You don't need to click "Compare". That's only for verifying that a file matches a given checksum. In order to generate the checksum you just have to select your file. When you upload it, the checksum is instantly given to you (the field labeled "File checksum").
     
  6. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,228
    Likes:
    641
    Location:
    Derbyshire, UK
    Why do you desire to do this? - it's of no use at all, unless you're writing programming software (to read the HEX file) or assembler software (to write the file).

    The details required were in one of the MPASM help files, no idea if they still are?.
     
  7. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,164
    Likes:
    910
    Location:
    Rochdale UK
    If you are using MPLAB ide.... The checksum is displayed at the top after a clean build!!!

    upload_2016-1-21_18-39-58.jpeg
     
    • Like Like x 1
  8. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,897
    Likes:
    502
    Location:
    Cleveland, OH, USA
    I tried MPLab 8.92, but couldn't get it to calculate the checksum from just the hex. That is not to say it won't do that. I just haven't done it. (That is, I didn't want to risk screwing up the chip I currently have on my board.)

    I did check and it seems to be Intel hex, as I am sure we all assumed:

    :02 00 00 04| 00 00| FA (2's complement of (0x2 +0x4 = 0x6) = 0xFA)

    :0A 00 00 00| 40 28 00 00 00 00 00 00 D4 28| 92 (sum = 0x16E, last 2 digits of 2's complement = 92)

    On the chance that is what the OP wants to know how to do, the first 4 bytes are addresses and counts, the next series of bytes are data, and the last byte is the last two characters of the 2's complement of the sum of everything except the checksum. I have shown the calculations above. Here's a useful link: https://en.wikipedia.org/wiki/Intel_HEX

    If the OP adds the last two digits of each line, she will get the checksum, I think. I tried that and got an interesting 12-bit number, but I probably made a mistake in addition somewhere.

    John
     
    Last edited: Jan 21, 2016
  9. MaxHeadRoom78

    MaxHeadRoom78 Active Member

    Joined:
    Jun 9, 2015
    Messages:
    881
    Likes:
    70
    Location:
    Canada Geog Cen of N.A.
    I once wrote one in assembly to calculate the checksum of a Modbus transmission, this only entailed 6 to 8 bytes.;)
    Max.
     
  10. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,097
    John:

    Don't add. XOR everything.

    If I had 1111 or -1 in 4 bits (-8 to +7)

    -1+-1 = -2 or 1100
    1111 xor 1111 is 0
    If you add them in an 8 bit world without sign extending you get
    0001000
    AND it with 00001111 and you also get the right answer.
     
  11. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,228
    Likes:
    641
    Location:
    Derbyshire, UK
    Yes, Intel, but modified slightly to deal with 14 bit (and other size) words - as I mentioned earlier, it was described in the MPASM help file which was where I got the details from when writing PicProg and WinPicProg.

    But as I asked before, why would he want to calculate the checksum? - simply read it off the HEX file.
     
  12. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,897
    Likes:
    502
    Location:
    Cleveland, OH, USA
    Well, the question is posted in the Homework forum, so I assumed the OP (she) was asked to do the calculation and possibly even to show her work. Also, her previous posts have impressed me as being from someone who is thoughtfully trying to understand the how to, not just get answers.

    John
     
    • Like Like x 1
  13. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    I did not realize she was asking for homework help. Should have checked the forum I suppose....
     

Share This Page