Microchip INHX8M HEX-record Format

INTRODUCTION
This is Microchip Technology's adaptation of Intel's 8-bit Hex-record format. Obviously an 8-bit data record will not work for PIC processors that use 12, 14, and 16 bit data. Microchip uses two bytes (Low/High) for each data word, which allows the INHX8M format to represent data up to 16-bits. Because this is an 8-bit format each address can only hold one byte so the addresses are doubled. Thus the INHX8M bytes at 0200 and 0201 are actually the PIC word at 0100. Because the addresses are doubled the 64 kbyte address field can only be used for PIC processors with an address space of 32 kwords or less. For PIC processors with an address space > 32 kwords the INHX32 format is used. An individual INHX8M record is a single line in a file composed of many INHX8M records.

INH8M RECORD CONTENT
INHX8M records are ASCII character strings made of several fields which specify the record type, record length, memory address, data, and checksum.

The 6 fields which comprise an INHX8M record are defined as follows:
Field Characters Description
1 Start code 1 An ASCII colon, ":".
2 Byte count 2 The count of ASCII character pairs (bytes) in the data field. The number of data words is half the byte count.
3 Address 4 Two times the 2-byte address of the first data word in the record.
4 Type 2 00, 01, 04.
5 Data 0-2n Each data word is two bytes, in Low/High format, represented as four ASCII characters.
6 Checksum 2 The least significant byte of the two's complement sum of the values represented by all the pairs of characters (bytes) in the record except the start code and checksum.

Each record may be terminated with a CR/LF/NULL. Accuracy of transmission is ensured by the byte count and checksum fields.

HEX-RECORD TYPES
There are three possible types of Hex-records.
00 A record containing data and the 2-byte address at which the data is to reside.
01 A termination record for a file of INHX8M records. Only one termination record is allowed per file and it must be the last line of the file. There is no data field.
04 Extended linear address record, used in the INHX32 format. The address field is zero. The data field comprises the high 16 bits of a 32 bit address.

INHX8M RECORD EXAMPLE
Following is a simple INHX8M record module consisting of one data record and a termination record.

    :100042006801A9018901EA01280208026A02BF02C5
    :00000001FF

The data record is explained as follows:
    :     Start code.

    10    0x10 (decimal 16), indicating 16 data character pairs,
          16 bytes of binary data, or 8 words of binary data in this record.

    00    Four-character 2-byte address field, 0x0042.
    42    The actual address in the PIC device is 0x0021.

    00    Record type indicating a data record.

    68    Four-character 2-byte data word in Low/High format.
    01    The data at PIC address 0x0021 is 0x0168.
     
The next 14 character pairs are the remaining 7 data words.

    C5    Checksum of the data record.


The termination record is explained as follows:
    :     Start code.

    00    Byte count is zero, no data in termination record.

    00    Four-character 2-byte address field, zeros.
    00

    01    Record type 01 is termination.

    FF    Checksum of termination record.

[ Back to Data & Documentation ] [ Home ]