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-10-11
- Revision:
- 7:c3caa8d38ad5
- Parent:
- 6:2199a6874b78
- Child:
- 8:977c197134c5
File content as of revision 7:c3caa8d38ad5:
//----------------------------------------------------------------------
// NUCLEO-F446RE で アナログ信号の入出力の際に,出力の標本化周波数を,
// 入力の標本化周波数の4倍にするクラス F446_Multirate の使用例
//
// 処理の内容:AD 変換器からの入力をそのまま DA 変換器に出力する
//
// 2018/10/11, Copyright (c) 2018 MIKAMI, Naoki
//----------------------------------------------------------------------
#include "F446_Multirate.hpp"
#pragma diag_suppress 870 // マルチバイト文字使用の警告抑制のため
using namespace Mikami;
int main()
{
const int FS = 10000; // 入力の標本化周波数: 10 kHz
F446_Multirate myAdDa; // 出力標本化周波数を4倍にするオブジェクト
printf("\r\n開始します.\r\n");
// F446_Multirate::Start() と F446_Multirate::Input() の間に
// printf() のように重い処理は実行しないこと.
myAdDa.Start(FS); // 標本化を開始する
while (true)
{
//------------------------------------------------------------
// ここにディジタルフィルタ等の処理を記述する
float xn = myAdDa.Input(); // 入力
// wait_us(93); // 標本化周波数が 10 kHz の場合,
// 93 μs 以下の実行時間の信号処理であれば OK
float yn = xn; // これは入力信号に何も処理しない例
myAdDa.Output(yn); // 出力
//------------------------------------------------------------
}
}