diff --git a/ads1210.cpp b/ads1210.cpp index 233c7b2..f1b342c 100644 --- a/ads1210.cpp +++ b/ads1210.cpp @@ -74,7 +74,7 @@ void ADS1210::exec() { //Serial << "DOR4x8: " << _HEX(res.in[3]) << " " << _HEX(res.in[2]) << " " << _HEX(res.in[1]) << " " << _HEX(res.in[0]) << endl; //Serial << "DOR1x32: " << _HEX(res.out) << endl; - value = res.out; + value = (res.out & V_MASK); u = (((float)value) / ((float)V_MAX)) * U_REF; rRaw = ((((float)V_MAX) / ((float)value)) - 1.0) * R_REF; diff --git a/ads1210.h b/ads1210.h index 8e3bcde..861e20d 100644 --- a/ads1210.h +++ b/ads1210.h @@ -75,6 +75,7 @@ private: const uint32_t V_MAX = 0x3FFFFF; const float R_REF = 3000.0; + const uint32_t V_MASK = 0x3FFFF0; uint8_t m_csPin; uint8_t m_drdyPin;