HCA0811AR I²C Air Pressure Sensor

ThomasW69
 
Avatar
 
Subject:

HCA0811AR I²C Air Pressure Sensor

 · 
Posted: 21.01.2010 - 14:04  ·  #1
Here is the code to read a Sensortechnics HCA-Baro air pressure sensor.
Manual

Code

const
 HCATWIAddr : byte =$F8;
 HCASens :float=87.38; //HCA800
//HCASens :float=52.428;  //HCA600
 HCAMin :float= 800; //HCA800
//HCAMin :float= 600; //HCA600

Function ReadHCA:float;
var Data :array[0..1] of byte;
    raw: word;  //Raw Value
    res:float;
begin
 res:=0;
 if TWIstat(HCATWIAddr) then
  bool:= TWIinp(HCATWIAddr, Data);
   if bool then
     HI(raw):=Data[0];
     LO(raw):=Data[1];
     raw:=raw and $7FFF;    //Mask out Bit 15
     res:= (float(raw)-1638.0)/HCASens +HCAMin; 
   endif;
 endif;
 return(res);
end;

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: 13   36   49 · Page-Gen-Time: 0.032401s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI