
SP37
Tire Pressure Monitoring Sensor
ROM Library Functions
ROM Library Function Guide
113
Revision 1.0, 2011-12-15
2.34
CRC16_Check()
2.34.1
Description
This function computes a 16-bit CRC of a code block from a start address with a defined length from FLASH, which
includes a pre-computed 16-bit CRC, which is stored in the last 2 Bytes of the memory block ((Sta Length
- 2) is CRC High) and ((Sta Length - 1) is CRC Low).
Note: The pre-computed CRC value has to be written by the application for code blocks in FLASH.
2.34.2
Actions
•
Calculate 16-bit CRC
•
Compare CRC with pre-computed CRC located in the last 2 Bytes of the code block
2.34.3
Prototype
signed char
CRC16_Check
(unsigned char code *
StartAddr
, unsigned int
Length
)
2.34.4
Inputs
2.34.5
Outputs
Table 145
CRC16_Check: Input Parameters
Register / Address
Type
Name
Description
R6 (MSB)
R7 (LSB)
unsigned char
code*
StartAddr
Pointer to first Byte of the Data that is used for
calculating the checksum
R4 (MSB)
R5 (LSB)
unsigned int
Length
Length in Bytes of the code block, including the
pre-computed CRC value, that is used for
calculating the checksum.
Table 146
CRC16_Check: Output values
Register/ Address
Type
Name
Description
R7
signed char
Statusbyte
0: CRC matches
-1: CRC does not match