[En-Nut-Discussion] AD conversion resolution?
Gerwin Voorsluijs
g.m.voorsluijs at wanadoo.nl
Thu Dec 15 15:18:13 CET 2005
Hi,
Maybe I didn't make myself clear, but I don't need to know if the ADC is
linear or not, I want to know why I don't get certain values when I'm
sure they have to be in there (voltage is very slowly varying!) Consider
the following short int values that are in my data (and their binary
counterparts): isn't it odd that there is no values in the range
256-303? That was btw the way I noticed there was something wrong: the
value would stay on 255 for a very long time while I was doing my
voltage sweep.
156 010011100
158 010011110
159 010011111
176 010110000
177 010110001
184 010111000
188 010111100
192 011000000
193 011000001
195 011000011
199 011000111
206 011001110
207 011001111
224 011100000
225 011100001
227 011100011
231 011100111
240 011110000
241 011110001
248 011111000
252 011111100
254 011111110
255 011111111
304 100110000
312 100111000
316 100111100
318 100111110
319 100111111
327 101000111
335 101001111
348 101011100
352 101100000
Cheers,
Gerwin
Alexander Baranov wrote:
> Hi.
> If you want to estimate ADC linearity here is one of the ways to do it:
> Feed pure sine signal to it's input (with a half range offset), program ADC
> for measurements with constant sampling rate satisfying Nyquist criteria
> and send the samples to PC through serial port. Let it be 1024 samples. Then
> you estimate the spectrum of obtained signal (e.g. with the help of Excell
> or MATLAB) and get the linearity characteristics.
> Regards, Alex.
> ----- Original Message -----
> From: "Gerwin Voorsluijs" <g.m.voorsluijs at wanadoo.nl>
> To: "Ethernut User Chat (English)" <en-nut-discussion at egnite.de>
> Sent: Thursday, December 15, 2005 4:35 AM
> Subject: Re: [En-Nut-Discussion] AD conversion resolution?
>
>
>
>>Hi Alexander,
>>
>>I am slowly turning a potentionmeter that is linked to an external power
>>source. To my knowledge that gives a continuously varying voltage and
>>therefore the AD readout should show the 10 bit resolution plus possibly
>>a little jitter.
>>
>>Alexander Baranov wrote:
>>
>>>Hello.
>>>Do you mean that you control the input voltage steps and they are
>
> precisely
>
>>>equal?
>>>
>>>----- Original Message -----
>>>From: "Gerwin Voorsluijs" <g.m.voorsluijs at wanadoo.nl>
>>>To: <en-nut-discussion at egnite.de>
>>>Sent: Wednesday, December 14, 2005 12:50 PM
>>>Subject: [En-Nut-Discussion] AD conversion resolution?
>>>
>>>
>>>
>>>
>>>>Dear all,
>>>>
>>>>I'm trying to use the 10bit AD conversion of the Ethernut and with some
>>>>trial and error I've managed to get some data out of it. The values I
>>>>get seem OK, but I'm a little disturbed by the fact that I don't get a
>>>>continuously climbing value out of it when I raise the voltage slowly.
>>>>For example, for the purpose I am using it (which I am sure has
>>>>continuous voltages!) I get the following set of "steps":
>>>>
>>>>156 158 159 176 177 184 188 192 193 195 199 206
>>>>207 224 225 227 231 240 241 248 252 254 255 304
>>>>312 316 318 319 327 335 348 352
>>>>
>>>>I know I am not using the full range of 0-5 V (I measured with a
>>>>"normal" voltmeter around 0.8-1.7 V so that seems OK)
>>>>
>>>>Does anyone have any idea what is going on? Lemme include the little
>>>>piece of code I used:
>>>>
>>>>#include <cfg/crt.h> /* Floating point configuration. */
>>>>#include <string.h>
>>>>#include <stdio.h>
>>>>#include <io.h>
>>>>#include <dev/board.h>
>>>>#include <sys/timer.h>
>>>>#include <dev/adc.h>
>>>>
>>>>int main(void)
>>>>{
>>>> u_long baud = 115200;
>>>> FILE *uart;
>>>>
>>>> u_char ad_chk;
>>>> u_short adc_value;
>>>> NutRegisterDevice(&DEV_UART, 0, 0);
>>>> uart = fopen(DEV_UART_NAME, "r+");
>>>> _ioctl(_fileno(uart), UART_SETSPEED, &baud);
>>>>
>>>> ADCInit();
>>>> ADCSetRef(AVCC);
>>>> ADCSetMode(SINGLE_CONVERSION);
>>>> ADCSetChannel(0);
>>>>
>>>> for (;;)
>>>>{
>>>>ADCStartConversion();
>>>>while (ADCRead(&adc_value))
>>>> NutThreadYield();
>>>>fprintf(uart, "%i ", (int) adc_value);
>>>> }
>>>>}
>>>>
>>>>
>>>>_______________________________________________
>>>>En-Nut-Discussion mailing list
>>>>En-Nut-Discussion at egnite.de
>>>>http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>>>>
>>>>
>>>
>>>
>>>
>>>_______________________________________________
>>>En-Nut-Discussion mailing list
>>>En-Nut-Discussion at egnite.de
>>>http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>>>
>>>
>>
>>_______________________________________________
>>En-Nut-Discussion mailing list
>>En-Nut-Discussion at egnite.de
>>http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>>
>>
>
>
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
>
More information about the En-Nut-Discussion
mailing list