On Thu, 29 Sep 2005 22:17:01 -0500 you wrote:
>
>On Sep 29, 2005, at 9:17 PM, pinky elodia wrote:
>
>> thanks....for your concern...
>> actually where can i get information about this..maybe about your
>> project....
>> now, i,m thinking to make to kind of sensor ( light and
>> temperature) and control by one uC,ATmega128...is it possible?? For
>> ATmega128, there are 4 input for ADC right?..but i quite confuse
>> how to read data form ADC..because its convert into 10 bit
>> data....save into 2 register..normally we just use 8 bit data....
>
>Am thinking you are facing a steep learning curve. If you only desire
>8 of the 10 bits then just throw the 2 least significant bits away.
>Just because the data paths are only 8 bits wide doesn't mean you
>can't handle 10 or 16 bit numbers.
#define ADC_VREF_TYPE 0x20
// Read the 8 most significant bits
// of the AD conversion result
unsigned char read_adc(unsigned char adc_input)
{
ADMUX=adc_input|ADC_VREF_TYPE;
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCH;
}
// ADC initialization
// ADC Clock frequency: 115.200 kHz
// ADC Voltage Reference: AREF pin
// Only the 8 most significant bits of
// the AD conversion result are used
ADMUX=ADC_VREF_TYPE;
ADCSRA=0x87;
--
Ralph Hilton
http://www.ralphhilton.org
C-Meter: http://www.cmeter.org
FZAOINT http://www.fzaoint.netMessage
Re: [AVR-Chat] Re: network sensor
2005-09-30 by Ralph Hilton
Attachments
- No local attachments were found for this message.