受信

Dependencies:   receiver PhaseAccordanceMethod SD mbed

Dependents:   receiver

Files at this revision

API Documentation at this revision

Comitter:
k0050288
Date:
Mon Aug 20 02:35:44 2018 +0000
Commit message:
??

Changed in this revision

ADC.lib Show annotated file Show diff for this revision Revisions of this file
PhaseAccordanceMethod.lib Show annotated file Show diff for this revision Revisions of this file
SD.lib Show annotated file Show diff for this revision Revisions of this file
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
readme.txt Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 26d26a95f6d5 ADC.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ADC.lib	Mon Aug 20 02:35:44 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/1529561000/code/receiver/#c99e4ce26a0c
diff -r 000000000000 -r 26d26a95f6d5 PhaseAccordanceMethod.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PhaseAccordanceMethod.lib	Mon Aug 20 02:35:44 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/k0050288/code/PhaseAccordanceMethod/#05d61debb1fe
diff -r 000000000000 -r 26d26a95f6d5 SD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SD.lib	Mon Aug 20 02:35:44 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/1529561000/code/SD/#db4599aff06a
diff -r 000000000000 -r 26d26a95f6d5 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Aug 20 02:35:44 2018 +0000
@@ -0,0 +1,73 @@
+/*
+** 2018/07/24
+** 受信プログラム
+*/
+
+#include "mbed.h"
+#include "Adc.h"
+#include "PhaseMethod.h"
+#include "SD.h"
+#include "Thermometer.h"
+
+Adc         gAdc;
+PhaseMethod gPhaseMethod;
+SD          gSD;
+Thermometer gThermometer;
+
+/* setting */
+Serial     pc(USBTX, USBRX);
+DigitalIn  btn(USER_BUTTON);  // User button
+DigitalOut startPin(PC_7);
+
+void user_system_create()
+{
+    gAdc.init();
+    gPhaseMethod.init(&gAdc, &gThermometer);
+    gSD.init();
+}
+
+void start()
+{
+    while(btn);
+    startPin = 1;
+}
+
+/* main */
+int main()
+{
+    pc.printf("start\n");
+    /* init */
+    user_system_create();
+
+    /* スタート */
+    start();
+
+    /* ADC */
+    gAdc.read(gAdc.ADCVal, sizeof(gAdc.ADCVal));
+
+    /* 位相一致法 */
+    gPhaseMethod.calculation();
+
+    /* 結果表示 */
+    pc.printf("temp    :%.6lf \n",gThermometer.temp);
+    pc.printf("Q1  :%.6lf\n",gPhaseMethod.Q1);
+    pc.printf("Q2  :%.6lf\n",gPhaseMethod.Q2);
+    pc.printf("I1  :%.6lf\n",gPhaseMethod.I1);
+    pc.printf("I2  :%.6lf\n",gPhaseMethod.I2);
+    pc.printf("txTime  :%.6lf s\n",gPhaseMethod.TxTime);
+    pc.printf("epoch   :%.6lf s\n",gPhaseMethod.epoch);
+    pc.printf("time    :%.6lf s\n",gPhaseMethod.arriveTime);
+    pc.printf("distance:%.6lf mm\n",gPhaseMethod.distance);
+
+    startPin = 0;
+    
+    /* SD保存 */
+    for(int i = 0; i < ADC_TIMES; i++) {
+        gSD.setData(i, gAdc.ADCVal[i]);
+        gSD.write();
+    }
+    
+    gSD.finish();
+    pc.printf("finish\n");
+    
+}
diff -r 000000000000 -r 26d26a95f6d5 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Aug 20 02:35:44 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file
diff -r 000000000000 -r 26d26a95f6d5 readme.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/readme.txt	Mon Aug 20 02:35:44 2018 +0000
@@ -0,0 +1,31 @@
+受信側のプログラム
+
+受信側のUSERボタンを押したらスタートする.
+送信側と有線で同期している.
+受信側;PC_7 送信側:PB_0(A3)
+
+SDcard
+    +--------+
+    |  mbed  |3.3V --+               ,--------+
+    |        |       |           DAT2|9       |
+    |     D10|CS-----|-------------CS|1       |
+    |     D11|MOSI---|------------CMD|2       |
+    |        |       +------------VDD|3   SD  |
+    |     D13|SCK-----------------CLK|4 memory|
+    |        |               +----VSS|5  card |
+    |     D12|MISO-----------|---DAT0|6       |
+    |        |               |   DAT1|7       |
+    |        |               |       |8       |
+    |        |GND------------+       +--------+
+    +--------+
+    VDDとVSSは0.1µFのコンデンサでつなぐ
+
+SDFileSystem sd(D11, D12, D13, D10, "sd");
+SDFileSystem name(mosi, miso, sck, cs, mount);
+
+name:任意の名前
+mosi: MOSIピン
+miso: MISOピン
+sck:  SCKピン
+cs:   CSピン(デジタル出力)
+mount:任意のマウントポイント
\ No newline at end of file