Hi! Last time the title was mistakenly written as "and". My query is: I have read the code from AT89C51RD2 and dumped it into a file. This code worked well when burnt in other AT89C51RD2 controllers. Later i got its source code. Now i am generating the hex file. This hex file is different from one i copied from the controller. The generated file is in Intel Hex Format (i.e. starts with 0x3A) whereas the coped hex file starts with 0x02. What is the difference between two hex files?
An Intel Hex file is really just a text file.
Each line starts with a colon: which happens to be the character 0x3A.
If you have a file that starts with 0x02, then it is almost certainly NOT an Intel Hex file.
Actually, it sounds like it is a binary image, the character 0x02 is the opcode for an LJMP instruction.
But this file "the one which starts with 0x02" works well when loaded into the controller. The character strings used in source code can be seen easily in this file when viewed in UltraEdit and also on two Row LCD. If this is not an Intel hex file, then why this works when loaded into the controller?
The file which starts with 0x02 is a BINARY file. That means that every byte placed in the controller memory is represented by one byte in the file.
Because of this, you will be able to read the LCD text strincs, since every one-byte character printed on the display is a one-byte character in the input fle.
The Intel-hex file stores two characters 00 .. 99, A0 .. FF (in total 255 combinations) for every byte stored of the controller memory. It is also storing address and checksum information.
Because of this, the Intel hex file is more than twice as large than a binary file. And any text strings will not be readable. If you have a LCD string with the character A, the ASCII value of the 'A' character (65) will be stored as the two-character hexadecimal value 41 in the Intel-hex file.
An Intel Hex file must be transmitted to the controller by using a transfer program that specifically processes an Intel Hex file. A binary file must be transmitted to the controller using a transfer program that specifically processes a binary file. If the transfer program only supports one format, or is configured to transfer the wrong format, then the input file (binary or Intel Hex) may be completely correct but the controller will NOT be able to run.
Thanks for the reply! This really helped me to classify two different formats and it also opened different options for me to proceed further. Using uV3 i can generate only Intel Hex File. How can i convert it to Binary file? Can you please elaborate this sentence:- "A binary file must be transmitted to the controller using a transfer program that specifically processes a binary file." Is this something about the programmer which loads Hex file to the controller?
http://www.keil.com/download/list/utility.htm
View all questions in Keil forum