Transistor Gijutsu, October 2014, Special Features Chapter 8,Software of the thermistor thermometer of 0.001 ° resolution, トランジスタ技術2014年10月号 特集第8章のソフトウェア 0.001℃分解能で気配もキャッチ「超敏感肌温度計」

Dependencies:   USBDevice mbed

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月号の記事および上記ファイル中のコメントを参照してください。

Revision:
0:de885a6da962
diff -r 000000000000 -r de885a6da962 ExpAvr/ExpAvr.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ExpAvr/ExpAvr.cpp	Fri Aug 29 08:38:36 2014 +0000
@@ -0,0 +1,23 @@
+#include "ExpAvr.h"
+
+/// 指数平均を行い最新の値を返す
+/// @param double val 入力値
+/// @return double 移動平均後の値
+double ExpAvr::getOutput(double val)
+{
+    int a;
+    // 入力値で初期化
+    if(first){
+        first = false;
+        for(a = 0; a < order; a++){
+            acc[a] = val;
+        }
+        return val;
+    }
+    // 各段の値を計算
+    for(a = 0; a < order; a++){
+        acc[a] = tc * acc[a] + (1.0 - tc) * val;
+        val = acc[a];
+    }
+    return val;
+}