PIC16F1788/9 ADC Resolution

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
simon-sandtcontrols
Posts: 53
http://meble-kuchenne.info.pl
Joined: Sun Mar 21, 2021 3:56 pm
Has thanked: 5 times
Been thanked: 8 times

Flowcode v10 PIC16F1788/9 ADC Resolution

Post by simon-sandtcontrols »

Hi All,

I wonder if you can help, please. I have been working on a project I need a 12bit ADC for. I have chosen the PIC 16F1788 for the job and built the hardware. I have just gone to start programming it and discovered that Flowcode's ADC properties for that IC are showing the ADC resolution is fixed at 10 bit. I have been back to the datasheet and it is quite certain that it has 12Bit ADC's. I have checked the PIC16F1789 and that shows the same.

Is this that Flowcode can't work to 12bit ADC resolution or is it an error in the configuration files for these IC's please?

Many Thanks.

Simon

Steve-Matrix
Matrix Staff
Posts: 1759
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 256 times
Been thanked: 410 times

Re: PIC16F1788/9 ADC Resolution

Post by Steve-Matrix »

Thanks for reporting this. I wonder if it is related to this post:
https://www.flowcode.co.uk/forums/viewtopic.php?t=1505

Anyway, we'll have a look and get this fixed.

simon-sandtcontrols
Posts: 53
Joined: Sun Mar 21, 2021 3:56 pm
Has thanked: 5 times
Been thanked: 8 times

Re: PIC16F1788/9 ADC Resolution

Post by simon-sandtcontrols »

Thanks Steve,

I think it's slightly different symptoms. I can't change the resolution from 10bit in the ADC properties, it's greyed out. I haven't tried simulating it or compiling it.

Simon.

BenR
Matrix Staff
Posts: 2132
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 568 times
Been thanked: 752 times

Re: PIC16F1788/9 ADC Resolution

Post by BenR »

Hi Simon,

Hopefully resolved for you now via the library updates.

Let us know how you're getting on.

simon-sandtcontrols
Posts: 53
Joined: Sun Mar 21, 2021 3:56 pm
Has thanked: 5 times
Been thanked: 8 times

Re: PIC16F1788/9 ADC Resolution

Post by simon-sandtcontrols »

Hi Steve,

I have just done the update, it's now fixed at 12bit resolution, it's fine for what I want, but is that correct it can't be changed between 10 & 12?

I haven't finished the program for it yet. I will update when I load it into the IC.

Thanks.

Simon.

medelec35
Valued Contributor
Posts: 2252
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 692 times
Been thanked: 764 times

Re: PIC16F1788/9 ADC Resolution

Post by medelec35 »

Hello.
No you can't change within properties from 12 to 10bits and vice versa.
What you can do is read as 12 bit and convert to 10bit using calculation or using the Map component Component Libraries > Math
If reading is a bit unstable, you can even use software filters that are also available within Math e.g. rolling filter
Other things to try is set the conversion speed of the ADC to be as slow as possible and increase the Acquisitions Cycle higher than the default value.
I will see if I can find details on that.
One link to try is this
Martin

simon-sandtcontrols
Posts: 53
Joined: Sun Mar 21, 2021 3:56 pm
Has thanked: 5 times
Been thanked: 8 times

Re: PIC16F1788/9 ADC Resolution

Post by simon-sandtcontrols »

Hi Martin,
OK, that makes sense. I wasn't sure as it appeared to be an option in the properties. For what I want fixed at 12 bit is fine. I haven't tried the filters or math function, I usually convert to a lower resolution using a calculation. I will have a play around. Hopefully the input I have will be fairly stable, but that's not always the case.

Thanks for your help with this. I will confirm it works when I load it into a PIC later.

Simon.

Post Reply