出力計の為に作成した。50ms毎に経過時間を取得して1000ms経過したらそれらの値をsdに保存する。しかし現状として6000ms経過するとプログラムが停止する。

Dependencies:   SDFileSystem mbed

Fork of SDFileSystem_HelloWorld by mbed official

Files at this revision

API Documentation at this revision

Comitter:
Joeatsumi
Date:
Mon Sep 04 06:41:39 2017 +0000
Parent:
2:f8284afcee36
Commit message:
???????????50ms???????????1000ms???????????sd????????????????????

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Sep 03 01:40:21 2017 +0000
+++ b/main.cpp	Mon Sep 04 06:41:39 2017 +0000
@@ -12,7 +12,8 @@
 
 int count =0;//最初はTimeLog[0]から始まる
 
-static unsigned long TimeLog[20];//20個の要素を「箱」を用意する
+//static unsigned long TimeLog[20];//20個の要素を「箱」を用意する
+static unsigned long TimeLog[20];//10個の要素を「箱」を用意する
 unsigned long nowTime = 0;
    
     void SD(){//この関数を0.05秒ごとに呼び出して、その度に経過時間をTimeLog[]に代入する。
@@ -39,7 +40,8 @@
           if(fp == NULL) {
         error("Could not open file for write\n");
              }
-                  fprintf(fp, "%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n",TimeLog[0],TimeLog[1],TimeLog[2],TimeLog[3],TimeLog[4],TimeLog[5],TimeLog[6],TimeLog[7],TimeLog[8],TimeLog[9],TimeLog[10],TimeLog[11],TimeLog[12],TimeLog[13],TimeLog[14],TimeLog[15],TimeLog[16],TimeLog[17],TimeLog[18],TimeLog[19]);
+                  fprintf(fp, "%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n%d\r\n",TimeLog[0],TimeLog[1],TimeLog[2],TimeLog[3],TimeLog[4],TimeLog[5],TimeLog[6],TimeLog[7],TimeLog[8],TimeLog[9]
+                    ,TimeLog[10],TimeLog[11],TimeLog[12],TimeLog[13],TimeLog[14],TimeLog[15],TimeLog[16],TimeLog[17],TimeLog[18],TimeLog[19]);
               myled1 = 1 ;
               fclose(fp); 
               free(fp);
@@ -57,7 +59,7 @@
  int main(){   
         Time.start();
         sd_write.attach(&SD,0.05);//0.05秒ごとにSDという関数を発動し、割り込みする。
-        
+               
     while(1){
         nowTime = Time.read_ms();
         }