[En-Nut-Discussion] AD conversion resolution?

Alexander Baranov baranov at intech21.com
Wed Dec 14 20:32:17 CET 2005


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
>
>





More information about the En-Nut-Discussion mailing list