EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
You are here: Home / Topics / how to read hex file

how to read hex file

|

Microcontroller › AVR › how to read hex file

  • This topic has 6 replies, 6 voices, and was last updated 9 years, 1 month ago by AJISH ALFRED.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • February 23, 2011 at 6:08 am #745
    dagakshay
    Participant

    hello 

    one interesting thing which might solve your doubt if you are looking for the hex code size of your project.

    where you saw the size of your hex file?… just by right clicking on the file and going to the properties? is that the way you have checked?…

    you are 100% wrong if you have assumed that is the original amount of hex which is going to be dumped in your controller.

    open your hex file with a text editor like notepad.. it should look something like this:

    //……………………………………………………………

    :100000000C942A000C9434000C9434000C943400AA
    :100010000C9434000C9434000C9434000C94340090
    :100020000C9434000C9434000C9434000C94340080
    :100030000C9434000C9434000C9434000C94340070
    :100040000C9434000C9434000C9434000C94340060
    :100050000C94340011241FBECFE5D4E0DEBFCDBF29
    :100060000E9436000C946E000C940000FF920F93D7
    :100070001F938FEF87BB81BB8EEFF82E04E02AEF32
    :1000800030E01DEFBAE0ABEF41E1F7EFEFE17FEEDB
    :100090006FED5FEBF8BA02BBC9010197F1F718BB2E
    :1000A000B2BBC9010197F1F7A8BB42BBC9010197D7
    :1000B000F1F7F8BBE2BBC9010197F1F778BB42BB8E
    :1000C000C9010197F1F768BB42BBC9010197F1F77C
    :1000D00058BB42BBC9010197F1F7DCCFF894FFCFC1
    :00000001FF
    //………………………………………………………………

     

    let me take one line from this hex file

    :100000000C942A000C9434000C9434000C943400AA

    :CCAAAATTXXXXX……XXSS

    1) A new line in hex file always starts from “:” (colon)

    2) The first two letters represent the number of bytes in that line (all the values written in hex)…”CC”

    3) The AAAA: the next four letters indicate from where this line should start… the starting address…

    4) type of the line.. if TT=00 more lines are there in that hex file,,, if TT=01 that is the last line in that hex file…

    5) XXXX……..XX is the original code that is going to be dumped onto your controller..

    6) at last the SS is the checksum for the complete line.

    if you want the original size of your hex code you are going to dump, go to the second last line note the address and add the count bytes (CC) this will tell the original size…

    the size you see in the properties of file is the size of that text file which includes all the : , CC , AAAA and SS which you are not goin to dump in your controller ……..

     

    post your comments here if you have any doubts in that or you can add on more information here

    March 27, 2011 at 8:16 am #5815
    Amit Joshi
    Participant

    can u explain it by giving example.

    April 6, 2012 at 10:03 pm #7400
    Ahmed
    Participant

    If we can see example about this it will be great for us to calculate our HEX file.

    Thanks dagakshay

    May 11, 2012 at 6:15 am #7732
    nikhiljain
    Participant

    Hello,

     

    Try this

     

    http://www.engineersgarage.com/tutorials/what-is-hex-file-format

    May 11, 2012 at 6:15 am #7752
    nikhiljain
    Participant

    Hello,

     

    Try this

     

    http://www.engineersgarage.com/tutorials/what-is-hex-file-format

    July 13, 2013 at 2:51 pm #10140
    ravi kant
    Participant

    do you have more or can u can recommend book about hex file?pls reply

    July 16, 2013 at 4:17 am #10149
    AJISH ALFRED
    Participant

    Really useful information. Thanks Dagakshay.

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Washing Machine motor August 14, 2022
  • arduino help needed August 14, 2022
  • Looking for amplifier ic August 14, 2022
  • Light Automation via mqtt August 14, 2022
  • Right channel distortion on vintage fisher rs-2010 August 14, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools