EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / use folloing library file for

use folloing library file for

|

Microcontroller › AVR › problem occurs in getting value from input adc channel in atmega 16 › use folloing library file for

March 31, 2013 at 4:20 am #9399
sushant
Participant

use folloing library file for ADC communication, 

 

 
#include<avr/io.h>
#include<adc_lib.h>
 
 
 
#define ADC_VREF_TYPE 0x00
 
// Read the AD conversion result
unsigned int 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 ADCW;
}
 
// header file//
#include<avr/io.h>
 
unsigned int read_adc(unsigned char);
void ADCinit();
 
 
 
 
void ADCinit()
{
ADMUX=ADC_VREF_TYPE;
ADCSRA=0x85;
}

RSS Recent Posts

  • Hitachi SuperScan Elite 802 CRT Monitor Issues (Model CM802U) December 7, 2025
  • Sanity Check – Peltier "Cooler" for Heating and Cooling December 7, 2025
  • My Advanced Realistic Humanoid Robots Project December 7, 2025
  • Funny Images Thread! December 7, 2025
  • I am ready to move from electrical and electronics field but confused where ? December 7, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise