Library for use on MS5803 devices

Dependents:   MS5803-Demo mbed_PI_Depth robfish_pressuresensors_encoderQEI sensor_library_test ... more

Files at this revision

API Documentation at this revision

Comitter:
alex93
Date:
Sun Mar 20 03:05:18 2016 +0000
Parent:
3:77cf75d8a6ce
Commit message:
Test for MS5803 and MS5837 pressure sensors (pressure and temp readings) and QEI testing for encoder.

Changed in this revision

MS5803.cpp Show annotated file Show diff for this revision Revisions of this file
MS5803.h Show annotated file Show diff for this revision Revisions of this file
diff -r 77cf75d8a6ce -r ff505486c804 MS5803.cpp
--- a/MS5803.cpp	Wed Aug 06 17:27:29 2014 +0000
+++ b/MS5803.cpp	Sun Mar 20 03:05:18 2016 +0000
@@ -118,8 +118,10 @@
 
     /* calculation according MS5803-01BA data sheet DA5803-01BA_006 */
     dT       = D2 - (C[5]* 256);
-    OFF      = (int64_t)C[2] * (1<<16) + ((int64_t)dT * (int64_t)C[4]) / (1<<7);
-    SENS     = (int64_t)C[1] * (1<<15) + ((int64_t)dT * (int64_t)C[3]) / (1<<8);
+    OFF      = (int64_t)C[2] * (1<<18) + ((int64_t)dT * (int64_t)C[4]) / (1<<5);
+    SENS     = (int64_t)C[1] * (1<<17) + ((int64_t)dT * (int64_t)C[3]) / (1<<6);
+    //OFF      = (int64_t)C[2] * (1<<16) + ((int64_t)dT * (int64_t)C[4]) / (1<<7);
+    //SENS     = (int64_t)C[1] * (1<<15) + ((int64_t)dT * (int64_t)C[3]) / (1<<8);
 
     temp     = 2000 + (dT * C[6]) / (1<<23);
     T_MS5803 = (float) temp / 100.0f;                 // result of temperature in deg C in this var
diff -r 77cf75d8a6ce -r ff505486c804 MS5803.h
--- a/MS5803.h	Wed Aug 06 17:27:29 2014 +0000
+++ b/MS5803.h	Sun Mar 20 03:05:18 2016 +0000
@@ -45,7 +45,7 @@
 #define ms5803_convD1_2048 0x46 // Convert D1 OSR 2048
 #define ms5803_convD1_4096 0x48 // Convert D1 OSR 2048
 
-#define ms5803_convD1 ms5803_convD1_512 // choose your sampling rate here
+#define ms5803_convD1 ms5803_convD1_4096 // choose your sampling rate here
 
 #define ms5803_convD2_256  0x50 // Convert D2 OSR  256
 #define ms5803_convD2_512  0x52 // Convert D2 OSR  512
@@ -53,7 +53,7 @@
 #define ms5803_convD2_2048 0x56 // Convert D2 OSR 2048
 #define ms5803_convD2_4096 0x58 // Convert D2 OSR 2048
 
-#define ms5803_convD2 ms5803_convD2_512 // choose your sampling rate here
+#define ms5803_convD2 ms5803_convD2_4096 // choose your sampling rate here
 
 #define ms5803_ADCread     0x00 // read ADC command
 #define ms5803_PROMread    0xA0 // read PROM command base address