Hi All
I have connected an MCP 3424 I2C module to an UNO. I can read all 4 channels well enough, so the i2c and power connections are good.
The issue I am facing is that when I reverse the polarity of my test-source, I get really strange results. I am using the device in Differential mode, and my test source for measurements is an AA battery, nominally 1.5V
The output, shown below, is of channel 2 at different resolutions. The first block is with the AA battery connected +-to-+ and neg-to-neg.
The second block shows the result with the battery connected +-to-neg and neg-to-+ .... I expected the output to show the correct voltage, but with sign negative.
As can be seen, the numbers are meaningless (to me, at least) ... another oddity is the result of the conversion at 14 bits resolution is 'out-of-whack" with the others.
I would greatly appreciate any and all assistance
#include <MCP3424.h>
#include <Wire.h>
MCP3424 MCP(0x6e); // MCP3424 Adress
long startmillis, endmillis = 0;
long Voltage[4]; // Array used to store results
int NumBits = 12;
void setup() {
Serial.begin(115200);
MCP.begin(0);
Serial.println("");
}
void loop() {
Serial.print(NumBits);
Serial.print(" bits ");
for (int i = 2; i <= 2; i++) { // looks odd, but just to test 1 channel
startmillis = millis();
MCP.configuration(i, NumBits, 1, 1);
//channel i with Numbits resolution, continous mode and gain 1
Voltage[i - 1] = MCP.measure();
endmillis = millis();
Serial.print("Channel ");
Serial.print(i);
Serial.print(" : ");
float result = Voltage[i - 1];
result /= 1000.0;
result /= 1000.0;
Serial.print(result, 6); // comment out this or the next
//Serial.print(Voltage[i - 1]); // line for read-ability
Serial.print(" V");
Serial.print(", Time= ");
Serial.println(endmillis - startmillis);
}
NumBits += 2;
if (NumBits >= 19) {
while (1); // just loop once for now
NumBits = 12;
}
}
12 bits Channel 2 : 1.342000 V, Time= 5
14 bits Channel 2 : 1.341750 V, Time= 16
16 bits Channel 2 : 1.341750 V, Time= 64
18 bits Channel 2 : 1.341750 V, Time= 253
12 bits Channel 2 : -2147.483642 V, Time= 5
14 bits Channel 2 : 10.946250 V, Time= 16
16 bits Channel 2 : -2147.483642 V, Time= 65
18 bits Channel 2 : -2147.483642 V, Time= 253
