Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed F446_AD_DA_Multirate
Diff: main.cpp
- Revision:
- 0:6c7b511cf28e
- Child:
- 2:97e3dcf085dc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed May 16 01:42:13 2018 +0000
@@ -0,0 +1,34 @@
+//----------------------------------------------------------------------
+// NUCLEO-F446RE で アナログ信号の入出力の際に,出力の標本化周波数を,
+// 入力の標本化周波数の4倍にするクラス F446_Multirate の使用例
+//
+// 処理の内容:AD 変換器からの入力をそのまま DA 変換器に出力する
+//
+// 2018/05/16, Copyright (c) 2018 MIKAMI, Naoki
+//----------------------------------------------------------------------
+
+#include "F446_Multirate.hpp"
+#pragma diag_suppress 870 // マルチバイト文字使用の警告抑制のため
+
+using namespace Mikami;
+
+const int FS_ = 10000; // 入力の標本化周波数: 10 kHz
+F446_Multirate myAdDa_; // 出力標本化周波数を4倍にするオブジェクト
+
+int main()
+{
+ printf("\r\n開始します.\r\n");
+
+ myAdDa_.SetIntr(FS_); // ADC 変換終了割り込みを使えるようにする
+
+ while (true)
+ {
+ //------------------------------------------------------------
+ // ここにディジタルフィルタ等の処理を記述する
+ float yn = myAdDa_.Input(); // これは入力信号に何も処理しない例
+// wait_us(94); // 標本化周波数が 10 kHz の場合,
+ // 94 μs 以下の実行時間の信号処理であれば OK
+ //------------------------------------------------------------
+ myAdDa_.Output(yn); // 出力
+ }
+}