a ADSP-21990: Utilization of the Analog to Digital Converter (ADC) AN21990-05
a
ADSP-21990: Utilization of the
Analog to Digital Converter (ADC)
AN21990-05
© Analog Devices Inc., April 2002 Page 1 of 7
a ADSP-21990: Utilization of the Analog to Digital Converter (ADC) AN21990-05
Table of Contents
SUMMARY...................................................................................................................... 3
1 IMPLEMENTATION OF THE ADC LIBRARY ROUTINE......................................... 3
1.1 Usage of ADC routine ....................................................................................................................................3
1.2 Usage of DSP registers ...................................................................................................................................3
1.3 Configuring the ADC block...........................................................................................................................4
1.3.1 adc.h .............................................................................................................................................................4
1.3.2 adc.dsp .........................................................................................................................................................4
2 SOFTWARE EXAMPLE: UTILIZATION OF THE ADC BLOCK TO GENERATE
THREE-PHASE SINE-WAVE PWM................................................................................ 4
2.1 Main.dsp..........................................................................................................................................................4
2.2 Main.h..............................................................................................................................................................5
3 EXPERIMENTAL RESULTS.................................................................................... 5
© Analog Devices Inc., April 2002 Page 2 of 7
a ADSP-21990: Utilization of the Analog to Digital Converter (ADC) AN21990-05
Summary
This application note demonstrates the usage of the pipeline flash Analog to Digital Converter (ADC)
system
1
on the ADSP-21990. Section one will discuss the ADC library routines. In section two, an
example will be used to demonstrate the usage of these routines. The last section shows some
experimental results.
1 Implementation of the ADC library routine
1.1 Usage of ADC routine
In this library, two routines are defined for initialising the ADC block and reading the ADC channel
values. It is developed as an easy-to-use library, which has to be linked to the user’s application. The
library consists of two files. The file “adc.dsp” contains the assembly code of the subroutines. The block
has to be compiled and then linked to an application. The user has to include the header file “adc.h”,
which provides the function-like call to the subroutine. The following table shows the macro that is
defined in this library.
Operation Usage Explanation
Initialisation
Read ADC
ADC_Init(ADC_Number_of_samples,
ADC_EOC_interrupt_label)
ADC_Read(ADC_DATAX,
Offset_0to3 or Offset_4to7)
Initialise the ADC block, including
configuring the ADC end of conversion
interrupt
Reading the ADC channel values, with the
offset values being taken into account
Table 1 Implementation Routine
This routine requires a configuration constant from the main include-file “main.h” that comes with every
application note. Section 2 shows an example of usage of this library. For more information regarding this
routine, see the comments in the “adc.h” and the “adc.dsp” files.
1.2 Usage of DSP registers
The macro listed in the Table 1 is based on the subroutine listed in Table 2. This subroutine will be
discussed in the following section. The following table gives an overview of what DSP registers are used
in this macro:
Subroutine Inputs
ADC_Init_
ADC_Scale_
Table 2 Input and output format, modified registers in the ADC library routines
ADC_Number_of_samples: the
number of samples to be taken for
calculating the offset
None
Outputs Modified registers
mr1 = Offset_0to3
sr1 = Offset_4to7
ar = ADC channel
value after offset
ar, ay0, ay1, mr,
mx0, my0, sr,
ar, ay0
1
Please refer to the ADSP-21990 hardware reference manual for information on the ADC block
© Analog Devices Inc., April 2002 Page 3 of 7