SEARCH
TOOLBOX
LANGUAGES
modified on 17 September 2014 at 18:06 ••• 30,367 views

04-03 SinusoidWave

From Manuals

(Difference between revisions)
Jump to: navigation, search
 
(2 intermediate revisions not shown)
Line 5: Line 5:
|+ align="bottom"|'''DAC0 Ouput Connector Location'''
|+ align="bottom"|'''DAC0 Ouput Connector Location'''
|'''Signal'''
|'''Signal'''
-
|'''PIN NAME'''
+
|'''LPC4330 PIN NAME'''
|'''BAM210E'''
|'''BAM210E'''
|'''BAM210'''
|'''BAM210'''
Line 36: Line 36:
  }
  }
 +
DAC0 was captured on the oscilloscope in the image below.
[[Image:BAM210_04_03.png|center|]]
[[Image:BAM210_04_03.png|center|]]

Current revision as of 18:06, 17 September 2014

This example outputs a sine wave on the DAC output. The DAC output is on pin A5 of J8.

DAC0 for the MBED-SDK and the Bambino line of microcontrollers is mapped to the following locations:

DAC0 Ouput Connector Location
Signal LPC4330 PIN NAME BAM210E BAM210 BAM200E BAM200
DAC0 P4_4 J8-6 J8-6 S3-5 S3-5
/*Program Example 4.3: Sine wave on DAC output. View on oscilloscope
                                                                           */
#include "mbed.h"
AnalogOut Aout(DAC0);
float i;

int main()
{
    while(1)  {
        for (i=0; i<2; i=i+0.05f) {
            Aout=0.5f+0.5f*sin(i*3.14159f);  // Compute the sine value, + half the range
            wait(.001);                      // Controls the sine wave period
        }
    }
}

DAC0 was captured on the oscilloscope in the image below.