MCP3561/2/4 MCP3564 Click Board

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
SpeedPIC32
Posts: 251
http://meble-kuchenne.info.pl
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Re: MCP3561/2/4 MCP3564 Click Board

Post by SpeedPIC32 »

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
ADC 9 Click 1.fcfx
(14.02 KiB) Downloaded 122 times

SpeedPIC32
Posts: 251
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Re: MCP3561/2/4 MCP3564 Click Board

Post by SpeedPIC32 »

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
compilation_mcp356x.zip
(3.44 MiB) Downloaded 129 times

SpeedPIC32
Posts: 251
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Re: MCP3561/2/4 MCP3564 Click Board

Post by SpeedPIC32 »

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

SpeedPIC32
Posts: 251
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Re: MCP3561/2/4 MCP3564 Click Board

Post by SpeedPIC32 »

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
Attachments
MCP3421.png
MCP3421.png (56.7 KiB) Viewed 3527 times

SpeedPIC32
Posts: 251
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Re: MCP3561/2/4 MCP3564 Click Board

Post by SpeedPIC32 »

Hello

New Version ADC Calculator

Have fun
compilation_24bit.zip
(3.44 MiB) Downloaded 129 times

SpeedPIC32
Posts: 251
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Re: MCP3561/2/4 MCP3564 Click Board

Post by SpeedPIC32 »

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

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: MCP3561/2/4 MCP3564 Click Board

Post by BenR »

Hello,

The datasheet mentions an offset error, maybe this is what you are seeing.
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.
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.

SpeedPIC32
Posts: 251
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Re: MCP3561/2/4 MCP3564 Click Board

Post by SpeedPIC32 »

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

SpeedPIC32
Posts: 251
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Re: MCP3561/2/4 MCP3564 Click Board

Post by SpeedPIC32 »

Hello Ben
Dashboard.png
Dashboard.png (60.62 KiB) Viewed 3442 times


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

SpeedPIC32
Posts: 251
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Re: MCP3561/2/4 MCP3564 Click Board

Post by SpeedPIC32 »

Hello Ben,

Measuring is almost running. :D
+- goes now :D
Calibriren, both ? how must one program that? :roll:
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?
Volt.png
Volt.png (82.12 KiB) Viewed 3430 times
spi.png
spi.png (86.81 KiB) Viewed 3430 times
soft.png
soft.png (205.3 KiB) Viewed 3430 times






with kind regards
SpeedPic32

Post Reply