Jump to content
Sign in to follow this  
Andrew0820

PIC HEX Files

Recommended Posts

I'm trying to decipher the hex files produced by the assembler and provided by many programmers.

Any comments, help or links will be most appreciated. Here is what I have so far.

Byte 1: Number of bytes of op code included in the line

Bytes 2 & 3: Address counter in raw bytes of op code.

Byte 4: ??? -- zero in the files I've seen

Bytes 5 - 20: op codes stored as 2 byte fields in Little Endian format. Clipping the high order nibble will yield a 12 bit code.

What is byte 21 in each line?

Thanks,

andrew

Share this post


Link to post
Share on other sites

Maybe you could download IC-Prog ( http://www.ic-prog.com ). It can open a HEX file and disassemble it. Then you can look at a PIC's datasheet to find the correspondence between instructions and their translations in binary machine code. Maybe that could help you finding your way through the bytes ;)

Share this post


Link to post
Share on other sites

Thanks for the reply. I've already disassembled several HEX files and have determined the OP Code locations -- 2 byte Little Endian with a high order ZERO nibble. The two bytes in the HEX record structure that are not clear are byte 4 and the last byte in each record.

The last byte does not seem to have any particular pattern, unless it is either a parity byte or CRC check. I can do bit counts for parity, but there are several CRC algorithms --

Regards,

andrew

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×