Supported platforms: CODESYS 3.5, CODESYS 3.5 SAFETY
Purpose of the function block is to handle application parameter save sequence using CANopenSDOClient (FB).
|
For saving display's own parameters, use CANopenODSave library. See also Saving/Restoring Parameters. |
Steps performed depends on i_UseSafetySequence & i_CheckSaveStatus flags.
i_UseSafetySequence shall be set to TRUE when saving safety parameters (safety control unit is authenticated).
i_CheckSaveStatus can be used to read status from OD index 21FAh but it requires support from control unit.
Save status is always checked when using safety sequence.
|
By setting both i_UseSafetySequence and i_CheckSaveStatus to FALSE, the POU can be used for saving parameters in e.g. 3000 or 5000 series control units. |
Save sequence is started when i_Enable is set to TRUE.
Sequence and outputs can be reset by setting i_Enable to FALSE.
|
Safety control unit requires reboot after saving safety parameters. See also How to adjust safety parameters. |
|
Non-safety parameters in a safety control unit can be saved while unit is operational (authentication is not done). In this case i_UseSafetySequence is set to FALSE. |
Input variable name |
Data type |
Range |
Description |
i_Enable |
BOOL |
|
Save sequence is started when TRUE |
i_pDevice |
POINTER TO EPEC_CANopen.Device |
≠ 0 |
Used CANopen device (e.g. ADR(G_CANopen_CAN1.Device)) |
i_NodeID |
BYTE |
1..127 |
Node ID of the control unit |
i_SubIndex |
BYTE |
|
Save method: 1=save all, 2=save communication, 3=save app parameters |
i_Timeout |
TIME |
|
SDO protocol transfer timeout |
i_UseSafetySequence |
BOOL |
|
When TRUE, save is done according to safety control unit sequence |
i_CheckSaveStatus |
BOOL |
|
When TRUE, checks save result after command, always done with safety sequence |
Output variable name |
Data type |
Range |
Description |
o_State |
SaveState |
see enumeration |
"Idle" on initialization, “Processing” while in progress, "SaveOK" when executed successfully, see enumeration for error codes |
o_AbortCode |
DWORD |
|
CANopen SDO abort code |
Following example saves application parameters to single unit (node 1) using safety parameter sequence.
Code template definitions: |
|
/// CAN device Device: EPEC_CANopen.Device; |
|
Definitions: |
|
saveParameters: EPEC_PAR.ParametersSave; state : EPEC_PAR.SaveState; |
|
Init: |
|
saveParameters(i_Enable := FALSE);
|
|
Code: |
|
// Application needs to determine if safety sequence is required // (unit type = safety control unit AND safety parameters authenticated) saveParameters( i_Enable := TRUE, i_pDevice := ADR(G_CANopen_CAN1.Device), // From code template i_NodeID := 1, i_SubIndex := 3, // Save application parameters command i_Timeout := T#1S, i_UseSafetySequence := TRUE, i_CheckSaveStatus := FALSE, o_State => state );
IF state < EPEC_PAR.SaveState.Idle THEN ; // Application error handling, if CRCError is given then safety parameter CRCs are invalid ELSIF state = EPEC_PAR.SaveState.SaveOK THEN ; // save successfull END_IF |
|
|
|
Source file topic100520.htm
Last updated 4-Sep-2025