View previous topic :: View next topic |
Author |
Message |
gtx15
Joined: 19 May 2018 Posts: 27
|
18F87K22 A/D |
Posted: Wed Jun 26, 2019 5:18 am |
|
|
Do I have to disable something to get a/d inputs on PortA to work ? I’m getting erroneous readings on all PortA a/d inputs. Rest of a/d inputs ok, temp sensor, voltage ref, PortF all work fine. TrisA programmed as inputs! a/d inputs programmed as well.
Thanks in advance. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Wed Jun 26, 2019 6:31 am |
|
|
You need to post a small, compilable program for us to see and run. It's probably something simple BUT until we see your code.....
Jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
gtx15
Joined: 19 May 2018 Posts: 27
|
18F87K22 A/D |
Posted: Sat Jun 29, 2019 2:03 pm |
|
|
It appears that if my A/D input goes slightly below VSS (Vref-). My A/D results Go negative. I'm getting results like FFEF. Any solution besides better pcb layout? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Sun Jun 30, 2019 4:48 am |
|
|
Most ( if not all ?) PICs have ADCs that ONLY read positive voltages. So it s important to ensure no negative volts get to the ADC section. Hard to advise you what to do, other than general comments hardware... proper ground planes, shielded cabling, clamping inputs, etc. Software bodges would be multiple sampling, like 'Olympic' averaging as you should never rely upon one reading, especially for control purposes.
Microchip have several 'apnotes' about using the ADC section. Getting analog to work correctly, especially more than 8 bits is 1/2 design, 1/2 layout and 1/2 luck. |
|
|
|