??? 12/16/07 18:52 Modified: 12/16/07 18:53 Read: times |
#148342 - Maybe an example will help Responding to: ???'s previous message |
Shehryar,
Perhaps a small example will help make this clear. Here is a simple 8051 program: ORG 0 START: MOV A,#12h JMP START ENDLike all good 8051 programs, it starts at address 0 in the code memory space. Here is the output from the assembler: 11 0000 ORG 0 12 0000 START: 13 0000 7412 MOV A,#12h 14 0002 80FC JMP START 15 0004 ENDIt shows that the program consists of four bytes, starting at address zero, and that their values are (in hex) 74, 12, 80, and FC. Now here is the corresponding Intel HEX file: :04000000741280FCFA :00000001FFThis link tells how to decode it: http://www.8052.com/tutintel.phtml Based on the information there, we see that the second line is just an end of file marker. We don't need to worry about it. The first line contains the good stuff, as follows: : 04 00 0000 74 12 80 FC FA | | | ----------- | | | | | +--- The checksum | | | +----------- The four data bytes (they match the assembler output) | | +------------------ Address of the first byte (0000 in our example) | +----------------------- Record type (00 = normal data) +-------------------------- Number of data bytes in this recordSo in the end, your code memory needs to contain four bytes of data: 74h in location 0, 12h in location 1, 80h in location 2, and FCh in location 3. You have to decode the hex file as shown above in order to find out what binary data goes into memory, but once that binary data is in the memory, that's it -- it's ready to execute. -- Russ |