ADC_CHER configuration

7 años 10 meses antes #490 por freddylamenace
Hi,

I'm a new user for arduino DUE and i have a problem for configuration : I want another POT for making special filtrers and I can't find explications for configuration of ADC_CHER[] and the while :

(extract from original code)
ADC->ADC_CHER=0x1CC0; // Enable ADC channels 0,1,8,9 and 10
while((ADC->ADC_ISR & 0x1CC0)!=0x1CC0)

Thanks.
El siguiente usuario dijo gracias: AuDioChosis, ulf

Por favor, Identificarse para unirse a la conversación.

7 años 10 meses antes #491 por Ray
Respuesta de Ray sobre el tema ADC_CHER configuration
Hi,

Have a look at this link:
www.avrfreaks.net/forum/arduino-due-adc-channel-sequence

Its also good to understand how the ADCs are mapped in arduino DUE, in this image you can have a clear idea:
www.robgray.com/temp/Due-pinout-A4.png

You can see there how the ADC labeled on the board as "A0" is in fact the ADC7. This is how sometimes configuring that register is a bit confusing.

Also dont forget the DUE micorocontroller datasheet (SAM3X-SAM3A):
www.atmel.com/Images/Atmel-11057-32-bit-...-SAM3A_Datasheet.pdf

If you still have problems, let me know!
El siguiente usuario dijo gracias: freddylamenace, AuDioChosis

Por favor, Identificarse para unirse a la conversación.

7 años 10 meses antes #492 por freddylamenace
Respuesta de freddylamenace sobre el tema ADC_CHER configuration
Hi,

thanks for you answer but i don't understand the relation between 0x1CC0 and the number of the channels.

For example, if i want a pot in channel 11 (AD 13), what is the argument for ADC_CHER ?

Thanks

Por favor, Identificarse para unirse a la conversación.

7 años 10 meses antes #499 por Ray
Respuesta de Ray sobre el tema ADC_CHER configuration
we want to enable ADCs 0, 1, 8, 9 and 10 that correspond to ADC7, AD6, AD10, AD11, AD12 respectively (you canverify it looking at this image www.robgray.com/temp/Due-pinout-A4.png).

Going to the datasheet page 1338 (www.atmel.com/Images/Atmel-11057-32-bit-...-SAM3A_Datasheet.pdf) you can see the ADC_CHER register, you can see that AD7, AD6, AD10, AD11 and AD12 correspond with bits 7, 6, 10, 11 and 12

if you take hits register (by default all zeroes) and place ones in the bits 6,7,10,11 and 12 you get 0011_1100_1100_0000 which is 0x1CC0 in hex.

If you want to add an extra pot in AD13 the binary would be 0011_1100_1100_0000 in hex 0x3CC0
El siguiente usuario dijo gracias: freddylamenace, AuDioChosis, ulf

Por favor, Identificarse para unirse a la conversación.

6 años 4 meses antes #1150 por AuDioChosis
Respuesta de AuDioChosis sobre el tema ADC_CHER configuration
Hello and thanks for clarifying this. The original Pedal Due code had confused me:

ADC->ADC_CHER=0x1CC0; // Enable ADC channels 0,1,8,9 and 10 (???)

The comment says ADC channels but the numbers apparently refer to Arduino pin pad numbers.

And the SAM3 data sheet isn't all that clear. It uses the term "ADC channel" on page 1338 but refers to its pins as AD0..AD15 elsewhere. Plus the somewhat perverse mapping of Arduino pin pads and labeling adds more confusion.

The reality is that the pedal code assigns ADC_CHER=0x1CC0 which enables ADC channels 7, 6, 10, 11, & 12 ( not 0,1,8,9 and 10). However those ADC channels do correspond to Arduino pin pad numbers 0,1,8,9 and 10.

So if I wanted to use just ADC channel 0, I would assign ADC_CHER=0x0001
and connect my input to Arduino Dup pin pad number A7, yes?

Thanks again for helping with this issue.

Cheerio, Aaron[/size]

Por favor, Identificarse para unirse a la conversación.

6 años 4 meses antes - 6 años 4 meses antes #1151 por Ray
Respuesta de Ray sobre el tema ADC_CHER configuration

The reality is that the pedal code assigns ADC_CHER=0x1CC0 which enables ADC channels 7, 6, 10, 11, & 12 ( not 0,1,8,9 and 10). However those ADC channels do correspond to Arduino pin pad numbers 0,1,8,9 and 10.

Yes, as I mentioned before the way the Atmel datasheet labels the ADCs is different from the Arduino labels. It is confusing yes, if you name them one way or the other, somebody is going to be confused.

So if I wanted to use just ADC channel 0, I would assign ADC_CHER=0x0001
and connect my input to Arduino Dup pin pad number A7, yes?

Yes, you are right.
El siguiente usuario dijo gracias: AuDioChosis

Por favor, Identificarse para unirse a la conversación.

4 años 1 mes antes - 4 años 1 mes antes #2078 por ulf
Respuesta de ulf sobre el tema ADC_CHER configuration
You post alone solved three of my problems! Thank you! Just a typo: the first binary should have one less 1, so 0001_1100_1100_0000. Easy enough to spot, but might help future visitors? Edit: this reply refers to post #499 by Ray

Por favor, Identificarse para unirse a la conversación.

Tiempo de carga de la página: 0.068 segundos
Gracias a Foro Kunena
Joomla SEF URLs by Artio