Guitar Effector using "mbed application board".

Dependencies:   C12832 mbed

Guitar Effector using "mbed application board".

/media/uploads/vaifreak/dscn0187.jpg

/media/uploads/vaifreak/schematic_00.jpg

/media/uploads/vaifreak/schematic_01.jpg

/media/uploads/vaifreak/schematic_02.jpg

Revision:
0:6b260c0931c5
Child:
1:bfbfd6fede05
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Aug 15 05:24:39 2015 +0000
@@ -0,0 +1,79 @@
+#include "mbed.h"
+#include "C12832.h"
+
+C12832 lcd(p5, p7, p6, p8, p11);
+
+//    lcd.cls();
+//    lcd.locate(0,3);
+//    lcd.printf("Analog In Out test.");
+
+Ticker sampling;
+AnalogIn Ain(p17);
+AnalogOut Aout(p18);
+
+/*******************************/
+/* For Test Signal */
+/*******************************/
+#define TEST_SIGNAL_ENABLE (0) // 1 : InternalSinWave for Debug
+#define TEST_SIGNAL_FREQ (1000.0) // Frequency [Hz]
+#define TEST_SIGNAL_AMP (30000.0) // Amplitude
+#define PAI (3.14159)
+
+/*******************************/
+/* For ADC & DAC Setting */
+/*******************************/
+#define SAMPLING_TIME (25.0) // ADC Sampling Rate [us]
+
+volatile unsigned int *g_usiAd0cr, *g_usiAd0dr2; // ADC Reg
+unsigned int *g_usiDacr; // DAC Reg
+unsigned int g_usiFinalOut;
+short g_ssBuff;
+float g_fTestWaveT;
+
+/*******************************/
+/* Effect Process */
+/*******************************/
+void effectProcess() 
+{
+    // Line Out & In
+    *g_usiDacr = g_usiFinalOut;
+    // ADC Start
+    *g_usiAd0cr = 0x01200204;
+    
+#if (TEST_SIGNAL_ENABLE == 1) // Test Signal Sin Wave
+    g_ssBuff = TEST_SIGNAL_AMP * sin(g_fTtestWaveT) - 32768;
+    g_fTestWaveT = g_fTestWaveT + 2.0 * PAI * SAMPLING_TIME * TEST_SIGNAL_FREQ / 1e6;
+    if(g_fTestWaveT >= (2.0 * PAI))g_fTestWaveT = 0;
+#endif
+
+    //
+    // Effect Func();
+    //
+
+#if (TEST_SIGNAL_ENABLE == 0)
+    while(1){
+        if((*g_usiAd0dr2 & 0x80000000) != 0)break; // ADC Finish ?
+    }
+    g_ssBuff = (short)((int)(*g_usiAd0dr2 & 0x0000FFF0) - 32768);
+#endif
+
+    g_usiFinalOut = 0x00010000 | (unsigned int)((int)g_ssBuff + 32768);
+}
+
+
+/*******************************/
+/* MAIN */
+/*******************************/
+int main() {
+
+    g_usiAd0cr = (unsigned int*)0x40034000;
+    g_usiAd0dr2 = (unsigned int*)0x40034018;
+    g_usiDacr = (unsigned int*)0x4008C000;
+    sampling.attach_us(&effectProcess, SAMPLING_TIME);
+
+    while(1){
+    //
+    // Parameter Setting Func()
+    //
+    }
+}
\ No newline at end of file