Supported platforms: CODESYS 3.5, CODESYS 3.5 SAFETY, CODESYS 3.5 SP19 SAFETY
This function calculates response code from challenge code, Epec specific encryption keys, and project specific encrypting key value.
|
This function is intended to be used in device that configures safety unit. E.g. a display unit. |
|
This function is endianness-aware. Separate endian format conversions shall NOT be used. |
The function calculates checksum of i_ProjectKey (STRING) with seed value 245Fh and polynomial 63D9h (prime numbers). The sum is used as seed for checksum calculation of i_ChallengeCode (WORD). The same polynomial is used in both phases.
Input variable name |
Data type |
Range |
Description |
i_ChallengeCode |
WORD |
- |
Challenge code to be compared |
i_ProjectKey |
STRING(80) |
- |
Data for code encryption |
Output variable name |
Data type |
Range |
Description |
o_OutputValid |
BOOL |
TRUE/FALSE |
Calculated value is valid. |
o_ParameterError |
BOOL |
TRUE/FALSE |
Error in input parameters. |
Data type |
Description |
WORD |
Calculated response code. |
Conditions |
Return value |
o_OutputValid |
o_ParameterError |
i_ProjectKey length = 0 |
0 |
FALSE |
TRUE |
i_ProjectKey length > 0 |
Calculated result |
TRUE |
FALSE |
Definitions: |
|
ChallengeCode : WORD := WORD#0; ResponseCode : WORD := WORD#0;
AccessCodeCalculationParError:BOOL; AccessCodeCalculationValid:BOOL;
|
Init: |
|
No init.
|
Code: |
|
ResponseCode := EPEC_SDV.CalculateAccessCode( i_ChallengeCode := ChallengeCode, i_ProjectKey := 'MyProjectKey', o_ParameterError => AccessCodeCalculationParError, o_OutputValid => AccessCodeCalculationValid );
|
Source file topic100399.htm
Last updated 21-Feb-2025