ADC Resolution

frank2644

Member
I'm looking for specifications on the ADC function. Is there a detail spec somewhere?

The question that I am trying to answer is related to the ADC 8 bit resolution. As I understand it the ADC will measure 0-5 v in 256 steps, therefore each step is about 20 mv. My question is when is the step taken? That is, if I am measuring less than 20 mv, say 11 mv, will the value be zero or 20 mv?

Thanks.
 

premelec

Senior Member
Welcome to this forum - In my experience there is usually some noise that makes transitions uncertain. However you can set the reference voltage to less than the power supply voltage [FVRSETUP etc] if you need to work with lower voltages and also use READADC10 into a WORD value... In practice there is always some error and noise... makes it all more interesting... :) 11 mv should read 0 or less than one bit...
 

AllyCat

Senior Member
Hi,

Welcome to the forum. Yes, there is for example Microchip AN693 although it seems quite old now. There are also the "base" PIC data sheets here (usually section 30).

I believe the first "step" is actually half-size (and the final step 1.5 units), but IMHO the diagrams are a little questionable. So the output should already be "rounded" which would make 11 mV read as "1". However, this is largely theoretical, because the specification mainly "guarantees" that the ADC sequence is "monotonic", i.e. it shouldn't generate sequences such as 1, 2, 4, 5 or 1, 3, 2, 4 etc, with a risiing input voltage.

Cheers, Alan.
 

bpowell

Senior Member
If you set the vREF to 2.048 volts...and then did READADC10, would you be splitting 2.048 into 1024 chunks? So your resolution would be down to two mV...right?
 

AllyCat

Senior Member
Hi,

I was using my own terms to describe the diagrams in AN693 (since I couldn't be bothered to read all the text again).

So basically: Steps = Units = Chunks = 1 LSBs. :)

Cheers, Alan.
 

SAborn

Senior Member
Has anyone actually checked if the ADC is a full scale reading of 0-5v, as the last time i run a check it maxed out around about 3.5v on a linear scale, it has been a while and perhaps im wrong, i dont have the time to check, but others might like to run a test to confirm.
 

AllyCat

Senior Member
Hi,

it maxed out around about 3.5v on a linear scale,
I've certainly used M2 ADCs within a few LSbs of the supply rail. Are you suggesting that yours gave a value of 1023 (readac10) with 3.5 volts input, or that it didn't read values above about 700 ?

Of course one needs to be very careful if using rail-to-rail Op-Amp buffers, since the common-mode inputs tend not to include (or even get close to) the supply rail
.

Cheers, Alan.
 

hippy

Technical Support
Staff member
Has anyone actually checked if the ADC is a full scale reading of 0-5v
It is one of the standard tests we do when developing the firmware and if it did not work as expected, 0-255 or 0-1023 for 0V-5V input, we would undoubtedly soon hear about it.
 

frank2644

Member
Thanks, everyone.

1) I'll check out the AN693 spec.
2) Yes, setting vREF to 2.048 would give 2 mv steps...good idea. Although I'm a little concerned about slowing things down using 10 bit ADC and storing associated 16 bit variables. I'm trying to directly measure up to a 1 volt RMS 60 cycle AC signal and depending how I do that speed could be a factor.
3)If I understand the question posted by SAborn, I'm pretty sure that I have measured up to the full scale of 5v using the ADC.
 

hippy

Technical Support
Staff member
I'm a little concerned about slowing things down using 10 bit ADC and storing associated 16 bit variables.
There should be little measurable difference in speeds using either, microseconds at most.

For maximum overall operating speed use the SETFREQ command.
 

AllyCat

Senior Member
Hi,

I'm a little concerned about slowing things down using 10 bit ADC and storing associated 16 bit variables.
I believe one of the reasons that PICaxe Basic is relatively slow is that "under the hood" almost all calculations are performed to 16 bit resolution anyway, and only restored to 8 bits if the assignment requires a byte value. So generally it won't run significantly slower with Word variables. But beware the PE-generated "macros"; commands such as POKE WORD are sometimes faster if you you code them yourself using byte values.

In particular, A-D conversion seems to be one of the "faster" executing instructions, presumably because it's working mainly at the machine code / hardware level.

Cheers, Alan.
 
Top