![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
solve the time of a loop 0:100
Dependencies: mbed
Fork of Timer_HelloWorld by
Revision 2:c979a2f3b744, committed 2014-10-21
- Comitter:
- shiyilei
- Date:
- Tue Oct 21 15:28:28 2014 +0000
- Parent:
- 1:d76f5570bd21
- Commit message:
- solve the time of a loop
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d76f5570bd21 -r c979a2f3b744 main.cpp --- a/main.cpp Sat Sep 20 23:00:21 2014 +0000 +++ b/main.cpp Tue Oct 21 15:28:28 2014 +0000 @@ -1,10 +1,20 @@ +/************************************** +*file name: base time count +*Creator:JacobShi +*Time:2014/10/20 +*Description: solve the time of a loop + ***************************************/ #include "mbed.h" - Timer t; - -int main() { +int i; +int timedata; +int main(void) +{ + + t.reset(); t.start(); - printf("Hello World!\n"); + for(i=0;i<100;i++); t.stop(); - printf("The time taken was %f seconds\n", t.read()); -} + timedata=t.read_us(); + printf("the time of the loos 0~99 is :%d us\n",timedata); +} \ No newline at end of file