Joined: 24 Feb 2019 Posts: 13 Location: Rio de Janeiro
Posted: Mon Jul 15, 2019 3:48 am Post subject: Strange behavior ADC7 ATMega328P
When testing the AD channels on a NANO board ATMega328p I am receiving strange values from the AD channel #7 at pin 22 just between the 5V pin and the AD #6. Trying with a potentiometer I receive values ranging from about 18 up to 940 and not from 0 to 1023 as expected extreme sides. It seems also noisy.
All other channels works fine with the same code.
'===================================
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Dim W As Word
Dim Z As String * 10
Do
W = Getadc(7) 'select the ADC channel on getadc(#)
Z = Str(w)
Z = Format(z , "0000")
Z = "AD7=" + Z
Print Z
Loop
'===================================
There are any special configuration to have this channel working properly ?
there is no special config.
just make sure you connect to the right pin. and also, check if the input you offer is not too high for the AD converter.
keep wires very short and possible add a small cap to ground on the input pin.
notice that the DIP version of the chip does not have these channels. _________________ Mark
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum