From 70d589da4510c325a74b7a09474362c8ce4231df Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Sun, 16 Nov 2014 18:39:31 +0100 Subject: [PATCH] V_MASK --- ads1210.cpp | 2 +- ads1210.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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;