I've been utilizing an MS4525 pressure sensor over I2C and had a lot of problems reading the 11 bit Temperature contained in the last 2 bytes of a 4 byte read. It seemingly worked, but would become erratic at certain temps. I finally discovered it was due to all the other code examples on here not masking some of the bits. Here's the solution if anyone is interested:
Temp_H is the High byte and Temp_L is the low byte.
@gilshultz - I was succint because I was merely correcting what was already posted in other places I don't want people having to dig through my code to find a solution since it is already posted, albeit with the missing bit mask on the Temp. I write in micropython and have adapted the code to my case. The only two code bases I found online regarding this sensor was an .ino sketch which I ported over but the temp was erratic. I then came across the following c++ repository here: bolderflight repository which mentioned the bit mask. I never wrote an Arduino script with the mask so I have nothing to post really. Just hoping this find can help others.
Wawa - There are many versions of this sensor. The datasheet for the version I am using is HERE It is the I2C version.
JCA34F - I purposely only put the main part of the part number to keep things simple. I've now added the exact datasheet for the part I'm using. Hopefully people find all of these resources helpful. @JohnRob - I did look there. Those posts are ALL missing the & 0xE0 bit mask which prevents the erratic behavior I was encountering. Hence why I'm posting this. Those discussions are closed already otherwise I would have replied to them with the solution.