Project help !

I am trying to read the readings from the pressure sensor.I have three bytes wihch compromise the reading.Whole number part of the reading compromises of the 18 bits in total(MSB + CSB + 6th and 7th bit of LSB), where as fractinal partof the reading comprises of the 4h and 5th bit of the LSB.
I have made this solution to fetch the final reading using these bytes.
float Calculate_pressure(){
unsigned long m_pressure = I2Cdata[0];
unsigned long c_pressure = I2Cdata[1];
unsigned long l_pressure = (I2Cdata[2]>>4)/4;

Here I2Cdata[0],I2Cdata[1] and I2Cdata[2] are MSB,CSB and LSB respectively.

Is this algorithm is correct ? ?

Hello and welcome,

Post a link to the datasheet of your sensor

here is the datasheet link

I don’t thing that is an algorithm. Maybe a procedure.
m_pressure=m_presssure<<!2; Typo?
You really need some white space between the "l"s and the "|"s.

unsigned long l_pressure = (I2Cdata[2]>>4)/4;

is the same as:

unsigned long l_pressure = I2Cdata[2]>>6;


unsigned long l_pressure = I2Cdata[2]/64;

Try this library:

Yeah, there was a typing error there. :) And that dividing by 4 thing was explicitly shown as it accounts for the resolution.