Transistor Gijutsu, October 2014, Special Features Chapter 8,Software of the thermistor thermometer of 0.001 ° resolution, トランジスタ技術2014年10月号 特集第8章のソフトウェア 0.001℃分解能で気配もキャッチ「超敏感肌温度計」
Information
tg_201410s8_AD7714 トランジスタ技術 2014年 10月号 第8章のソフトウェア
Program for Section 8 in October. 2014 issue of the Transistor Gijutsu
(Japanese electronics magazine)
概要
このプログラムは、サーミスタの抵抗値変化をAD7714(24bitADC)で測定し、抵抗値を温度値に変換することで、0.001℃程度の分解能で温度変化を測定します。
ファイル
このソフトウエアは、次のファイルから構成されています。
- AD7714.cpp - AD7714の内部レジスタを設定
- Thermistor.cpp - サーミスタの抵抗値から温度値に変換
- ExpAvr.cpp - 指数平均によるソフトウエアLPF
- main.cpp - main()関数
詳細については、10月号の記事および上記ファイル中のコメントを参照してください。
ExpAvr/ExpAvr.h
- Committer:
- Dance
- Date:
- 2014-08-29
- Revision:
- 0:de885a6da962
File content as of revision 0:de885a6da962:
#ifndef EXPAVR_H #define EXPAVR_H #include <math.h> #define MathPi (3.1415926535897932384626433832795) /// 指数平均を計算する(実質的なローパスフィルタ) class ExpAvr { private: int order; ///< ローパスフィルタの次数に相当 double tc; ///< 指数平均への増分、CR時定数に相当 double *acc; ///< 中間値を保存 bool first; ///< 初期化が必要かどうかのフラグ public: /// コンストラクタ /// @param order 次数(フィルタの段数) /// @param fcutoff カットオフ周波数[Hz]、fsampleより十分小さいこと。1/10以下を推奨。 /// @param fsample サンプリング周波数[Hz] ExpAvr(int order, double fcutoff, double fsample){ this->order = order; this->tc = exp((-2*fcutoff*MathPi)/fsample); acc = new double[order]; first = true; }; /// 指数平均計算 /// @param d フィルタの入力値 /// @return フィルタの出力値 double getOutput(double d); }; #endif