Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need help to write program for ADC in avr studio.

Status
Not open for further replies.
here is the ADC code for ATmega* in AVR studio.....



hope this helpful for u................
 

Attachments

  • ATmega8 ADC Example.doc
    25.5 KB · Views: 450

I've done ADC successfully, only using this simple code.

// program_ADC

unsigned int adc_rd;

void main()
{

DDRD = 0xFF; // Set PORTD as output
DDRB = 0x03; // Set PORTB 0&1 as output

while (1) {
adc_rd = ADC_Read(2); // get ADC value from 2nd channel
PORTD = adc_rd; // display adc_rd[7..0]
PORTB = Hi(adc_rd); // display adc_rd[9..8]
}
}


its on 'mikroC pro' .
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top