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
main.cpp
- Committer:
- MikamiUitOpen
- Date:
- 2018-06-15
- Revision:
- 5:aff3a2d4b41f
- Parent:
- 4:ea5c1ccf1c31
- Child:
- 6:2199a6874b78
File content as of revision 5:aff3a2d4b41f:
//----------------------------------------------------------------------
// NUCLEO-F446RE で アナログ信号の入出力の際に,出力の標本化周波数を,
// 入力の標本化周波数の4倍にするクラス F446_Multirate の使用例
//
// 処理の内容:AD 変換器からの入力をそのまま DA 変換器に出力する
//
// 2018/06/15, 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_.Start(FS_); // 標本化を開始する
while (true)
{
//------------------------------------------------------------
// ここにディジタルフィルタ等の処理を記述する
float xn = myAdDa_.Input(); // 入力
// wait_us(93); // 標本化周波数が 10 kHz の場合,
// 93 μs 以下の実行時間の信号処理であれば OK
float yn = xn; // これは入力信号に何も処理しない例
myAdDa_.Output(yn); // 出力
//------------------------------------------------------------
}
}