Supported platforms: CODESYS 3.5 SP19 SAFETY
This function converts resistance value to temperature (°C). POU’s operational range is at least from -50 ℃ to 150 ℃. This POU can be used for NTC type temperature sensors.
Function uses beta parameter equation to calculate temperature from resistance value.
, where T25 = 298,15 K and T0 = 273,15 K.
|
Sensor hardware errors are diagnosed with SafeConversion library's function blocks S_ADCToVoltageOrCurrent or S_VoltageToResistance. |
|
Sensor value alarms and warnings are diagnosed with SafeDataValidation library function block S_ValueDiagnostic. |
Input variable name |
Data type |
Unit |
Range |
Description |
S_i_SensorResistance |
SAFEDINT |
mΩ |
>0 |
NTC sensor resistance |
S_i_ResistanceAt25degC |
SAFEUDINT |
mΩ |
- |
Sensor's typical resistance value at 25°C. |
S_i_Beta |
SAFEUDINT |
K |
- |
NTC sensor specific beta constant |
Data type |
Unit |
Range |
Description |
SAFEDINT |
°C |
- |
Measured sensor temperature. |
|
Return value is 150 °C if any of input parameters are zero or below zero. |
|
This example contains the validation of 2 NTC (connected to TI input pin) sensors resistance signals, conversion from resistance to temperature and the diagnostic of temperature value . |
Safe definitions: |
PROGRAM S_TemperatureNTC |
Init at safe PRG: |
IF NOT initDone THEN initDone := TRUE; END_IF |
Code at safe PRG: |
|
See also
How to validate temperature sensors
Source file S_NTCSensor.htm
Last updated 21-Feb-2025