ADC Programming issues

Hi everyone,

I am new to programming and I was wondering if anyone could offer me any help. I am using an ATmega48 as my target with AVR studio 4.17 as my IDE and will be requiring to convert an analog signal to digital output embedded within my program. For example; I will be reading several voltage signal inputs into my controller and I will need my program to read this signal and react by sending a digital output to a relay switch. I was searching for sample programs that relate to what I need and since I am new to this stuff it is tough for me to understand exactly what is going on. Does anyone know of any tutorial sites or helpful sample code that I can refer to in order to provide me some direction? Thank you very much!

Regards,

Steve

Hello.

Do you have a Baby Orangutan, or are you using some other microcontroller board based on the mega48? If it’s the former, I suggest you try using the Pololu AVR library, which has functions for reading analog voltages (these functions are documented in the library’s command reference, which is linked from the library’s user’s guide). If it’s the latter, you can download the library files and look at the OrangutanAnalog source code to see how the library reads analog voltages.

- Ben