Supported platforms: CODESYS 3.5 SAFETY
This program is a single-block solution for SL84 unit diagnostics.
Library version 1.4.1.0 and olderLibrary version 1.4.1.0 and older
The program diagnoses:
Reference voltage high and low situations
Unit supply group 1 voltage high and low situations
Microcontroller unit (MCU) and system basis chip (SBC) temperature high and low situations
The program also:
Library version 1.5.2.0 and newerLibrary version 1.5.2.0 and newer
The program diagnoses:
Reference voltage high and low situations
Unit supply group 1 voltage high and low situations
Microcontroller unit (MCU) temperature high and low situations
The program also:
Provides system basis chip (SBC) temperature to application without diagnostics
This program is SL84 specific. Do not use it with any other hardware. |
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_RefControlDiagDelay |
SAFEUINT |
ms |
0 - 100 |
Diagnostic delay for reference voltage diagnostic. |
S_i_TemperatureHighLimit |
SAFEDINT |
°C |
- |
Limit for high temperature diagnosis. |
S_i_TemperatureLowLimit |
SAFEDINT |
°C |
- |
Limit for low temperature diagnosis. |
S_i_TemperatureDiagDelay |
SAFEUINT |
ms |
0 - 10000 |
Diagnostic delay temperature diagnostic. |
The running state, which enables library diagnostics, is set TRUE in following conditions:
The program reads diagnostic task status from the firmware.
The following states are considered as OK when diagnostic is running:
EDiagnosticStatusUndervoltage
External 5 V reference voltage which can be controlled by the application
One measurement channel
The program uses S_RefControlAndDiagnostics (FB) for diagnostic
The program controls the REF output by using SafeSSeriesIoDriverExt library's SystemControl5Vref
Measured AD value is converted to voltage with S_ADCToVoltageOrCurrent (FB)
The voltage is diagnosed to be between given limits
Measured AD value is converted to voltage with S_ADCToVoltageOrCurrent (FB)
No diagnostics, voltage is supplied externally
The program has 2 kind of temperature handling functionality.
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.
One measurement channel
Measured AD value is converted to voltage with S_ADCToVoltageOrCurrent (FB)
Voltage is converted to resistance with S_VoltageToResistance (FB)
Resistance is converted to °C with S_KTYSensor (FUN)
The PCB temperature has no diagnostics
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 request status for reference output. Diagnostic must be in running state before reference can be controller on. |
i_RefChannel1 |
DWORD |
- |
Filtered ADC value for reference output |
i_SupplyVoltageGroup1 |
DWORD |
- |
Filtered ADC value for supply group 1 voltage |
i_SupplyVoltageGroup2 |
DWORD |
- |
Filtered ADC value for supply group 2 voltage |
i_SupplyVoltageGroup3 |
DWORD |
- |
Filtered ADC value for supply group 3 voltage |
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 for PCB temperature channel 1 |
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 |
- |
Status for reference output. See Status structure. |
o_RefControl_EC |
EPEC_DITF.EventCode |
- |
Event code for reference output. |
S_o_RefControl |
SAFEBOOL |
- |
Control state for reference output. |
S_o_RefVoltage |
SAFEDINT |
mV |
Scaled voltage for reference output |
o_SupplyVoltageGroup1Status |
EPEC_SC.Status |
- |
Supply voltage measurement status. |
o_SupplyVoltageGroup1_EC |
EPEC_DITF.EventCode |
- |
Supply voltage measurement event code. |
S_o_SupplyVoltageGroup1 |
SAFEDINT |
mV |
Scaled voltage in supply group 1 |
S_o_SupplyVoltageGroup2 |
SAFEDINT |
mV |
Scaled voltage in supply group 2 |
S_o_SupplyVoltageGroup3 |
SAFEDINT |
mV |
Scaled voltage in supply group 3 |
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. |
o_PCBTemperatureCh1Status |
EPEC_SC.Status |
- |
PCB temperature channel 1 status. |
o_PCBTemperatureCh1_EC |
EPEC_DITF.EventCode |
- |
PCB temperature channel 1 event code. |
S_o_FWDiagnosticTaskStatus |
EPEC_IODRV. DIAGNOSTIC_ TASK_STATUS |
- |
Firmware diagnostic status. See SafeSSeriesIoDrvExt library’s Data Types. |
The program is included in MultiTool Creator code template. |
S_KTYSensor (FUN)
SafeSSeriesIoDriverExt library
Source file topic100621.htm
Last updated 19-Dec-2024