[En-Nut-Discussion] Questions about using the analog ports on an Ethernut 2.1b board

Tim Tait tim.tait1 at gmail.com
Sat Feb 18 03:59:49 CET 2006


Slightly confused-

By no answer, do you mean no valid data?

Both Analog and Digital Ports exist on the module - but only ADC0-3 (or 
1-4 (depending if you read the AVR datasheet or the ethernut datasheet) 
are free, ADC4-7 are shared with the JTAG port.

They are on the 20 pin header next to the JTAG connector. Note the row 
of pins at the edge (except for pin 2) are AGND, and the inner row is 
the inputs.

As I mentioned in my post earlier, you need to do something like this:

    u_short adc_value;

    ADCInit();
    ADCSetPrescale(ADC_PRESCALE_DIV64);
    ADCSetRef(AVCC);
    ADCSetMode(SINGLE_CONVERSION);
    ADCSetChannel(ADC0);

    ADCBufferFlush();
    ADCStartConversion();
    while (ADCRead(&adc_value))
             NutThreadYield();


Tim

Wahlau - wrote:
> Hi guys,
> 
> we have got a ethernut board here (2.1b) and are trying to collect it
> with some simple analog sensors on it. We realise that there are no
> answers from the ports, and wonder whether are the built in ports on
> board are digital or analog ones...
> 
> hope you guys can give some quick pointers.
> 
> thanks.
> 
> regards,wahlau



More information about the En-Nut-Discussion mailing list