Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:6b260c0931c5, committed 2015-08-15
- Comitter:
- vaifreak
- Date:
- Sat Aug 15 05:24:39 2015 +0000
- Child:
- 1:bfbfd6fede05
- Commit message:
- 08/15
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Sat Aug 15 05:24:39 2015 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/chris/code/C12832/#7de323fa46fe
--- /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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Aug 15 05:24:39 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/cd19af002ccc \ No newline at end of file