Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
okano
Date:
Tue Jul 10 03:43:53 2012 +0000
Child:
1:066a5725ea59
Commit message:
with mbed-lib rev28

Changed in this revision

main.cpp 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	Tue Jul 10 03:43:53 2012 +0000
@@ -0,0 +1,37 @@
+//  port speed test program
+//  this code is based on ..
+//    http://mbed.org/users/simon/notebook/busout-portout-digitalout-speedup/
+
+#include "mbed.h"
+
+BusOut bus(P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31);
+PortOut port(Port0, 0x00000FF0);
+DigitalOut out(LED1);
+
+Timer t;
+
+int main() {
+//    printf("    ** port speed test **\r\n");
+
+    t.start();
+    for(int i=0; i<1000000; i++) {
+        bus = 0;
+        bus = 0xFF;
+    }
+    printf("    BusOut  = %8d kHz\r\n",(int)( 1000.0 / t));
+
+    t.reset();
+    for(int i=0; i<1000000; i++) {
+        port = 0;
+        port = 0xFF000000;
+    }
+    printf("    PortOut = %8d kHz\r\n", (int)(1000.0 / t));
+    
+    t.reset();
+    for(int i=0; i<1000000; i++) {
+        out = 0;
+        out = 1;
+    }
+    printf("    DigitalOut = %8d kHz\r\n", (int)(1000.0 / t));
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jul 10 03:43:53 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912