MODDMA GPDMA Controller New features: transfer pins to memory buffer under periodic timer control and send double buffers to DAC

Dependents:   FirstTest WaveSim IO-dma-memmem DACDMAfuncgenlib ... more

Files at this revision

API Documentation at this revision

Comitter:
AjK
Date:
Fri Mar 11 13:47:23 2011 +0000
Parent:
9:e7ecf909e834
Child:
11:19009be5a0e7
Commit message:
1.6 See ChangeLog

Changed in this revision

ChangeLog.c Show annotated file Show diff for this revision Revisions of this file
example2.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ChangeLog.c	Tue Mar 08 17:47:43 2011 +0000
+++ b/ChangeLog.c	Fri Mar 11 13:47:23 2011 +0000
@@ -1,10 +1,11 @@
 /* $Id:$
 
-1.6 - 8 Mar 2011
-      
-    * Fixed a typo bug. Reported by Wim van der Vegt
-      http://mbed.org/forum/mbed/topic/1798/?page=1#comment-9845
-      
+1.6 - 10 Mar 2011
+
+    * Chaned example2.cpp to read 3 AD inputs rather than two. 
+      I did this to support this issue:-
+      http://mbed.org/forum/mbed/topic/1798/?page=1#comment-9973
+    
 1.5 - 5 Feb 2011
 
     * Found a bug in the NXP library that I had copied over.
--- a/example2.cpp	Tue Mar 08 17:47:43 2011 +0000
+++ b/example2.cpp	Fri Mar 11 13:47:23 2011 +0000
@@ -8,7 +8,7 @@
 #include "mbed.h"
 #include "MODDMA.h"
 
-#define SAMPLE_BUFFER_LENGTH 32
+#define SAMPLE_BUFFER_LENGTH 30
 
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);
@@ -27,7 +27,7 @@
 int main() {
 
     // Create a buffer to hold the ADC samples and clear it.
-    // Note, we are going to sample two ADC inputs so they
+    // Note, we are going to sample three ADC inputs so they
     // end up in this buffer "interleaved". So you will want
     // a buffer twice this size to a real life given sample
     // frequency. See the printf() output for details.
@@ -40,16 +40,18 @@
     
     // Power up the ADC and set PCLK
     LPC_SC->PCONP    |=  (1UL << 12);
-    LPC_SC->PCLKSEL0 &= ~(3UL << 24); // PCLK = CCLK/4 96M/4 = 24MHz
+    LPC_SC->PCLKSEL0 &= ~(3UL << 16); // PCLK = CCLK/4 96M/4 = 24MHz
     
-    // Enable the ADC, 12MHz,  ADC0.0 & .1
-    LPC_ADC->ADCR  = (1UL << 21) | (1UL << 8) | (3UL << 0); 
+    // Enable the ADC, 12MHz,  ADC0.0, .1 & .2
+    LPC_ADC->ADCR  = (1UL << 21) | (1UL << 8) | (7UL << 0); 
     
     // Set the pin functions to ADC
-    LPC_PINCON->PINSEL1 &= ~(3UL << 14);  /* P0.23, Mbed p15. */
+    LPC_PINCON->PINSEL1 &= ~(3UL << 14);  /* P0.23, Mbed p15 AD0.0 */
     LPC_PINCON->PINSEL1 |=  (1UL << 14);
-    LPC_PINCON->PINSEL1 &= ~(3UL << 16);  /* P0.24, Mbed p16. */
+    LPC_PINCON->PINSEL1 &= ~(3UL << 16);  /* P0.24, Mbed p16 AD0.1 */
     LPC_PINCON->PINSEL1 |=  (1UL << 16);
+    LPC_PINCON->PINSEL1 &= ~(3UL << 18);  /* P0.25, Mbed p17 AD0.2 */
+    LPC_PINCON->PINSEL1 |=  (1UL << 18);
     
     // Setup the serial port to print out results.
     pc.baud(115200);
@@ -83,7 +85,7 @@
     // just set the global flag.
     LPC_ADC->ADINTEN = 0x100;
 
-    // Enable burst mode on inputs 0 and 1.
+    // Enable burst mode on inputs 0, 1 and 2.
     LPC_ADC->ADCR |= (1UL << 16); 
     
     while (1) {