Supported platforms: CODESYS 3.5 SAFETY

 

SystemParameters (FB)

Description

Function block can be used to collectively read and write system parameters.

All outputs are read only parameters and input variables as read-write parameters.

 

System parameters are automatically read to system info variables when using MultiTool Creator code template (Device > Application > CodeTemplate > Globals > G_SystemInfo).

 

CAN configuration array content. Configuration is defined as array [1..10] OF WORD.

 

Other indices are unused.

 

Limitations

Password protection must be unlocked (see Unlocking SW protection) for parameter saving. This procedure will trigger safe state.

 

Inputs

Input variable name

Data type

Description

i_CAN1

ARRAY [1..10] OF WORD

CAN1 configuration

Outputs

Output variable name

Data type

Description

o_Error

EPEC_SYSTEM.SYSTEM_ERROR_CODES

Refer to SSeriesSystemExt library.

o_DeviceType

DWORD

Data for index 1000h

o_SoftwareVersion

STRING(127)

Data for index 100Ah.  Software version for control unit firmware.

o_VendorId

DWORD

Data for index 1018sub1. Vendor Id.

o_ProductCode

DWORD

Data for index 1018sub2. Product Code.

o_RevisionNumber

DWORD

Data for index 1018sub3. Revision Number.

o_SerialNumber

DWORD

Data for index 1018sub4. Serial number for device.

Actions

Action name

Description

ReadData

Reads all system parameters, which are offered by program, from control unit.

WriteData

Writes all used read/write parameters to control unit and saves them to non-volatile memory.

RestoreDefaultData

Restore default system parameters. These default values are used in next bootup.

After restoring default data, don't call WriteData action before booting, because this causes values in this PRG to be written to non-volatile.

Example code

System parameter data is read automatically in MultiTool Creator code template.

However, if application defines own instance of system parameters FB, ReadData should be executed first to get current values in application's instance.

 

Password in following examples is control unit specific.

 

The following example shows how to read system parameters.

 

Definitions:

 

SystemParameters: EPEC_HW.SystemParameters;

CAN1_Comms: ARRAY[1..10] OF WORD := [10(0)];

 

Code:

 

SystemParameters.ReadData();

CAN1_Comms := SystemParameters.i_CAN1;

 

The following example shows how to change CODESYS node-ID with application code assuming that data is read first as above.

 

Definitions:

 

error_code:EPEC_SYSTEM.SYSTEM_ERROR_CODES;

 

Code:

 

error_code := EPEC_SYSTEM.PasswordUnlock(

i_User := 'User',

i_Password := '1234'

);

 

IF error_code = EPEC_SYSTEM.SYSTEM_ERROR_CODES.FW_ERR_OK THEN

CAN1_Comms[2] := 10;

SystemParameters.i_CAN1 := CAN1_Comms;

SystemParameters.WriteData();

END_IF

 

The following example shows how to restore defaults.

 

Definitions:

 

error_code:EPEC_SYSTEM.SYSTEM_ERROR_CODES;

 

Code:

 

error_code := EPEC_SYSTEM.PasswordUnlock(

i_User := 'User',

i_Password := '1234'

);

 

IF error_code = EPEC_SYSTEM.SYSTEM_ERROR_CODES.FW_ERR_OK THEN

SystemParameters.RestoreDefaultData();

END_IF

 

See also

 

 

Source file topic100542.htm

Last updated 13-Jun-2024