Hello Ben
First of all, kudos to you.
I noticed one inconsistency.
If I measure a voltage that is below the reference of 2048 mV, then I am missing digits.
That is, if I apply 1.494 volts to pin0 + and GND to pin 8 with the correct polarity, I get around -1.258535 volts.
Now I reverse the polarity and get e.g. -0.255334Volt.
These are approximately the volts that I was missing before.
Actually, the - sign must be removed from the first measurement.
I have programmed 2 calls of SampleADC with reversed inputs without pause and could almost calculate the applied voltage.
I divided the read-in digits by 4194304 and then added them together.
volt = voltz / 4194304.0
volt1 = voltz / 4194304.0
voltplus = volt + volt1
voltage = floatToString$ (voltplus)
Result -1.483274Volt already better
Also the value for the short-circuit of the inputs went down by one decimal place to 0.000037Volt.
Now comes the fine tuning
Greetings SpeedPic32
MCP3561/2/4 MCP3564 Click Board
-
- Posts: 261
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
-
- Posts: 261
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
Re: MCP3561/2/4 MCP3564 Click Board
Hello Ben
a little software for you
unzip and then start the exe
Calculates the digits for the MCP356x
Have fun with it
If you ever need something like this let me know
Greetings SpeedPic32
a little software for you
unzip and then start the exe
Calculates the digits for the MCP356x
Have fun with it
If you ever need something like this let me know
Greetings SpeedPic32
-
- Posts: 261
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
Re: MCP3561/2/4 MCP3564 Click Board
Hi Ben
can you please check again what is still not quite right?
I use the MCP3421 and it has a similar design. When I swap the inputs, it's actually only the sign that flips.
That means, if I apply 1484mV, I have -1484mV after the swap.
This must also happen with the MCP356x.
Greetings SpeedPic32
can you please check again what is still not quite right?
I use the MCP3421 and it has a similar design. When I swap the inputs, it's actually only the sign that flips.
That means, if I apply 1484mV, I have -1484mV after the swap.
This must also happen with the MCP356x.
Greetings SpeedPic32
-
- Posts: 261
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
Re: MCP3561/2/4 MCP3564 Click Board
Hi Ben
here the calculation MCP3421 18 bit with positive result
a1 = a1 << 6
a1 = a1 >> 6
out = a1 * 65536 + a2 * 256 + a3
number float = (out * 0.015625)
ad1 = floattostring$ (number float)
with negative result
a1 = a1 XOR 3
a2 = a2 XOR 255
a3 = a3 XOR 255
out = (a1 * 65536 + a2 * 256 + a3) + 1
numberfloat = (out * 0.015625)
ad1 = floattostring$ (number float)
Decision
if a1 <= 1 if no Negative number value
Greetings SpeedPic32
here the calculation MCP3421 18 bit with positive result
a1 = a1 << 6
a1 = a1 >> 6
out = a1 * 65536 + a2 * 256 + a3
number float = (out * 0.015625)
ad1 = floattostring$ (number float)
with negative result
a1 = a1 XOR 3
a2 = a2 XOR 255
a3 = a3 XOR 255
out = (a1 * 65536 + a2 * 256 + a3) + 1
numberfloat = (out * 0.015625)
ad1 = floattostring$ (number float)
Decision
if a1 <= 1 if no Negative number value
Greetings SpeedPic32
- Attachments
-
- MCP3421.png (56.7 KiB) Viewed 7603 times
-
- Posts: 261
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
-
- Posts: 261
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
Re: MCP3561/2/4 MCP3564 Click Board
Hello Ben
I wish you a happy new week.
I hope that the error is finally found.
once again as a reminder
The constant minus sign must go away
the measured value is not correct, it is too low
if the applied voltage is reversed in polarity, the value should remain the same and only the minus sign should appear or not.
This may be due to the conversion of the sign bit.
I have not found more errors at the moment.
I have used the first input
applied voltage 1,494V from a battery
with kind regards
SpeedPic32
I wish you a happy new week.
I hope that the error is finally found.
once again as a reminder
The constant minus sign must go away
the measured value is not correct, it is too low
if the applied voltage is reversed in polarity, the value should remain the same and only the minus sign should appear or not.
This may be due to the conversion of the sign bit.
I have not found more errors at the moment.
I have used the first input
applied voltage 1,494V from a battery
with kind regards
SpeedPic32
-
- Matrix Staff
- Posts: 1924
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 501 times
- Been thanked: 684 times
Re: MCP3561/2/4 MCP3564 Click Board
Hello,
The datasheet mentions an offset error, maybe this is what you are seeing.
The datasheet mentions an offset error, maybe this is what you are seeing.
There is an offset calibration register so I've added in a macro to allow you to adjust and calibrate the offset. There is also a gain calibration register so I've added a macro to control this too.4.6 Offset Error
This is the error induced by the ADC when the inputs are shorted together (VIN = 0V). This error varies based on gain settings, OSR settings and from chip to chip. It can easily be calibrated out by an MCU with a subtraction.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 261
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
Re: MCP3561/2/4 MCP3564 Click Board
Hi Ben
Can you provide me with your trial version?
I get only negative values e.g. -2456727
No matter what I set or how I measure or what voltage I apply.
Can you provide me with the 3 single output bytes.
I have understood the OffsetCalibration like this
that a register is set to 1 and the ADC for independently the adjustment by. 5.1.3
How does it work with you?
Thanks already
Can you provide me with your trial version?
I get only negative values e.g. -2456727
No matter what I set or how I measure or what voltage I apply.
Can you provide me with the 3 single output bytes.
I have understood the OffsetCalibration like this
that a register is set to 1 and the ADC for independently the adjustment by. 5.1.3
How does it work with you?
Thanks already
-
- Posts: 261
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
Re: MCP3561/2/4 MCP3564 Click Board
Hello Ben
Question:
What about channel 5? Why is it different?
What does the other module above?
I have only introduced the ADC_MCP356X1.
Is there also something of it in the software.
Don't you have time to test your work?
no desire to do so I can already understand!!
Greeting SpeedPic32
Question:
What about channel 5? Why is it different?
What does the other module above?
I have only introduced the ADC_MCP356X1.
Is there also something of it in the software.
Don't you have time to test your work?
no desire to do so I can already understand!!
Greeting SpeedPic32
-
- Posts: 261
- Joined: Thu Dec 10, 2020 2:35 pm
- Has thanked: 36 times
- Been thanked: 17 times
Re: MCP3561/2/4 MCP3564 Click Board
Hello Ben,
Measuring is almost running.
+- goes now
Calibriren, both ? how must one program that?
Oversambling makes problems
the faster you measure the less values work.
depending on the choice the measurement runs or hangs
Example every 10ms a measurement with oversampling
32 does not work
64 does not work long, sometimes up to 10 times
128 works
256 works
512 goes
1024 does not work
etc does not work
I have recorded the spi transmission.
is there a constant query whether the AD conversion is ready?
that also changes with the oversambling value
with Ov 32 I have less queries than e.g. Ov 256
does this have to be?
with kind regards
SpeedPic32
Measuring is almost running.

+- goes now

Calibriren, both ? how must one program that?

Oversambling makes problems

the faster you measure the less values work.
depending on the choice the measurement runs or hangs
Example every 10ms a measurement with oversampling
32 does not work
64 does not work long, sometimes up to 10 times
128 works
256 works
512 goes
1024 does not work
etc does not work
I have recorded the spi transmission.
is there a constant query whether the AD conversion is ready?
that also changes with the oversambling value
with Ov 32 I have less queries than e.g. Ov 256
does this have to be?
with kind regards
SpeedPic32