Supported platforms: CODESYS 3.5 SAFETY

 

S_SC52_Diagnostic (PRG)

Description

This program is a single-block solution for SC52 unit diagnostics.

 

Library version 1.4.1.0 and olderLibrary version 1.4.1.0 and older

The program diagnoses:


The program also:

 

 

Library version 1.5.2.0 and newerLibrary version 1.5.2.0 and newer

The program diagnoses:


The program also:

 

 

Limitations

This program is SC52 specific. Do not use it with any other hardware.

 

Initialization

This method is used to initialize the necessary static calculation parameters for the program. The method shall be called at least once before the actual program can be called, i.e. at the application initialization phase.

 

In case of an initialization error, the diagnostic is not run.  

 

The initialization method has no return value.

 

 

Parameter

Data type

Unit

Range

Description

S_i_SupplyVoltageHighLimit

SAFEDINT

mV

> 0

High limit of supply voltage value.

S_i_SupplyVoltageLowLimit

SAFEDINT

mV

>= 0

Low limit of supply voltage value.

S_i_SupplyVoltageDiagDelay

SAFEUINT

ms

0 - 100

Diagnostic delay for supply voltage diagnostic.

S_i_5VRefControlTolerance

SAFEDINT

per mil

0 - 1000

Control tolerance for 5V reference control diagnostic.

S_i_5VRefControlDiagDelay

SAFEUINT

ms

0 - 100

Diagnostic delay for 5V reference voltage diagnostic.

S_i_OutputGroup1HighVoltage

SAFEDINT

mV

-

High voltage limit for output group 1.

S_i_OutputGroup1LowVoltage

SAFEDINT

mV

-

Low voltage limit for output group 1.

S_i_OutputGroup1DiagDelay

SAFEUINT

ms

0 - 100

Diagnostic delay for output group 1.

S_i_5VANHighVoltage

SAFEDINT

mV

-

High voltage limit for AD converter supply voltage.

S_i_5VANLowVoltage

SAFEDINT

mV

-

Low voltage limit for AD converter supply voltage.

S_i_5VANDiagDelay

SAFEUINT

ms

0 - 100

Diagnostic delay  for AD converter supply voltage.

S_i_HighTemperatureLimit

SAFEDINT

°C

-

Limit for high temperature diagnosis.

S_i_LowTemperatureLimit

SAFEDINT

°C

-

Limit for low temperature diagnosis.

S_i_TemperatureDiagDelay

SAFEUINT

ms

0 - 10000

Diagnostic delay temperature diagnostic.

 

 

Operation

The running state, which enables library diagnostics, is set TRUE in the following conditions:

 

FW diagnostic task status

The program reads diagnostic task status from firmware.

 

The following states are considered as OK when diagnostic is running:

 

5 V reference voltage

 

Unit supply voltage

 

AD converter supply voltage (5VAN)

 

Output group control

 

Negative 5V bias voltage

 

Temperature measurements

The program has 2 kinds of temperature handling functionality.

 

MCU and SBC temperatures

MCU and SBC temperatures are already in °C.

 

In library version 1.5.2.0 and newer: MCU temperature is validated against defined limit. SBC temperature is provided to application without diagnostics.

 

In library version 1.4.1.0 and older: MCU and SBC temperatures are validated against defined limit.

 

PCB temperature

 

Inputs

Input variable name

Data type

Unit

Description

i_Reset

BOOL

-

Reset flag disables diagnostic blocks' operation. Error statuses are cleared after falling edge of reset input.

i_RefVoltageControl

BOOL

-

Control output for 5V reference. Diagnostic must be in running state before 5V reference can be controlled on.

i_5VRefChannel1

DWORD

-

Filtered ADC value of voltage measurement for 5V reference output, channel 1.

i_5VRefChannel2

DWORD

-

Filtered ADC value of voltage measurement for 5V reference output, channel 2.

i_SupplyVoltageInPin

DWORD

-

Filtered ADC value of voltage measurement for supply voltage input.

i_OutputGroup1Control

BOOL

-

Status to control safety switch.

i_SupplyBeforeSafetySwitch1

DWORD

-

Filtered ADC value of voltage measurement before safety switch.

i_SupplyAfterSafetySwitch1

DWORD

-

Filtered ADC value of voltage measurement after safety switch.

i_5VANChannel1

DWORD

-

Filtered ADC value of voltage measurement for channel 1 of 5VAN.

i_5VANChannel2

DWORD

-

Filtered ADC value of voltage measurement for channel 2 of 5VAN.

i_MCUTemperature

DINT

0,1 °C

FW provided °C value for MCU temperature.

i_SBCTemperature

DINT

0,1 °C

FW provided °C value for SBC temperature.

i_PCBTemperatureChannel1

DWORD

-

Filtered ADC value of voltage measurement for PCB temperature channel 1.

i_PCBTemperatureChannel2

DWORD

-

Filtered ADC value of voltage measurement for PCB temperature channel 2.

i_Negative5V

DWORD

-

Filtered ADC value of internal -5V bias voltage measurement.

Outputs

Output variable name

Data type

Unit

Description

S_o_InitReady

SAFEBOOL

-

Initialization ready.

o_InitError

BOOL

-

Initialization error.

S_o_Running

SAFEBOOL

-

Diagnostics initialized OK and running. Waits for FW diagnostics to initialize first.

S_o_DiagStatusOk

SAFEBOOL

-

Diagnostic POU combined status.

o_RefControlStatus

Status

-

5V reference voltage output control status. See Status structure.

o_RefControl_EC

EPEC_DITF.EventCode

-

5V reference voltage output control event code.

S_o_RefControl

SAFEBOOL

-

Control status for 5V reference voltage output.

S_o_RefVoltage

SAFEDINT

mV

Scaled and validated 5V reference voltage output.

o_OutputGroup1ControlStatus

Status

-

Output group 1 voltage control status. See Status structure.

o_OutputGroup1Control_EC

EPEC_DITF.EventCode

-

Output group 1 voltage control event code.

S_o_OutputGroup1ControlVoltage

SAFEDINT

mV

Scaled and validated output group 1 voltage.

S_o_OutputGroup1Control

SAFEBOOL

-

Output group 1 control status.

o_SupplyVoltageStatus

EPEC_SC.Status

-

Supply voltage measurement status.

o_SupplyVoltage_EC

EPEC_DITF.EventCode

-

Supply voltage measurement event code.

S_o_SupplyVoltage

SAFEDINT

mV

Scaled and validated supply voltage.

o_5VANToVoltageCh1Status

EPEC_SC.Status

-

5VAN voltage measurement channel 1 status.

o_5VANToVoltageCh2Status

EPEC_SC.Status

-

5VAN voltage measurement channel 2 status.

o_5VANStatus

EPEC_SDV.Status

-

5VAN voltage validation status.

o_5VAN_EC

EPEC_DITF.EventCode

-

5VAN voltage measurement event code.

S_o_5VANVoltage

SAFEDINT

mV

Scaled and validated 5VAN voltage.

o_MCUTemperatureStatus

Status

-

MCU temperature measurement status. See Status structure.

o_MCUTemperatureEC

EPEC_DITF.EventCode

-

MCU temperature measurement event code.

S_o_MCUTemperature

SAFEDINT

0,1°C

Scaled and validated MCU temperature.

o_SBCTemperatureStatus

Status

-

SBC temperature measurement status. See Status structure.

o_SBCTemperatureEC

EPEC_DITF.EventCode

-

SBC temperature event code.

S_o_SBCTemperature

SAFEDINT

0,1°C

Scaled SBC temperature.

S_o_PCBTemperatureChannel1

SAFEDINT

°C

PCB temperature channel 1.

S_o_PCBTemperatureChannel2

SAFEDINT

°C

PCB temperature channel 2.

o_PCBTemperatureCh1Status

EPEC_SC.Status

-

PCB temperature channel 1 status.

o_PCBTemperatureCh2Status

EPEC_SC.Status

-

PCB temperature channel 2 status.

o_PCBTemperatureCh1_EC

EPEC_DITF.EventCode

-

PCB temperature channel 1 event code.

o_PCBTemperatureCh2_EC

EPEC_DITF.EventCode

-

PCB temperature channel 2 event code.

o_Negative5VStatus

Status

-

-5V bias voltage measurement status. See Status structure.

S_o_FWDiagnosticTaskStatus

EPEC_IODRV. DIAGNOSTIC_ TASK_STATUS

 -

Firmware diagnostic status.

See SafeSSeriesIoDrvExt library’s Data Types.

 

Example code

The program is included in MultiTool Creator code template.

 

See also

 

 

Source file topic100540.htm

Last updated 13-Jun-2024