Page 1 of 1

Analog value too high

Posted: Mon Aug 07, 2023 7:42 pm
by henker
For years I have been using the PIC 18F4685 for our equipment. Never had any issues however recently I had to use a PIC 18F4682 as the 5 was not available.
Everything seemed to be working normal until I realized that all the Analog values are a bit too high.
When applying a clean 2.5V on the an analog input, I ready a value of 522 / 523.
When I change the uP to a 4685 on the same PCB, it does ready the correct value of 512...
I have checked the data sheet but can't find any difference between the 2 uP's other then the memory size...
I'm using the VDD as the ref which is exactly 5V.
Not sure if this is a FC issue or a hardware problem...
Thanks
Henk

Re: Analog value too high

Posted: Wed Aug 09, 2023 2:11 pm
by chipfryer27
Hi

I might have one of those chips kicking around. If so I'll try with FCv5 and v10. Won't be until the weekend though due to travel.

Regards

Re: Analog value too high

Posted: Sat Aug 12, 2023 1:49 pm
by chipfryer27
Hi

Sorry, I don't have one. It was a 4680 so of no use.

Is the difference consistent over range (e.g. 5v / 2.5v / 0v etc) and does using Vref pins make any difference?

Regards

Re: Analog value too high

Posted: Mon Aug 21, 2023 7:20 pm
by henker
Yes it is consistent.
With 0V the raw value is 6. With exactly 2.5V is it 519 / 520.
It never goes over 1023

Henk

Re: Analog value too high

Posted: Tue Aug 22, 2023 9:21 am
by Steve
I have just compared the Flowcode v5 chip definition files for the 18F4682 and 18F4685 and there are no differences that will affect the generated code that handles analogue inputs. So I don't think this is a Flowcode issue.

There is a silicon errata note for that family (see here) which mentions an issue with the ADC module, but it doesn't seem to be the cause of your problem either.

I would suspect a hardware issue. It could even be you have obtained a fake chip. It is rare, but we have seen this happen before.