The CRC calculation is used for error detection at data transmission. The result of a calculation returns a CRC value via the data sent. The receiver detects a faulty transmission due to the unequal CRC value. The function LGF_CalcCRC32Advanced
uses 32 bits as the generator polynomial (mask) and the parameters finalXorValue
, reflectInput
, and reflectResult
.
LGF_CalcCRC32Advanced (FC) | ||||||||
---|---|---|---|---|---|---|---|---|
DWord | initValue | Ret_Val | DWord | |||||
DWord | mask | |||||||
DWord | finalXorValue | |||||||
Bool | reflectInput | |||||||
Bool | reflectResult | |||||||
Array[*] of Byte | array | Array[*] of Byte | ||||||
Identifier | Data type | Description |
---|---|---|
initValue | DWord | Start value with which the calculation is executed. If there is no need for start value - assign 16#00 |
mask | DWord | Generator polynomial with which the calculation is executed. (Mask / CRC polynomial) |
finalXorValue | DWord | Value with which another XOR operation is performed at the end |
reflectInput | Bool | TRUE: the sequence of the bits within the input byte is mirrored. The sequence 0...7 becomes 7...0. |
reflectResult | Bool | TRUE: the order of the bits within the result is mirrored. The sequence 0...7 becomes 7...0. |
Identifier | Data type | Description |
---|---|---|
Ret_Val | DWord | Calculated CRC value (return value of the function). |
Identifier | Data type | Description |
---|---|---|
array | Array[*] of Byte | Data stream for which the CRC value will be calculated. |
The function calculates the CRC value from a data stream of any size. The data stream is composed of the individual elements of the array at the input/output parameter array
. The start value initValue
and the generator polynomial mask
can be freely selected.
Via the Boolean input parameters reflectInput
and reflectResult
, you may optionally mirror the bits of the input data or the CRC value. An XOR operation is also performed with the CRC value at the end and the value finalXorValue
.
mask
(Polynomial) and initValue
(Initial Value):Version & Date | Change description | |
---|---|---|
01.00.00 | Siemens Industry Online Support | |
03.07.2018 | First released version | |
01.00.01 | Siemens Industry Online Support | |
17.08.2018 | Upgrade: TIA V15 Update 2 | |
01.00.02 | Siemens Industry Online Support | |
23.11.2018 | Upgrade: TIA V15.1 | |
01.00.03 | Simatic Systems Support | |
09.10.2019 | Code refactoring, comments added | |
03.00.00 | Simatic Systems Support | |
23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library | |
03.00.01 | Simatic Systems Support | |
12.11.2020 | Insert documentation Assign default start values to optional inputs - `initValue`, `mask`, `finalXorValue`, `reflectInput`, `reflectResult` |