2 years, 6 months ago.

Difference between binary and hex files


I am new to this mbed.

When i read the posts here i came to know that mbed online compiler gives the binary file whereas our custom LPC1768 ic to be programmed using hex file. So the binary files are to be converted into hex file using bin2hex.exe in order to program lpc ic directly.

I think hex files should also be stored as binary in memory.

So what is the difference between binary and hex files?

Is it possible to program the custom lpc1768 IC using bin file?

Thanks, Murugesh

Comment on this question

3 Answers

1 year, 6 months ago.

I also have this a question(what is the difference between binary and hex files?)

A binary file contains the ones and zeros which are going to be programmed. A hex file writes down all the data in ASCII as hexadecimal numbers.

posted by Erik Olieman 26 May 2014

thanks :-) ♥

posted by amir hossein jahanshahloo 26 May 2014

There is a distinction to be made here between numerical representation and file types, hexadecimal is just another way to represent binary data, however .hex and .bin files are very different.

.bin files are straight binary data (and therefore require a special editor to edit / make sense of), when loading them onto a microcontroller you have to specify the address to load the data to.

.hex files are Ascii files written using the IntexHex file format and is used for putting code into memory of microcontrollers. This file type contains metadata about where to load the file, the length of the file, the type of stuff being loaded, etc. This makes it possible to do more awesome things with .hex file than is possible with a .bin file. Also when putting a .hex file onto a microcontroller you do not have to specify where to load the code, because the address is specified as part of the file. A good primer can be found here .

posted by Austin mbed 16 Mar 2015
2 months, 4 weeks ago.

Moderator: SPAM removed

To post an answer, please login