Problems with ADC read out PIC16F18313

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
CSM2711
Posts: 47
Joined: Mon Apr 16, 2018 10:28 am
Location: Germany
Has thanked: 1 time
Been thanked: 9 times
Contact:

Problems with ADC read out PIC16F18313

Post by CSM2711 »

Hello,

i got some strange Problems by using the ADC wit the PIC16F18313.
I write these very simple Program and connect the ADC Chanel3 to vdd.
adc.JPG
adc.JPG (27.55 KiB) Viewed 4801 times
I think the value of ADC_WERT should be 255 and the Port A5 should toggle every 100ms.
But the Por will not toggle and when I Debug the Program using MPLABX an PICKIT3 the value of ADC_WERT is 128.

Has anyone an idea?
Attachments
adc_test.fcfx
(9.75 KiB) Downloaded 202 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Problems with ADC read out PIC16F18313

Post by Benj »

Hello,

It might be worth playing with the slider_plastic1 component properties, specifically the conversion speed setting. You are running at 32MHz with a conversion speed of /2 so this is likely far to fast. Maybe try /16 or /32 instead.

As an unrelated side note your delays will be a bit off because you have entered 30MHz as your Project Options -> Clock speed instead of 32000000.

CSM2711
Posts: 47
Joined: Mon Apr 16, 2018 10:28 am
Location: Germany
Has thanked: 1 time
Been thanked: 9 times
Contact:

Re: Problems with ADC read out PIC16F18313

Post by CSM2711 »

First Thanks for the very very fast replay.
I Try also measure withe FOSC/64 or FOSC/32 but in this case the value ia alway 0
Whe I use FOSC/2 the value is always 128 wit and without vdd on pin3 (AN3).

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Problems with ADC read out PIC16F18313

Post by Benj »

Ok thanks. I'll take a look at the ADC code for the device and make sure this is correct.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Problems with ADC read out PIC16F18313

Post by Benj »

Hello,

I think I've found the problem for you. I've modified the CAL code but can't push it to the update system at the moment as I'm away from my desk.

So for now you can do a manual update if you like or you can wait for the update push, probably tomorrow morning.

Attachments removed!

Reload your Flowcode project and change ADC channel from 3 to 4. Fingers crossed everything should now work as expected.

CSM2711
Posts: 47
Joined: Mon Apr 16, 2018 10:28 am
Location: Germany
Has thanked: 1 time
Been thanked: 9 times
Contact:

Re: Problems with ADC read out PIC16F18313

Post by CSM2711 »

Thanks a lot, but i dont works.
Maybe the problem is that you have change the files for 16F15313 and I use the 16F18313 ?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Problems with ADC read out PIC16F18313

Post by Benj »

Aha, yes indeed that would explain it well spotted.

Attachment removed!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Problems with ADC read out PIC16F18313

Post by Benj »

This fix is now all available via the v8 update system.

CSM2711
Posts: 47
Joined: Mon Apr 16, 2018 10:28 am
Location: Germany
Has thanked: 1 time
Been thanked: 9 times
Contact:

Re: Problems with ADC read out PIC16F18313

Post by CSM2711 »

Is there a way to perform a manual update? Unfortunately, I currently find no updates, I think it's up to our firewall

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Problems with ADC read out PIC16F18313

Post by Benj »

Hello,

If you look here and follow the instructions for the full update then hopefully you will get something.
https://www.matrixtsl.com/wiki/index.ph ... _all_files

Otherwise Flowcode only shows you updated relevant to your project, i.e. definitions and components currently in use in your project.

CSM2711
Posts: 47
Joined: Mon Apr 16, 2018 10:28 am
Location: Germany
Has thanked: 1 time
Been thanked: 9 times
Contact:

Re: Problems with ADC read out PIC16F18313

Post by CSM2711 »

Hello,

actually i have again Problems with the ADC , specialy input A4.
I change the Test prgram by adding a Uart for debug.
The Programm will work fine in simulation, but when I make a Hardware setup the ADC value will always be 255.
Has anyone an Idea ?
Attachments
adc_test.fcfx
(10.87 KiB) Downloaded 182 times

Post Reply