Maker Pro
Maker Pro

atmega adc

komal

Mar 9, 2011
5
Joined
Mar 9, 2011
Messages
5
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....
 

rob_croxford

Aug 3, 2010
262
Joined
Aug 3, 2010
Messages
262
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:

komal

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

rob_croxford

Aug 3, 2010
262
Joined
Aug 3, 2010
Messages
262
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.
 
Top