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-05-19
- Revision:
- 2:97e3dcf085dc
- Parent:
- 0:6c7b511cf28e
- Child:
- 3:85f286a66e7f
File content as of revision 2:97e3dcf085dc:
//----------------------------------------------------------------------
// NUCLEO-F446RE で アナログ信号の入出力の際に,出力の標本化周波数を,
// 入力の標本化周波数の4倍にするクラス F446_Multirate の使用例
//
// 処理の内容:AD 変換器からの入力をそのまま DA 変換器に出力する
//
// 2018/05/19, 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 yn = myAdDa_.Input(); // これは入力信号に何も処理しない例
// wait_us(94); // 標本化周波数が 10 kHz の場合,
// 94 μs 以下の実行時間の信号処理であれば OK
//------------------------------------------------------------
myAdDa_.Output(yn); // 出力
}
}