Connect with us

atmega adc

Discussion in 'Microcontrollers, Programming and IoT' started by komal, Mar 9, 2011.

  1. komal

    komal

    5
    0
    Mar 9, 2011
    Hi..
    cud any1 tel me how to use adc port of atmega16 single channel?
    I mean the code and working of adc (resolution)..
    and then display the digital value on LCD..
    have been trying since months..its nt working out....
     
  2. rob_croxford

    rob_croxford

    262
    0
    Aug 3, 2010
    What software are you using?
     
  3. komal

    komal

    5
    0
    Mar 9, 2011
    avr studio
     
  4. rob_croxford

    rob_croxford

    262
    0
    Aug 3, 2010
    This is some code however it is for MikroC pro (tested and working)

    Your compiler should have a library of comands that will help u set up the ADC in this way. However it will take a little fiddleing arround.

    For the LCD reasearch how to connect an LCD to a microcontroller using 4-bit mode. Your compiler should also have a set of comands for setting up and LCD so it should be fairly straitforward to display the value.

    This may be cheating on my forum but check out the AVR freaks website they have loads and loads of examples and forum based questions dedicated to AVR's.
     
    Last edited: Mar 9, 2011
  5. komal

    komal

    5
    0
    Mar 9, 2011
    what doe sthis do??
    what is "Hi"?
    PORTB = Hi(adc_rd); // display adc_rd[9..8]
     
  6. komal

    komal

    5
    0
    Mar 9, 2011
    wat if v wanna use oly 8 bits?
     
  7. rob_croxford

    rob_croxford

    262
    0
    Aug 3, 2010
    8 bits is greater than 4 bits.... the reason for running it in 4-bit mode is to free up precious I/O pins...

    I would take a long hard look at the data sheet for that device and then re-read it. setting up the ADC is not a hard task but it requires you to understand what and where with the PIC

    All you should need to do is define and set up the pin for analoge input, Initialise the ADC and then read from the ADC.

    There should be a help section or library within ur compiler this will have all the relevant information you need. I have not used AVR Studio and so i am not familiar with the function list.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-