|
| 1 | + |
| 2 | + |
| 3 | +## ADC Sampling at 1.1MSPS |
| 4 | + |
| 5 | +This file contains the following sections: |
| 6 | +- Code Example Description |
| 7 | +- Suggested Development Resources |
| 8 | +- Reconfiguring the project for a different dsPIC33E device |
| 9 | +- Revision History |
| 10 | + |
| 11 | + |
| 12 | +## Code Example Description: |
| 13 | + |
| 14 | +In this example, ADC is set up to convert AIN0 using CH0 and CH1 sample/hold in 10-bit sequential mode |
| 15 | +at 1.1MHz throughput rate. ADC clock is configured at 13.3Mhz or Tad=75ns |
| 16 | +ADC Conversion Time for 10-bit conversion is Tc=12 * Tab = 900ns (1.1MHz). |
| 17 | + |
| 18 | +void initAdc1(void); |
| 19 | +ADC CH0 and CH1 S/H is set-up to covert AIN0 in 10-bit mode. ADC is configured to next sample data immediately after the conversion. |
| 20 | +So, ADC keeps conversion data through CH0/CH1 S/H alternatively. Effective conversion rate is 1.1Mhz |
| 21 | + |
| 22 | +void initDma0(void); |
| 23 | +DMA channel 0 is configured in ping-pong mode to move the converted data from ADC to DMA RAM on every sample/convert sequence. |
| 24 | +It generates interrupt after every 16 sample transfer. |
| 25 | + |
| 26 | +void __attribute__((__interrupt__)) _DMA0Interrupt(void); |
| 27 | +DMA interrupt service routine, moves the data from DMA buffer to ADC signal buffer and collects 256 samples. |
| 28 | + |
| 29 | +The Toggle frequency of one pulse should be around 240us(micro second), if the operating clock frequency at 40Mhz. |
| 30 | +Short AN0/AN1 with +3.3v to get analog signal for sampling. These values should be approximately around 0x7FXXX when checked in the bufferA/bufferB in the code. |
| 31 | + |
| 32 | + |
| 33 | +## Hardware Used |
| 34 | + |
| 35 | +- Explorer 16/32 Development Board (https://www.microchip.com/DM240001-2) |
| 36 | +- dspic33ep512gm710(https://www.microchip.com/ma330035) /dspic33ep512mu810 (https://www.microchip.com/MA330025-1)/ dspic33ep256gp506 (https://www.microchip.com/MA330030) PIM |
| 37 | + |
| 38 | + |
| 39 | +## Software Used |
| 40 | + |
| 41 | +- MPLAB® X IDE v5.50 or newer (https://www.microchip.com/mplabx) |
| 42 | +- MPLAB® XC16 v1.70 or newer (https://www.microchip.com/xc) |
| 43 | + |
| 44 | +## Reconfiguring the project for a different dsPIC33E device: |
| 45 | + |
| 46 | +The Project/Workspace can be easily reconfigured for dspic33ep512gm710/dspic33ep512mu810/dspic33ep256gp506 device. |
| 47 | +Please use the following general guidelines: |
| 48 | + |
| 49 | +a. Change device selection within MPLAB® IDE to dspic33ep512gm710/dspic33ep512mu810/dspic33ep256gp506 device of |
| 50 | + your choice by using the following menu option: |
| 51 | + MPLAB X>>Configuration drop-down option>><Listed Device Configuration> |
| 52 | + |
| 53 | +b. Re-build the MPLAB® project using the menu option: |
| 54 | + MPLAB X>>Build Main Project |
| 55 | + |
| 56 | +c. Download the hex file into the device and run. |
| 57 | + |
| 58 | + |
| 59 | +## Revision History : |
| 60 | + 04/01/2006 - Initial Release of the Code Example |
| 61 | + 7/01/2010 - Code Example updated for dsPIC33E |
| 62 | + 02/13/2014 - Code Example updated to new format for dspic33ep512gm710/dspic33ep512mu810/dspic33ep256gp506 |
| 63 | + 11/13/2014 - TEST_MODE code added for test automation |
0 commit comments