Detailed description of S-Record format

Source: Internet
Author: User

// ================================================ ========================================
// Title:
// Detailed description of the record format
// Author:
// Norains
// Date:
// Friday 25-Hangzhou L-2008
// Environment:
// Null
// ================================================ ========================================

A complete Motorola S-record format data contains the following areas:
<Type> <length> <address> <DATA> <checksum>


The meanings of each field are as follows:

<Type>: indicates the record type. This field occupies 1-byte. It can have the following values: "S0", "S1", "S2", "S3", "S5", "S7", "S8", and "S9"

"S0" -- Record description

"S1", "S2", and "S3" -- Record the stored data. The difference between the three is that the address length is different. S1 is 2-byte, S2 is 3-byte, and S3 is 4-byte.

"S5" -- contains information about "S1", "S2", and "S3.

"S7", "S8", and "S9" -- determine the start address of the program. The difference between the three is that the address length is different, S9 is 2-byte, S8 is 3-byte, and S7 is 4-byte.


<Length>: indicates the data length. Specifically, it indicates the number of bytes for the <address>, <data>, and <checksum> fields. This field occupies 1-byte.


<Address>: indicates the start address of Data Writing. The length of this field depends on the value of <type>.


<Data>: indicates the stored data. The number of bytes occupied by this field can be calculated as follows: <length> value-<address> Field length (values: 2, 3, and 4) -1 (<checksum> field length)


<Checksum>: indicates the check bit, which occupies 1-byte. This data can be accumulated by the data of <address> and <data> and obtained from each bit.



Finally, we use a data record format as an example:
S30A801000930300000000CF

S3 is the record format (<type> ).

0A is the length (<length>). It is in hexadecimal format and has 10 bytes. Because the two hexadecimal values are 1-byte, the length of 801000930300000000CF is 10 rather than 20. In other words, this data column should represent 80 10 00 93 00 00 00 CF.

Because the type is S3, the address (<address>) occupies 4-byte, so the address to be written is: 0x80100093.

Since the address is known, the data (<data>) is obviously 0x0300000000.

The last 1-byte is the check bit (<chksum> ). The value of the example is obtained as follows: 0xFF-(0x0A + 0x80 + 0x10 + 0x00 + 0x93 + 0x03 + 0x00 + 0x00 + 0x00 + 0 x 00) & 0xFF)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.