PIC18f26k80 Analog

Moderator: Benj

alanwms
Posts: 43
Joined: Tue Sep 16, 2008 2:09 pm
Location: Minnesota USA
Has thanked: 2 times
Been thanked: 16 times
Contact:

PIC18f26k80 Analog

Postby alanwms » Tue Jan 19, 2016 4:15 am

I have the 18f26k80 connected and running a serial display. I'm reading AN0 on pin 2 of the chip. My meter reads from 0 to 5 volts. The display show 4095 (full bore) and does not change. This pic chip has configuration bits for differential analog inputs, and I suspect that these bits are not set properly. My input is referenced to ground.
Can you set me straight on the config bits or give me some hints? Here are a few jpegs for reference:
flowcode.jpg
flowcode.jpg (178.53 KiB) Viewed 5083 times

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

Re: PIC18f26k80 Analog

Postby Benj » Tue Jan 19, 2016 11:47 am

Hello,

Please can you post your program so we can look at your config bits?

alanwms
Posts: 43
Joined: Tue Sep 16, 2008 2:09 pm
Location: Minnesota USA
Has thanked: 2 times
Been thanked: 16 times
Contact:

Re: PIC18f26k80 Analog

Postby alanwms » Tue Jan 19, 2016 3:45 pm

Gauge Array Test.fcf
(19.98 KiB) Downloaded 279 times


FLOWCODE 5
These users thanked the author alanwms for the post:
Benj (Wed Jan 20, 2016 7:03 pm)
Rating: 5.88%
 

alanwms
Posts: 43
Joined: Tue Sep 16, 2008 2:09 pm
Location: Minnesota USA
Has thanked: 2 times
Been thanked: 16 times
Contact:

Re: PIC18f26k80 Analog

Postby alanwms » Thu Jan 28, 2016 4:34 pm

Not sure how this forum works - Is anyone looking at the detail I sent for review?

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

Re: PIC18f26k80 Analog

Postby Benj » Mon Feb 01, 2016 4:47 pm

Hello Alan,

Sorry I saw your reply but then got distracted onto other things.

From your config settings I would advise the following.

Extended Instruction Set - Disable

Everything else looks ok.

Let us know how your getting on, it could be there is a bug in the ADC CAL for that chip which has been fixed in v6 buts needs rolling back to v5.

alanwms
Posts: 43
Joined: Tue Sep 16, 2008 2:09 pm
Location: Minnesota USA
Has thanked: 2 times
Been thanked: 16 times
Contact:

Re: PIC18f26k80 Analog

Postby alanwms » Fri Feb 05, 2016 6:47 pm

I had set the extended instruction set to enable in an effort to resolve the analog issue. What I'm saying is that the problem persists either/or extended instruction set enabled or disabled.

Any time line on having this resolved?

User avatar
LeighM
Matrix Staff
Posts: 1696
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 405 times
Been thanked: 560 times
Contact:

Re: PIC18f26k80 Analog

Postby LeighM » Tue Feb 09, 2016 11:46 am

Hi
Could you try changing the Conversion Speed and Acquisition time (in the ADC component Ext Properties)?

alanwms
Posts: 43
Joined: Tue Sep 16, 2008 2:09 pm
Location: Minnesota USA
Has thanked: 2 times
Been thanked: 16 times
Contact:

Re: PIC18f26k80 Analog

Postby alanwms » Tue Feb 09, 2016 3:50 pm

I made a few changes and empirically ended up with Fosc/4 and 6 cycles acquisition time. Certainly got my analog acting more realistic.
If you wouldn't mind detailing me about the values - Is it more beneficial to be slower?

Thanks much - I can take it from here. :D
These users thanked the author alanwms for the post (total 2):
Benj (Tue Feb 09, 2016 6:23 pm) • LeighM (Wed Feb 10, 2016 9:30 am)
Rating: 11.76%
 

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

Re: PIC18f26k80 Analog

Postby Benj » Tue Feb 09, 2016 6:22 pm

Hello,

Acquisition time specifies how long to change up the ADC conversion capacitor, the longer the cap has to charge the closer it will be to a stable DC signal. However if too long then you will start to miss things such as spikes in the signal.

The Conversion speed specifies how fast to do the conversion from the voltage on the ADC capacitor to the digital representation. The faster you do the conversion the less accurate it will be and the more noise will creep in.

So speed vs accuracy is a fairly open ended discussion and in most cases needs to be tailored to the specifics you require to get the best result.
These users thanked the author Benj for the post:
alanwms (Thu Feb 11, 2016 12:00 am)
Rating: 5.88%