AREF shorted to AVCC/VCC in Uniboard

50 views
Skip to first unread message

amm

unread,
Jul 20, 2012, 8:32:52 AM7/20/12
to openun...@googlegroups.com
I have a new Uniboard with ATMega 128. I want to try out adc with 8 bit resolution & Vref=2.56 V internal ref. I wrote the code for the same, to convert adc0 & adc1 channels. I tried this code on a ATMega 8 dev board that I have (ofcourse with relevant changes in register names etc) and the result of the adc is displayed through a USART to a PC.  When I tried the code on Uniboard, even with zero volts i/p, I get some small readings. I checked the hardware and found that the Vref on the uniboard is directly shorted to the AVCC pin, which is connected to Vcc. This is a problem, since now I cannot get better resolutions at lower i/p volts.
How can I separate the Vref as a separate input? I also get some small readings on the o/p related to both i/p channels. The readings are same, as if the two i/p are from one analog source. I use two separate pots from 5v source to get two independent analogs.
I have attached the code, there is much more in the code, like LCD display, USART comm, binary conversion to bcd for LCD display etc, which can be ignored.
Can someone please help?
avr128_adc_lcd.c

aditya gawand

unread,
Jul 21, 2012, 6:30:30 AM7/21/12
to openun...@googlegroups.com
Hi amm,

First of all, if you want to use internal Vref then you should not bother about the external AVCC at all, it should not matter.
Secondly, if you are indeed using internal Vref, then your ADMUX configuration should set both REFS1 & REFS0 (refer datasheet), you have set only REFS0.
Try this instead :
       ADMUX = (1<<REFS1)|(1<<REFS0)|(1<<ADLAR);

Let us know.

A M morawala

unread,
Aug 1, 2012, 2:25:40 AM8/1/12
to openun...@googlegroups.com
Hi Aditya,
I got the system working. What I said was that I cannot use the internal ref of 2.56V since the AVref is shorted to the AVcc & Vcc lines on the uniboard. So I have to use AVcc only. If I want to use the MCU's internal ref of 2.56V, I will have to cut the track to the AVref pin and keep it disconnected, use a decoupling 0.1 micro cap. I also had one bug in the code which I solved.  require the first two channels, ADC0 & ADC1 to be converted. After converting ADC0 & ADC1, I should set the pointer back to ADC0 and then repeat the conversions. This was not done before. Secondly, I left the ADC inputs hanging, the noise pickup was large, giving random readings. I made a small potmeter jig and used it for varying voltages, so there were no hanging inputs.
Thanks for your time. In case you need me to help otr someone, please give my mail. I am passionate about microcontrollers and do this as a hobby.
Regards
A M Morawala 


Reply all
Reply to author
Forward
0 new messages