Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Strange behavior ADC7 ATMega328P

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
acjacques

Bascom Member



Joined: 24 Feb 2019
Posts: 10
Location: Rio de Janeiro

brazil.gif
PostPosted: Mon Jul 15, 2019 3:48 am    Post subject: Strange behavior ADC7 ATMega328P Reply with quote

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 ?

(BASCOM-AVR version : 2.0.8.1 )
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4797
Location: Holland

blank.gif
PostPosted: Tue Jul 16, 2019 9:55 am    Post subject: Reply with quote

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
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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