ad7476a

所属分类:驱动编程
开发工具:C/C++
文件大小:15KB
下载次数:12
上传日期:2009-12-12 20:59:20
上 传 者ranjith.i
说明:  adc device driver for windows

文件列表:
ad7476a\ad7476a_test1.c (9130, 2009-09-15)
ad7476a\ad7476a_test1.dpj (5654, 2009-09-15)
ad7476a\ad7476a_test1.h (185, 2009-09-15)
ad7476a\ezkitutilities.c (27807, 2009-09-15)
ad7476a\ezkitutilities.h (4251, 2009-09-15)
** (2762, 2009-09-15)
** (2706, 2009-09-15)
ad7476a (0, 2009-09-15)

Project Name: ad7476a_test1 Project Type: ADSP-BF533 [ ] ADSP-BF537 [X] ADSP-BF561 [ ] Hardware Used: AD7476A SPI daughter card. EZ-Kit LEDs (used if error condition detected). System Services Components Used: DMA Manager [X] Deferred Callback Manager [ ] Interrupt Manager [X] Timer Module [ ] Power Management Module [X] Flag Module [X] External Bus Interface Unit Module [X] Port Module [X] Example Overview: This project demonsrates the use of the AD7476A device driver to capture a analog signal applied to the AD7476A SPI daughter card. A circular DMA buffer is used to capture the converted data and interrupts are generated at the completion of each sub-buffer, at which point the sub-buffer is copied aside to a larger buffer, sample[]. The sampled data is 12 bits wide and held in an 16 bit memory location MSB first with four zero leading bits. Since the the AD747A only handles positive input signal voltages, all values are positive. As the DMA buffer is copied to the sample[] array the data is left-shifted by 3 bits to increase the size of the 'fract16' data. Plots can be shown of the DMA Buffer contents and the results of the FFT: sample_signal.vps Line plot of the sample[] array. Should display the captured representation of the signal applied to the AD7476A SPI daughter card. sample_fft.vps FFT plot of the sampl[] array. Please ensure that the Sample Rate value in the Plot Settings Dialog (Right-click, Modify Settings... on plot window) is the same as the true_sample_rate value in the program, displayed in the Expressions window. For a pure sinusoid applied to the AD7476A, you should see a single spike at the frequency of the input signal. The workspace file adi_ad7476a_test1.vdw can be used to run the program and contains the above plots and expression windows. If you have a dual display, the workspace file dual_screen.vdw can be used. File Structure: Main project File: ad7476a_test1.dpj Source Files: ad7476a_test1.c ../../../../../lib/src/drivers/adc/adi_ad7476a.c ./ezkitutilities.c Header Files: ad7476a_test1.h ../../../../../include/drivers/adc/adi_ad7476a.h ./ezkitutilities.h System Configuration: Jumpers: SW5 > 1:ON, 2:ON, 3:ON, 4:ON External connections: AD7476A SPI daughter card. Getting Started: 1) Attach the AD7476A SPI daughter card and apply the required signal 2) Load Project file "ad7476a_test1.dpj" 3) Load the adi_ad7476a_test_workspace.vdw workspace file 4) Build Project by selecting "Rebuild All" 5) Set break point at line 142 just after the comment // ADD BREAK POINT here to see spectral analysis plot 6) Run (Whilst it is possible to build and run in Release mode, it is less easy to set the above break point, and the plot configurations require changing to reference _sample instead of sample). 7) View results in plot windows 5) Different sampling rates and peripheral clock frequencies can be used as desired (see below), as well as different input signals. - Different sampling rates and clock frequencies will require the program to be rebuilt. - Different signals should be visible in the plot windows by running the example until it stops at break point again. Configuring the program: Several macros, identified at the top of the ad7476a_test1.c file are used to configure the sampling rate and buffer sizes: The requested sample rate is set by adjusting the following macro: #define SAMPLE_RATE 1000000 // 1MSPS (Max) In reality this is not achievable and the AD7476A driver will adjust the input value and passes it back in the identifier static u32 true_sample_rate; The Peripheral clock (SCLK) frequency is defined by the macro: #define FSCLK_VALUE 120000000 // Hz The Circular DMA buffer is defined by the following macros, the first is the overall size and the second is the number of sub-buffers to use #define ADC_BUFFER_SIZE 512 #define NUM_SUB_BUFFERS 2 The size of the sample buffer (used for FFT analysis is typically bigger than the DMA buffer. The multiple is defined by the macro: #define SAMPLE_SIZE_MULTIPLE 2 By default the AD7476A driver callback function is executed live from within the driver's DMA interrupt handler. This is to facilitate the viewing of the signal data. Deferred callbacks can be used by commenting out the macro #define USE_LIVE_CALLBACKS

近期下载者

相关文件


收藏者