This is a small program we use to see how long something takes. It runs the code in the while loop a lot of times and prints out how many us it took. Then this can be divided by the number of iterations to find the time/clock cycles for each iteration.

Dependencies:   mbed-dsp mbed

Files at this revision

API Documentation at this revision

Comitter:
avbotz
Date:
Mon Jul 08 03:58:56 2013 +0000
Commit message:
Initial commit.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-dsp.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jul 08 03:58:56 2013 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+#include "dsp.h"
+
+Serial pc(USBTX, USBRX);
+DigitalOut myled(LED1);
+Timer tim;
+
+int main() {
+    unsigned int i = 0;
+    
+    q15_t lad[5], ref[6];
+    q15_t state[1029], in[1024], out[1024];
+    // this loop takes 4 assembly instructions to run per cycle
+    // http://www.wolframalpha.com/input/?i=%282731+us%2F65536%29%2F%281%2F24000000Hz%29
+    arm_iir_lattice_instance_q15 filter = {5, state, ref, lad};
+    tim.start();
+    while (i<100) 
+    {
+        arm_iir_lattice_q15(&filter, in, out, 1024);
+        i++;
+    }
+    tim.stop();
+    pc.printf("%d us\n\r",tim.read_us());
+}
+//mbed LPC1768 runs at 96 MHz
+//2731 us=65536 cycles
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-dsp.lib	Mon Jul 08 03:58:56 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-dsp/#fdd22bb7aa52
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jul 08 03:58:56 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5e5da4a5990b
\ No newline at end of file