Is it possible to calibrate ADC?

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Sergejs
Posts: 149
http://meble-kuchenne.info.pl
Joined: Tue Oct 19, 2021 9:31 am
Has thanked: 75 times
Been thanked: 5 times

Is it possible to calibrate ADC?

Post by Sergejs »

My MCU PIC16F883 ADC get wrong result. About 10% wrong. Can I calibrate it in Flowcode V9?

medelec35
Matrix Staff
Posts: 1956
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 626 times
Been thanked: 657 times

Re: Is it possible to calibrate ADC?

Post by medelec35 »

If you are using GetVoltage macro then you can adjust the voltage result by changing VRef within properties.
Otherwide you can use the Map function to produce the desired calibrated result for byte or int.
Martin

Sergejs
Posts: 149
Joined: Tue Oct 19, 2021 9:31 am
Has thanked: 75 times
Been thanked: 5 times

Re: Is it possible to calibrate ADC?

Post by Sergejs »

Problem resolved with crystal at 20 mHz. I use internal oscillator before. But when I put crystal resonator ADC works properly. Thanks for all.

medelec35
Matrix Staff
Posts: 1956
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 626 times
Been thanked: 657 times

Re: Is it possible to calibrate ADC?

Post by medelec35 »

It could be that you had the wrong selection of conversion speed for the microcontroller clock speed.
If not sure what conversion speed to use, just select the highest and work your way down.
I generally leave it on the highest myself.
Martin

Xbiotec
Posts: 206
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 33 times
Been thanked: 25 times

Re: Is it possible to calibrate ADC?

Post by Xbiotec »

medelec35 wrote:
Wed Sep 25, 2024 4:39 pm
If you are using GetVoltage macro then you can adjust the voltage result by changing VRef within properties.
Otherwide you can use the Map function to produce the desired calibrated result for byte or int.
Hi what do you mean by MAP function?
Seb

medelec35
Matrix Staff
Posts: 1956
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 626 times
Been thanked: 657 times

Re: Is it possible to calibrate ADC?

Post by medelec35 »

You can use the Map component to change the input range for bytes or int variables to give the desired output.
For example:
from input of 0 - 1023 to output 0 - 1000
Therefore, when the ADC = 1023 the value will convert to 1000
The map component can be found in the Math section of the component library.
If you right-click on the component and select Help, it will take you to the Flowcode Wiki site, where you can download an example.
Martin

Xbiotec
Posts: 206
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 33 times
Been thanked: 25 times

Re: Is it possible to calibrate ADC?

Post by Xbiotec »

thx
Seb

Post Reply