Intel HEX File Format
来源:互联网 发布:大数据实验室fiberto 编辑:程序博客网 时间:2024/06/02 03:55
The "Intel-Standard" HEX file is one of the most popular and commonly used formats in the8052 world. The standard is used to burn the 8052 program into an EPROM, PROM, etc. Forexample, an 8052 assembler will usually generate an Intel Standard HEX file which canthen be loaded into an EPROM programmer and burned into the chip.
An Intel Standard HEX file is an ASCII file with one "record" per line. Each line hasthe following format:
PositionDescription1Record Marker: The first character of the line is always a colon (ASCII 0x3A) to identify the line as an Intel HEX file2 - 3Record Length: This field contains the number of data bytes in the register represented as a 2-digit hexidecimal number. This is the total number of data bytes, not including the checksum byte nor the first 9 characters of the line.4 - 7Address: This field contains the address where the data should be loaded into the chip. This is a value from 0 to 65,535 represented as a 4-digit hexidecimal value.8 - 9Record Type: This field indicates the type of record for this line. The possible values are: 00=Register contains normal data. 01=End of File. 02=Extended address.10 - ?Data Bytes: The following bytes are the actual data that will be burned into the EPROM. The data is represented as 2-digit hexidecimal values.Last 2 charactersChecksum: The last two characters of the line are a checksum for the line. The checksum value is calculated by taking the two's complement of the sum of all the preceeding data bytes, excluding the checksum byte itself and the colon at the beginning of the line.
Calculating the Checksum
As mentioned in the format table above, the last two characters represent a checksum ofthe data in the line. Since the checksum is a two-digit hexidecimal value, it may represent a value of 0 to 255, inclusive.
The checksum is calculated by summing the value of the data on the line, excluding theleading colon and checksum byte itself, and taking its two's complement. For example, theline:
- :0300300002337A1E
Breaking this line into it's components we have:
- Record Length: 03 (3 bytes of data)
Address: 0030 (the 3 bytes will be stored at 0030, 0031, and 0032)
Record Type: 00 (normal data)
Data: 02, 33, 7A
Checksum: 1E
Taking all the data bytes above, we have to calculate the checksum based on the followinghexidecimal values:
- 03 + 00 + 30 + 00 + 02 + 33 + 7A = E2
The two's complement of E2 is 1E which is, as you can, the checksum value.
For those unfamiliar with calculating a two's complement, it's quite simple: The two'scomplement of a number if the value which must be added to the number to reach the value256 (decimal). That is to say, E2 + 1E = 100.
You may also calculate the two's complement by subtracting the value from 100h. In otherwords, 100h - E2h = 1Eh -- which is the checksum.
If the value in question is greater than FFh, simply take the part which is less than 100h.For example, if you want the two's complement of the value 494h, simply drop the leading"4" which leaves you with 94h. The two's complement of 94h is 6Ch.
- Intel HEX File Format
- Intel HEX format
- intel hex
- Intel HEX文件格式
- S-Records & Intel-HEX
- 什么是Intel HEX文件格式?
- 什么是Intel HEX文件格式?
- Intel HEX文件格式分析
- Intel HEX文件格式
- Intel HEX文件格式
- Intel hex 文件格式
- Intel Hex文件格式说明
- Intel HEX格式
- Intel Hex 文件分析
- Intel HEX 格式解析
- Intel HEX格式文件说明
- Intel Hex文件格式说明
- Intel Hex文件格式
- SecureCRT 使用指南
- 配置web.config连接数据库
- Hive随谈(五):Hive优化
- 限制HTML的input只能输入数字、英文、汉字...
- linux 日志
- Intel HEX File Format
- 动画效果打开层 关闭层
- 多重背包
- Linux的read/write、fread/fwrite、open/fopen区别
- usaco /money
- 华为面试题,对于大整数的计算问题
- Shrink O’Matic:好用的图片大小调整工具
- otproject安装配置
- [转]The Big List of JavaScript, CSS, and HTML Development Tools, Libraries, Projects, and Books