Pyrometer GY-906 MLX90614

Autoren: Marc Ebmeyer, Prof. Dr.-Ing. Schneider
Simulink Modell

MATLAB Function
function Temp_in_C = Byte2Temp(Data)
% Data: uint8 array, Länge 3: [LSB, MSB, PEC]
% Sicherheitsprüfung: Sind 3 Byte angekommen?
if numel(Data) < 2
Temp_in_C = NaN;
return;
end
LSB = uint16(Data(1));
MSB = uint16(Data(2));
% Little-Endian: LSB first
Rohwert = bitor(bitshift(MSB,8), LSB) % Rohwert = MSB<<8 | LSB
Rohwert = LSB+bitshift(MSB,8); % Rohwert = MSB<<8 | LSB
% Umrechnung in °C
Temp_in_K = double(Rohwert) * 0.02
Temp_in_C = Temp_in_K - 273.15;
end