From 47aea07e43c5edded31211ce13a502db5501236a Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Fri, 18 Feb 2011 05:26:24 -0500 Subject: Trivial DAC-related updates. --- libmaple/libmaple.h | 2 +- notes/dac.txt | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/libmaple/libmaple.h b/libmaple/libmaple.h index dbc77a4..02e27d3 100644 --- a/libmaple/libmaple.h +++ b/libmaple/libmaple.h @@ -64,7 +64,7 @@ /* Has an FSMC bus? */ #define NR_FSMC 0 - /* Has an FSMC bus? */ + /* Has a DAC? */ #define NR_DAC_PINS 0 /* USB Identifier numbers */ diff --git a/notes/dac.txt b/notes/dac.txt index d027402..e6c9b7b 100644 --- a/notes/dac.txt +++ b/notes/dac.txt @@ -35,6 +35,26 @@ time, as follows: Buffering will be enabled by default. +HOWTOs +------------------------------------------------------------------------------- + +In order to generate a full-amplitude triangle wave: + + - Make the following settings in dac->CR, for the DAC channel you + want: set MAMP to 1011 (amplitude 4095), WAVE to 10 (triangle), + TSEL to 111 (software trigger), TEN to 1 (trigger enabled), and + EN to 1 (chanel enabled). + + - Set dac->DHR12Rx to 0 (where x is your channel). This gets added + to the triangle wave value at each trigger step. + + - Now, forever: set DAC_SWTRIGR_SWTRIGx in dac->SWTRIGR, and wait + for it to get cleared by hardware. + +You can do something similar for noise (by setting WAVE to 01 +instead). You can also cause the waves to advance due to timer events +or external line 9, by making appropriate settings to TSEL. + TODO ------------------------------------------------------------------------------- - sine wave demo using Timer interrupts -- cgit v1.2.3