Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

A/D Converter
[Special Hardware]

Collaboration diagram for A/D Converter:


Detailed Description

ATmega128 On-Chip ADC.


Defines

#define ADC_PRESCALE_DIV2   0x00
 0x01,0x00 -> CPU clk/2
#define ADC_PRESCALE_DIV4   0x02
 0x02 -> CPU clk/4
#define ADC_PRESCALE_DIV8   0x03
 0x03 -> CPU clk/8
#define ADC_PRESCALE_DIV16   0x04
 0x04 -> CPU clk/16
#define ADC_PRESCALE_DIV32   0x05
 0x05 -> CPU clk/32
#define ADC_PRESCALE_DIV64   0x06
 0x06 -> CPU clk/64
#define ADC_PRESCALE_DIV128   0x07
 0x07 -> CPU clk/128
#define ADC_INITIAL_CHANNEL   ADC0
#define ADC_INITIAL_REF   AVCC
#define ADC_INITIAL_MODE   SINGLE_CONVERSION
#define ADC_INITIAL_PRESCALE   ADC_PRESCALE_DIV64
#define ADC_BUF_SIZE   16
#define AVR_SLEEP_CTRL_REG   MCUCR
#define _adc_buf_head   ADC_BUF_SIZE
#define _adc_buf_tail   ADC_BUF_SIZE+1

Typedefs

typedef enum adc_ref_type adc_ref_t
typedef enum adc_mode_type adc_mode_t
typedef enum adc_channel_type adc_channel_t

Enumerations

enum  adc_ref_type { AVCC = 0, AREF, INTERNAL_256 }
enum  adc_mode_type { ADC_OFF, FREE_RUNNING, SINGLE_CONVERSION }
enum  adc_channel_type {
  ADC0 = 0, ADC1 = 1, ADC2 = 2, ADC3 = 3,
  ADC4 = 4, ADC5 = 5, ADC6 = 6, ADC7 = 7
}

Functions

void ADCInit (void)
void ADCSetRef (adc_ref_t reference)
void ADCSetMode (adc_mode_t mode)
u_char ADCSetPrescale (u_char prescalar)
void ADCSetChannel (adc_channel_t adc_channel)
void ADCBufferFlush (void)
void ADCStartConversion (void)
void ADCStartLowNoiseConversion (void)
void ADCStopConversion (void)
u_char ADCRead (u_short *value)
adc_mode_t ADCGetMode (void)
int ADCBufRead (u_short *buf, u_short *read)
int ADCBufWrite (u_short *buf, u_short *write)
void ADCBufInit (u_short *buf)

Variables

u_char adc_sleep_mode = SLEEP_MODE_ADC
adc_mode_t current_mode = ADC_OFF
u_shortADC_buffer = NULL


© 2000-2006 by egnite Software GmbH - visit http://www.ethernut.de/