Datasheet

ADC LIBRARY
ADC (Analog to Digital Converter) module is available with a number of AVR micros. Library func-
tion ADC_Read is included to provide you comfortable work with the module in single-ended
mode.
ADC_Read
231
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Prototype
unsigned ADC_Read(char channel);
Returns 10-bit or 12-bit (MCU dependent) unsigned value from the specified channel.
Description
Initializes AVR ’s internal ADC module to work with XTAL frequency prescaled
by 128. Clock determines the time period necessary for performing A/D conver-
sion.
Parameter
channel represents the channel from which the analog value is to be
acquired. Refer to the appropriate datasheet for channel-to-pin mapping.
Requires Nothing.
Example
unsigned tmp;
...
tmp = ADC_Read(2); // Read analog value from channel 1