skip navigational linksPJRC
Shopping Cart Download Website
Home Products Teensy Blog Forum
You are here: 8051 Tools PAULMON Monitor Manual Intel-Hex Format

PJRC Store
8051 Board, $79
LCD 128x64 Pixel, $29
LCD 16x2 Char, $14
Serial Cable, $5
9 Volt Power, $6
More Components...
8051 Tools
Main Page
Software
PAULMON Monitor
Development Board
Code Library
89C2051 Programmer
Other Resources

Intel-Hex Data Format

PAULMON2 exchanges data with a PC computer using Intel-Hex format. Ordinarily it is not necessary to know much about Intel-Hex, but in cases where the downloaded data is not written to memory, but the memory appears to work properly with the memory editor, it can be helpful to take a look at the data in Intel-Hex format.

Intel-Hex is an ASCII only format which also includes address and checksum information for each line. Here are three lines of data in Intel-Hex format:

:10202E00216E016A0162215D217F218C017F01C336
:10203E0001260116022940022AAD0172022A9A02D5
:10204E0029D00229D6022A1402287D02284302270B
 ^ ^   ^ ^                               ^
 | |   | |                               |
 | |   | |       checksum----------------+
 | |   | +-------data bytes
 | |   +---------record type (00=data, 01=end of file) 
 | +-------------address for this line of data
 +---------------number of bytes of data in this line
A common problem is incorrect addresses, usually because of a missing or incorrect ORG directive in the assembly language code which was used to produce the Intel-Hex data. In this example, the data is to be stored in memory at the following locations:
Line #1: 16 bytes  @  0x202E to 0x203D  (8238 to 8253)
Line #2: 16 bytes  @  0x203E to 0x204D  (8254 to 8269)
Line #2: 16 bytes  @  0x204E to 0x205D  (8270 to 8285)
Because Intel-Hex is an ASCII only format, it's easy to copy-n-paste into email messages. If you have having trouble getting PAULMON2 to understand your Intel-Hex code, and you decide to send a email asking for help, please include a copy of the Intel-Hex data in question.

Here is some C code which will read/write Intel-Hex format data.

PAULMON2 only understands 16 bit addresses, and only reads intel-hex lines where the "record type" byte is 00 or 01. Other record types are ignored. Record types 02 and 04 are often used for files which must represent more than 64k. Each of these has a 16 bit value in the data field. In each case, the address provided is applied to all the 00 records that follow, until a new 02 or 04 record is found, or the 01 record ends the data.

The 02 record type works the same way as the x86 real-mode 16 bit addressing, where the 16 bit value is multiplied by 16 and added to the address in the normal 00 record type. This segment/offset addressing only allows 1 megabyte of addressable memory.

The 04 record type allows for a 32 bit address, where the 16 bits provided by a previous 04 record are the upper 16 bits, and the normal 00 address is the lower 16 bits.

Again, these 02 and 04 record types are ignored by PAULMON2.

The modified PM2 used in the MP3 Player Project has limited support for these, to allow access to 128k of memory. The project includes a "merge" tool which combines 64k-only intel hex and inserts 02 records to assign certain files to each 64k bank.


PAULMON2 Documentation, Paul Stoffregen
http://www.pjrc.com/tech/8051/pm2_docs/intel-hex.html
Last updated: February 24, 2005
Status: This page is finished
Suggestions, comments, bug reports??? <paul@pjrc.com>