Instructions
234Libraries
© 2013 Conrad Electronic
offset);
Sub ADC_Enable(mode As Byte, speed As ULong, ref As Byte, input_cnt As
Byte, offset As Char)
Description
The ADC sequencer in the AVR32 can carry up to 8 A/D-conversions at the same time. An A/D-con-
version can be a differential measurement between an ADC pin and GND, or a differential measure-
ment between two pins. See ADC_SetInput.
For the mode parameter various properties can be ORed (this of course only makes sense with one
ADC resolution). Oversampling and Sample & Hold can be turned off. If enabled, an interrupt is
triggered when an ADC measurement is finished (see interrupt Table).
ADC_Start has to be called for each new measurement. The end of the measurement can be dis-
played via interrupt, or use ADC_GetValues with the parameter ADC_GET_WAIT. Is the Free Run-
ning mode selected, ADC_Start is called only once, after that the inputs are continuously measured,
and ADC_GetValues always returns the value of the last measurement.
Please look into the datasheet AT32UC3C for the exact meaning of oversampling and sample &
hold, and the impact on the measurements.
If ADC is set to very high speeds and the interrupt is enabled, this can overwhelm the inter-
preter.
Parameter
mode work modes (see Table)
speed ADC Clock (32khz - 1.5Mhz)
ref reference Voltage (see Table)
input_cnt number of ADC Pins (1-8)
offset correction factor (-128 to 127)
Mode Table
Definition
Function
ADC_MODE_12BIT
ADC 12-Bit resolution
ADC_MODE_8BIT
ADC 8-Bit resolution
ADC_MODE_10BIT
ADC 10-Bit resolution
ADC_MODE_NO_OVERSAMP
turns Oversampling off
ADC_MODE_ENAB_IRQ
activates ADC IRQ
ADC_MODE_NO_SAMPHOLD
no Sample & Hold
ADC_MODE_FREE_RUN
activates Free Running
Reference Voltage Table
Definition
Function
ADC_REF1V
internal 1V Reference