04-02 SawtoothWave
From Manuals
(Difference between revisions)
(Created page with 'This example outputs a saw tooth wave form on the DAC output. Image:BAM210_04_02.jpeg') |
|||
| (6 intermediate revisions not shown) | |||
| Line 1: | Line 1: | ||
| - | This example outputs a saw tooth wave form on the DAC output. | + | This example outputs a saw tooth wave form on the DAC output. The DAC output is on pin A5 of J8. |
| - | [[Image:BAM210_04_02. | + | DAC0 for the MBED-SDK and the Bambino line of microcontrollers is mapped to the following locations: |
| + | {| border="1" cellpadding="5" cellspacing="2" align="center" style="text-align: center;" | ||
| + | |+ align="bottom"|'''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.2: Sawtooth waveform on DAC output. View on oscilloscope | ||
| + | */ | ||
| + | #include "mbed.h" | ||
| + | AnalogOut Aout(DAC0); | ||
| + | float i; | ||
| + | |||
| + | int main() | ||
| + | { | ||
| + | while(1) { | ||
| + | for (i=0; i<1; i=i+0.1) { // i is incremented in steps of 0.1 | ||
| + | Aout=i; | ||
| + | wait(0.001); // wait 1 millisecond | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | DAC0 was captured on the oscilloscope in the image below. | ||
| + | [[Image:BAM210_04_02.png|center|]] | ||
Current revision as of 18:06, 17 September 2014
This example outputs a saw tooth wave form 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:
| Signal | LPC4330 PIN NAME | BAM210E | BAM210 | BAM200E | BAM200 |
| DAC0 | P4_4 | J8-6 | J8-6 | S3-5 | S3-5 |
/*Program Example 4.2: Sawtooth waveform on DAC output. View on oscilloscope
*/
#include "mbed.h"
AnalogOut Aout(DAC0);
float i;
int main()
{
while(1) {
for (i=0; i<1; i=i+0.1) { // i is incremented in steps of 0.1
Aout=i;
wait(0.001); // wait 1 millisecond
}
}
}
DAC0 was captured on the oscilloscope in the image below.

