Measure the time interval between two consecutive rising edges

Dependencies:   dispBoB mbed PCA9635

Files at this revision

API Documentation at this revision

Comitter:
d_worrall
Date:
Tue Jul 12 10:04:32 2011 +0000
Parent:
1:b56440e55747
Commit message:

Changed in this revision

intervalMeasure.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r b56440e55747 -r 62e168aedc9a intervalMeasure.cpp
--- a/intervalMeasure.cpp	Mon Jul 11 13:53:32 2011 +0000
+++ b/intervalMeasure.cpp	Tue Jul 12 10:04:32 2011 +0000
@@ -24,9 +24,12 @@
 int main() {
     trigger.mode(PullUp);           //activate internal pull up (hardware specific)
     db.init();                      //ALWAYS initialise the dispBoB 
-    db.cls();                       //clear screen
-    trigger.rise(&trig);            //attach count() to interrupt on rising edge of trigger
+    db.cls();                       
+    trigger.rise(&trig);            //attach trig() to interrupt on rising edge of trigger
 
     db.printf("%06d", t.read_ms()); //print initial time reading (000000)
     
+    //To change the timebase just replace the read_ms() function with
+    //read() for seconds and read_us() for microseconds. These use a 32bit 
+    //int microsecond counter, so have a max time of ~30mins
 }