Melexis MLX90614 IR Thermometer

ThomasW69
 
Avatar
 
Subject:

Melexis MLX90614 IR Thermometer

 · 
Posted: 21.01.2010 - 14:15  ·  #1
Her is a sample code to read values from the Melexis MLX90614 I²C IR Thermometer. This thermometer is also available with 2 sensing areas and so the code reads 2 temperature values.

Datasheet

Code

const
  MLXTWIAddr     : byte      = $5A;  // Melexis MLX90614

  //MLX internal Adresses
  MLX_RAM        : byte      = $00;  //RAM Area
  MLX_ROM        : byte      = $20;  //ROM Area
  MLX_FLAGS      : byte      = $F0;  //READ Flags
  MLX_SLEEP      : byte      = $FF;  //Enter Sleep mode

  MLX_TA         : byte      = $06;  //Ambient Temperature 
  MLX_TObj1      : byte      = $07;  //Object-Temperature1
  MLX_TObj2      : byte      = $08;  //Object-Temperature2

var 
   AmbTemp: float;
   ObjTemp1: float;
   ObjTemp2: float;


procedure ReadMLX;
var Data : array[0..2] of Byte;
  raw            : word;
  PEC            : Byte;
begin
  if TWIstat(MLXTWIAddr) then
    mdelay(50);
    bool:= TWIOut(MLXTWIAddr, MLX_TA);                 // set read pointer to 6
    bool:= TWIInp(MLXTWIAddr, Data);
    if bool then
      //Ambient-Temperature
      HI(raw):= Data[1];
      LO(raw):= Data[0];
      PEC:= Data[2];
      AmbTemp:= float(raw)*0.02 - 273.15;
    endif;

    bool:= TWIOut(MLXTWIAddr, MLX_TObj1);                 // set read pointer to 6
    bool:= TWIInp(MLXTWIAddr, Data);
    if bool then
      //Object Temperature 1
      HI(raw):= Data[1];
      LO(raw):= Data[0];
      PEC:= Data[2];
      ObjTemp1:= float(raw)*0.02 - 273.15;
    endif;

    bool:= TWIOut(MLXTWIAddr, MLX_TObj2);                 // set read pointer to 6
    bool:= TWIInp(MLXTWIAddr, Data);
    if bool then
      //Object Temperature 2
      HI(raw):= Data[1];
      LO(raw):= Data[0];
      PEC:= Data[2];
      ObjTemp2:= float(raw)*0.02 - 273.15;
    endif;

  endif;
end;


jerich
Neuling
Avatar
Gender: n/a
Age: 66
Posts: 1
Registered: 03 / 2021
Subject:

Re: Melexis MLX90614 IR Thermometer

 · 
Posted: 01.04.2022 - 10:25  ·  #2
Hallo Thomas , hat der Code funktioniert?

Ich habe das auf Software I2C umgesetzt jedoch leider keinen Erfolg.

zB TWIstat durch I2Cstat


Liebe Grüße Jürgen
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   50   64 · Page-Gen-Time: 0.024647s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI