Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ADC with ATmega32

Status
Not open for further replies.

sficht

New Member
Hey guys I am new to the forum and micro controllers in general. Let me begin by saying hello to everyone. Hope all is well.

OK so down to the issue. I am using an ATmega32 16PU

https://www.electro-tech-online.com/custompdfs/2008/04/2503S.pdf

and programming with codevision. What I'm trying to do is a voice modulation type thing. I have a microphone and have put it through a low pass op-amp. I was wondering how exactly the A/D conversion works in this chip and how I can send the data out serially to an off chip D/A (TLC5628IN)

https://www.electro-tech-online.com/custompdfs/2008/04/tlc5628.pdf

so I can output it on a speaker. I also want to do add all sorts of sound effects, but I'm sure I can figure out the code for this(with codevision) if I just know how the whole conversion process is working. Are there any good links I could checkout to learn more about this? or does anyone have any input? If so, it would really help me. Sorry if I sound ignorant, I'm new to all this.

All the best,
Sean
 
Alright so I just looked at my post and realized that it looks a bit rookish (Hence 0 replies). I understand all the hardware/signal transfer behind adc and dac conversions, but I'm not sure how to write the C in codevision. The code for the adc I believe is

var = read_adc(whatever portA pin I want to use)

I guess what I want to know is how (SW'wise) I take 'var' and output it serially, with some given DAC output selection bits attached (e.g. 000 attached as the MSB's selects output A of my DAC chip), so I can reconvert it back to analog. Sorry, the reason I'm having trouble with this is because I'm used to ye ol' vhdl/verilog (basically logic coding) and have only ever worked with limited C. I have to use the ATmega32 for this project, so if ya'll have any advice for me let me know, but if not I'll figure it out .

~Sean
 
sficht said:
Also, I know that the ATmega32 reads the analog into 10bit, so how can I drop that to 8bit?
Simply set the ADLAR bit in ADMUX to left-justify the result and read only ADCH. Ignore ADCL.

The above advice is based on **broken link removed**. You may have to make some small adjustments to suit the Mega32. They'll be real similar though.
 
Last edited:
Once you have got the AD data, then you can process it with software.

After that, you need to send it out to the DAC chip TLC5628IN using SPI. I have never used the chip but by reading the data sheet, one can send out the required 12-bit using two 8-bit SPI operations and then "load" the data into the chip.

Or you can use software bit-bang method to send out the data stream instead.
 
Last edited:
futz said:
Simply set the ADLAR bit in ADMUX to left-justify the result and read only ADCH. Ignore ADCL.

The above advice is based on **broken link removed**. You may have to make some small adjustments to suit the Mega32. They'll be real similar though.

Thanks futz
 
eblc,

let me read over the data sheet again to see if I can figure out exactly how the SPI is going to have to work. I'm feel pretty shaky on using it, though I'd like to use it if I can figure out the op. Don't give up on me though :p

~Sean
 
Hi to all :)

My name is kike and i'm begginer into Atmega family microcontroler, i need to do a convertion of 3 signals of a ADXL 330 accelerometer. For to do this job, i am using a ATmega32 that have a ADC 8-channel multiplexer, the programing is in assembler. Have someone worked with more than 2 signals?, i am confused of how to programing the both ADMUX and ADCSRA registers.

If someone know how to work with the ADMUX and ADCSRA register, please help me :-( .

see you, and thank you.
 
Status
Not open for further replies.

Latest threads

Back
Top