using atmega 16 pu

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i want 2 use uc atmega16pu for sole purpose of its inbuilt adc feature....but i don know how 2 use this uc as in what should be the following values...
1.vcc???
2.avcc???
3.aref
4.input at XTAL1 and XTAL2
and any other pin 2 b configured?
please help me.......my analog i/n is a variable input from 0-5volts and for 3 of such inputs i ahve 2 give 4 o/p's

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The data sheet is your friend.

What are you going to do with the ADC value? Is it going to be sent out the serial port? If so, then you need to use a crystal at XTAL1 and XTAL2. The circuit is in the data sheet.

Since you want to measure 5V signal, then it is easiest if you power it from 5V. Same voltage for Vcc and AVcc. Choose the power supply for the reference (register setting) and you will just put a capacitor on ARef.

I do not understand your last line:

Quote:
and for 3 of such inputs i ahve 2 give 4 o/p's

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Tue. Apr 1, 2008 - 05:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All information can be found in m16 datasheet.
Ie what PU suffix means can be found on page 339.
There you will also find Vcc range and max clock speed.
If you use a crystal you need to connect it to both XTAL1 and XTAL2. There are a schematic how to connect the crystal in your datasheet. You can also use internal oscillator and leave XTAL1 and XTAL2 unconnected. Or an external clock connected to XTAL1.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks for the reply! as for the last line there was a typing mistake. i meant for 3 of my analog input of uc(which i m getting from obstruction sensors) which i want to use as ADC input. and according to those sensor output i have to get uc programe to give 4 bit output.

i would tell you what i am doing, i want to create a autonomous robot which can never collide with any obstruction.i am using infrared reflective sensors which vary its o/p from 0-5 volts with respect to distance 3cm-15cm.
i am new to this, i will be delighted if u reply me.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using at mega16 and stk500 and drawing 5 volts from the board. But I am not using any capacitor/resistance in my circuit. And when I read the values its working fine so, is it going to give problem if I draw 5 volts from outer source.

One more thing , how can I use ADC if the voltage range increases from 5 to 12 volts.

Thanks,
Anmol Kumar

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

anmol2701:
If you interfacing with not-AVR-compatible voltage then you should make it compatible. If you want to measure from 5-12 Volt but still want to achieve full scale measurement then you should use analog circuit called span&zero. One kind of simple Span & Zero circuit can be made using differential amplifier. Try Google some.

KISS - Keep It Simple Stupid!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello sumitshah,

Try to see the basic circuit required for the interfacing.
This is quite a good boardhttp://www.et2.tu-harburg.de/lehre/Hobbythek/Download%20Files/AVRBoard_1_0_ApplicationManual.pdf
I think it would help you have a quick start.

AVR Rulez...;-)

Warm Regards,
Boseji
http://m8051.blogspot.com/

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi all, i need some guideline on using ADC ports on atmega 16L. i have gone through the data sheet.i am working on the control implementation of ac-dc converter. 4 analog parameters need to be sensed and fed to the controller instantaneously, now is it possible to sample and convert from analog to digital all the four parameters at a time.also i need only the 8 Most significant bits out of the converted 10 bit digital form. how do i do it ?? the datasheet says modify the 6th bit of the 8 bit ADMUX register. but how to program this thing in C, as i m using bascom avr for programming.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what should be the value of the capacitor to be connected to the Aref pin if i am using Avcc for reference for ADC conversion.its filter capacitor but what value, 0.01uf or 0.1uf or some capacitor in pf range ?????

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

Whats the frequency & AVR Voltage range you are operating your m16L at?
Thats whats going to decide the AVCC filtering. Well for the 10 bit to 8 bit thing just have the ADC left adjust the bits(2's Compliment). You get only 8 significant bits and rest are ignored. Well you always read the High Reg for the ADC value and the Low Reg is no more used.

AVR Rulez...;-)

Warm Regards,
Boseji
http://m8051.blogspot.com/

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks boseji,
well, i finally figured it out this morning and it working fine. the adc part is over, now i am working on implementing a pi controller in atmega 16L.

and as u say

AVR Rules
thank u