Get_CPU_TempHumid

Overview

The Get_CPU_TempHumid function block retrieves the current temperature and humidity readings from the PLC CPU’s internal sensors.

💡 Why monitor CPU temperature and humidity?

While monitoring CPU temperature and humidity provides valuable insights into the operating conditions of the PLC, the sensor was added with the intention of building an IP66 version of the PLC, which would be suitable for more demanding industrial environments.

Temperature     =>  (REAL)
Humidity        =>  (REAL)

Interface

Inputs

This function block has no inputs.

💡 Internal Monitoring

Excessive temperature or humidity may affect long-term performance and hardware lifespan.

Outputs

NameTypeRange / UnitsDescription
TemperatureREAL-40.0 - 85.0Measured CPU temperature (in °C).
HumidityREAL0.0 - 100.0Measured CPU humidity (in %RH).

Example:

PROGRAM PROG_Get_CPU_TempHumid
    VAR
        CPU_Internal   : Get_CPU_TempHumid;
        CpuTemperature : REAL;
        CpuHumidity    : REAL;
    END_VAR

    (* Read CPU internal data *)
    CPU_Internal();

    (* Copy outputs to local variables (optional) *)
    CpuTemperature := CPU_Internal.Temperature;
    CpuHumidity    := CPU_Internal.Humidity;
END_PROGRAM


CONFIGURATION Config0
    RESOURCE Res0 ON PLC
        TASK task1_100ms(INTERVAL := T#100ms, PRIORITY := 1);
        PROGRAM Prog_Instance_GetCPUTempHumid WITH task1_100ms : PROG_Get_CPU_TempHumid;
    END_RESOURCE
END_CONFIGURATION