Datasheet

ICP-10111
Document Number: DS-000177 Page 20 of 31
Revision: 1.3
""" Convert an output from a calibrated sensor to a pressure in Pa.
Arguments:
p_LSB -- Raw pressure data from sensor
T_LSB -- Raw temperature data from sensor
"""
t = T_LSB - 32768.0
s1 = self.LUT_lower + float(self.sensor_constants[0] * t * t) * self.quadr_factor
s2 = self.offst_factor * self.sensor_constants[3] + float(self.sensor_constants[1] * t * t) * self.quadr_factor
s3 = self.LUT_upper + float(self.sensor_constants[2] * t * t) * self.quadr_factor
A, B, C = self.calculate_conversion_constants(self.p_Pa_calib, [s1, s2, s3])
return A + B / (C + p_LSB)
[end of the pseudocode]
5.13 SAMPLE CODE: USING CONVERSION FORMULA (EXAMPLE PYTHON SYNTAX)
def read_otp_from_i2c():
# TODO: implement read from I2C
# refer to data sheet for I2C commands to read OTP
return 1000, 2000, 3000, 4000
def read_raw_pressure_temp_from_i2c():
# TODO: implement read from I2C
# refer to data sheet for I2C commands to read pressure and temperature
return 8000000, 32000
# Sample code to read
from Invensense_pressure_conversion import Invensense_pressure_conversion
# -- initialization
c1, c2, c3, c4 = read_otp_from_i2c()
conversion = Invensense_pressure_conversion([c1, c2, c3, c4])
# -- read raw pressure and temp data, calculate pressure
p, T = read_raw_pressure_temp_from_i2c()
pressure = conversion.get_pressure(p, T)
print 'Pressure: %f' % pressure
[end of the pseudocode]
5.14 COMMUNICATION DATA SEQUENCES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
S
ACK
ACK
ACK
P
ICP-10111 measuring
1
1
0
0
0
1
1
0
0
1
0
1
0
0
0
0
0
1
0
1
1
0
0
1
I
2
C address + write
Measurement command
MSB
Measurement command
LSB
Measurement in progress