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

Committer:
Dance
Date:
Fri Aug 29 08:38:36 2014 +0000
Revision:
0:de885a6da962
Transistor Gijutsu, October 2014, Special Features Chapter 8; ????????2014?10??????8????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Dance 0:de885a6da962 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
Dance 0:de885a6da962 2 *
Dance 0:de885a6da962 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
Dance 0:de885a6da962 4 * and associated documentation files (the "Software"), to deal in the Software without
Dance 0:de885a6da962 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
Dance 0:de885a6da962 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Dance 0:de885a6da962 7 * Software is furnished to do so, subject to the following conditions:
Dance 0:de885a6da962 8 *
Dance 0:de885a6da962 9 * The above copyright notice and this permission notice shall be included in all copies or
Dance 0:de885a6da962 10 * substantial portions of the Software.
Dance 0:de885a6da962 11 *
Dance 0:de885a6da962 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
Dance 0:de885a6da962 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Dance 0:de885a6da962 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Dance 0:de885a6da962 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Dance 0:de885a6da962 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Dance 0:de885a6da962 17 */
Dance 0:de885a6da962 18
Dance 0:de885a6da962 19 #ifndef USBBUSINTERFACE_H
Dance 0:de885a6da962 20 #define USBBUSINTERFACE_H
Dance 0:de885a6da962 21
Dance 0:de885a6da962 22 #include "mbed.h"
Dance 0:de885a6da962 23 #include "USBEndpoints.h"
Dance 0:de885a6da962 24 #include "toolchain.h"
Dance 0:de885a6da962 25
Dance 0:de885a6da962 26 //#ifdef __GNUC__
Dance 0:de885a6da962 27 //#define __packed __attribute__ ((__packed__))
Dance 0:de885a6da962 28 //#endif
Dance 0:de885a6da962 29
Dance 0:de885a6da962 30 class USBHAL {
Dance 0:de885a6da962 31 public:
Dance 0:de885a6da962 32 /* Configuration */
Dance 0:de885a6da962 33 USBHAL();
Dance 0:de885a6da962 34 ~USBHAL();
Dance 0:de885a6da962 35 void connect(void);
Dance 0:de885a6da962 36 void disconnect(void);
Dance 0:de885a6da962 37 void configureDevice(void);
Dance 0:de885a6da962 38 void unconfigureDevice(void);
Dance 0:de885a6da962 39 void setAddress(uint8_t address);
Dance 0:de885a6da962 40 void remoteWakeup(void);
Dance 0:de885a6da962 41
Dance 0:de885a6da962 42 /* Endpoint 0 */
Dance 0:de885a6da962 43 void EP0setup(uint8_t *buffer);
Dance 0:de885a6da962 44 void EP0read(void);
Dance 0:de885a6da962 45 void EP0readStage(void);
Dance 0:de885a6da962 46 uint32_t EP0getReadResult(uint8_t *buffer);
Dance 0:de885a6da962 47 void EP0write(uint8_t *buffer, uint32_t size);
Dance 0:de885a6da962 48 void EP0getWriteResult(void);
Dance 0:de885a6da962 49 void EP0stall(void);
Dance 0:de885a6da962 50
Dance 0:de885a6da962 51 /* Other endpoints */
Dance 0:de885a6da962 52 EP_STATUS endpointRead(uint8_t endpoint, uint32_t maximumSize);
Dance 0:de885a6da962 53 EP_STATUS endpointReadResult(uint8_t endpoint, uint8_t *data, uint32_t *bytesRead);
Dance 0:de885a6da962 54 EP_STATUS endpointWrite(uint8_t endpoint, uint8_t *data, uint32_t size);
Dance 0:de885a6da962 55 EP_STATUS endpointWriteResult(uint8_t endpoint);
Dance 0:de885a6da962 56 void stallEndpoint(uint8_t endpoint);
Dance 0:de885a6da962 57 void unstallEndpoint(uint8_t endpoint);
Dance 0:de885a6da962 58 bool realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t options);
Dance 0:de885a6da962 59 bool getEndpointStallState(unsigned char endpoint);
Dance 0:de885a6da962 60 uint32_t endpointReadcore(uint8_t endpoint, uint8_t *buffer);
Dance 0:de885a6da962 61
Dance 0:de885a6da962 62 protected:
Dance 0:de885a6da962 63 virtual void busReset(void){};
Dance 0:de885a6da962 64 virtual void EP0setupCallback(void){};
Dance 0:de885a6da962 65 virtual void EP0out(void){};
Dance 0:de885a6da962 66 virtual void EP0in(void){};
Dance 0:de885a6da962 67 virtual void connectStateChanged(unsigned int connected){};
Dance 0:de885a6da962 68 virtual void suspendStateChanged(unsigned int suspended){};
Dance 0:de885a6da962 69 virtual void SOF(int frameNumber){};
Dance 0:de885a6da962 70
Dance 0:de885a6da962 71 virtual bool EP1_OUT_callback(){return false;};
Dance 0:de885a6da962 72 virtual bool EP1_IN_callback(){return false;};
Dance 0:de885a6da962 73 virtual bool EP2_OUT_callback(){return false;};
Dance 0:de885a6da962 74 virtual bool EP2_IN_callback(){return false;};
Dance 0:de885a6da962 75 virtual bool EP3_OUT_callback(){return false;};
Dance 0:de885a6da962 76 virtual bool EP3_IN_callback(){return false;};
Dance 0:de885a6da962 77 #if !defined(TARGET_STM32F4)
Dance 0:de885a6da962 78 virtual bool EP4_OUT_callback(){return false;};
Dance 0:de885a6da962 79 virtual bool EP4_IN_callback(){return false;};
Dance 0:de885a6da962 80 #if !defined(TARGET_LPC11U24)
Dance 0:de885a6da962 81 virtual bool EP5_OUT_callback(){return false;};
Dance 0:de885a6da962 82 virtual bool EP5_IN_callback(){return false;};
Dance 0:de885a6da962 83 virtual bool EP6_OUT_callback(){return false;};
Dance 0:de885a6da962 84 virtual bool EP6_IN_callback(){return false;};
Dance 0:de885a6da962 85 virtual bool EP7_OUT_callback(){return false;};
Dance 0:de885a6da962 86 virtual bool EP7_IN_callback(){return false;};
Dance 0:de885a6da962 87 virtual bool EP8_OUT_callback(){return false;};
Dance 0:de885a6da962 88 virtual bool EP8_IN_callback(){return false;};
Dance 0:de885a6da962 89 virtual bool EP9_OUT_callback(){return false;};
Dance 0:de885a6da962 90 virtual bool EP9_IN_callback(){return false;};
Dance 0:de885a6da962 91 virtual bool EP10_OUT_callback(){return false;};
Dance 0:de885a6da962 92 virtual bool EP10_IN_callback(){return false;};
Dance 0:de885a6da962 93 virtual bool EP11_OUT_callback(){return false;};
Dance 0:de885a6da962 94 virtual bool EP11_IN_callback(){return false;};
Dance 0:de885a6da962 95 virtual bool EP12_OUT_callback(){return false;};
Dance 0:de885a6da962 96 virtual bool EP12_IN_callback(){return false;};
Dance 0:de885a6da962 97 virtual bool EP13_OUT_callback(){return false;};
Dance 0:de885a6da962 98 virtual bool EP13_IN_callback(){return false;};
Dance 0:de885a6da962 99 virtual bool EP14_OUT_callback(){return false;};
Dance 0:de885a6da962 100 virtual bool EP14_IN_callback(){return false;};
Dance 0:de885a6da962 101 virtual bool EP15_OUT_callback(){return false;};
Dance 0:de885a6da962 102 virtual bool EP15_IN_callback(){return false;};
Dance 0:de885a6da962 103 #endif
Dance 0:de885a6da962 104 #endif
Dance 0:de885a6da962 105
Dance 0:de885a6da962 106 private:
Dance 0:de885a6da962 107 void usbisr(void);
Dance 0:de885a6da962 108 static void _usbisr(void);
Dance 0:de885a6da962 109 static USBHAL * instance;
Dance 0:de885a6da962 110
Dance 0:de885a6da962 111 #if defined(TARGET_LPC11U24)
Dance 0:de885a6da962 112 bool (USBHAL::*epCallback[10 - 2])(void);
Dance 0:de885a6da962 113 #elif defined(TARGET_STM32F4XX)
Dance 0:de885a6da962 114 bool (USBHAL::*epCallback[8 - 2])(void);
Dance 0:de885a6da962 115 #else
Dance 0:de885a6da962 116 bool (USBHAL::*epCallback[32 - 2])(void);
Dance 0:de885a6da962 117 #endif
Dance 0:de885a6da962 118
Dance 0:de885a6da962 119
Dance 0:de885a6da962 120 };
Dance 0:de885a6da962 121 #endif