A collection of Analog Devices drivers for the mbed platform

For additional information check out the mbed page of the Analog Devices wiki: https://wiki.analog.com/resources/tools-software/mbed-drivers-all

Files at this revision

API Documentation at this revision

Comitter:
Adrian Suciu
Date:
Mon Nov 07 16:27:12 2016 +0200
Parent:
32:97d248e81e7f
Commit message:
Added CN0391, CN0396 and CN0397 shields

Changed in this revision

examples/cn0391_example/Makefile Show annotated file Show diff for this revision Revisions of this file
examples/cn0391_example/main.cpp Show annotated file Show diff for this revision Revisions of this file
examples/cn0396_example/Makefile Show annotated file Show diff for this revision Revisions of this file
examples/cn0396_example/main.cpp Show annotated file Show diff for this revision Revisions of this file
examples/cn0397_example/Makefile Show annotated file Show diff for this revision Revisions of this file
examples/cn0397_example/main.cpp Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/Makefile Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/config.h Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/AD7124_Diag.cpp Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/AD7124_Diag.h Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/CN0396_Diag.cpp Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/CN0396_Diag.h Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/CN0397_Diag.cpp Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/CN0397_Diag.h Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/CN0398_Diag.cpp Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/CN0398_Diag.h Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/main.cpp Show annotated file Show diff for this revision Revisions of this file
libraries/AD7798/AD7798.cpp Show annotated file Show diff for this revision Revisions of this file
libraries/AD7798/AD7798.h Show annotated file Show diff for this revision Revisions of this file
libraries/ADT7310/ADT7310.cpp Show annotated file Show diff for this revision Revisions of this file
libraries/ADT7310/ADT7310.h Show annotated file Show diff for this revision Revisions of this file
libraries/CN0391/CN0391.cpp Show annotated file Show diff for this revision Revisions of this file
libraries/CN0391/CN0391.h Show annotated file Show diff for this revision Revisions of this file
libraries/CN0396/CN0396.cpp Show annotated file Show diff for this revision Revisions of this file
libraries/CN0396/CN0396.h Show annotated file Show diff for this revision Revisions of this file
libraries/CN0397/CN0397.cpp Show annotated file Show diff for this revision Revisions of this file
libraries/CN0397/CN0397.h Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/.idea/Thermocouple.iml Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/.idea/misc.xml Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/.idea/modules.xml Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/.idea/workspace.xml Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/Thermocouple.cpp Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/Thermocouple.h Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/Thermocouple_core_cpp.txt Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/Thermocouple_core_h.txt Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/Thermocouple_lut.cpp Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/Thermocouple_lut_core_cpp.txt Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/lut_script.py Show annotated file Show diff for this revision Revisions of this file
libraries/Thermocouple/tc.txt Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/cn0391_example/Makefile	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,97 @@
+# This file was automagically generated by mbed.org. For more information, 
+# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
+
+ifeq ($(OS), Windows_NT)
+  # insert Windows path to arm-none-eabi toolchain
+  GCC_BIN = C:/Program\ Files\ \(x86\)/GNU\ Tools\ ARM\ Embedded/5.2\ 2015q4/bin/
+else
+  # insert Linux path to arm-none-eabi toolchain
+  GCC_BIN = ~/workspace/tools/gcc-arm-none-eabi-5_3-2016q1/bin/
+endif
+
+PROJECT = CN0391-MBED
+ADI_LIBRARIES_PATH = ../../libraries
+MBED_LIBRARIES_PATH = ../../mbed
+OBJECTS = ./main.o $(ADI_LIBRARIES_PATH)/Thermocouple/Thermocouple.o $(ADI_LIBRARIES_PATH)/Thermocouple/Thermocouple_lut.o $(ADI_LIBRARIES_PATH)/AD7124/AD7124.o $(ADI_LIBRARIES_PATH)/CN0391/CN0391.o 
+SYS_OBJECTS = $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ramfunc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/board.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/hal_tick.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/mbed_overrides.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/retarget.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/startup_stm32f411xe.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_can.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cec.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cortex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_crc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma2d.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dsi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_eth.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_msp_template.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_gpio.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hcd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_irda.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_iwdg.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_lptim.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_smartcard.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nand.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nor.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pccard.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_qspi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rng.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sdram.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spdifrx.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sram.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_uart.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_usart.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_wwdg.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fsmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_sdmmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_usb.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/system_stm32f4xx.o 
+INCLUDE_PATHS = -I. -I$(MBED_LIBRARIES_PATH) -I$(ADI_LIBRARIES_PATH) -I$(ADI_LIBRARIES_PATH)/AD7124 -I$(ADI_LIBRARIES_PATH)/Thermocouple -I$(ADI_LIBRARIES_PATH)/AD7124 -I$(ADI_LIBRARIES_PATH)/CN0391 -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4 -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM 
+LIBRARY_PATHS = -L$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM 
+LIBRARIES = -lmbed 
+LINKER_SCRIPT = $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/STM32F411XE.ld
+
+############################################################################### 
+AS      = $(GCC_BIN)arm-none-eabi-as
+CC      = $(GCC_BIN)arm-none-eabi-gcc
+CPP     = $(GCC_BIN)arm-none-eabi-g++
+LD      = $(GCC_BIN)arm-none-eabi-gcc
+OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
+OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
+SIZE    = $(GCC_BIN)arm-none-eabi-size 
+
+ifeq ($(HARDFP),1)
+	FLOAT_ABI = hard
+else
+	FLOAT_ABI = softfp
+endif
+
+
+CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=$(FLOAT_ABI) 
+CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
+CC_SYMBOLS = -DTARGET_RTOS_M4_M7 -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTARGET_NUCLEO_F411RE -D__CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_CORTEX_M -D__FPU_PRESENT=1 -DTARGET_LIKE_CORTEX_M4 -DMBED_BUILD_TIMESTAMP=1458639619.11 -DTARGET_M4 -D__MBED__=1 -DTARGET_STM -DTARGET_STM32F4 -DTARGET_FF_MORPHO -DTOOLCHAIN_GCC -DTARGET_STM32F411RE -DARM_MATH_CM4 
+
+LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(PROJECT).map,--cref
+LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
+
+
+ifeq ($(DEBUG), 1)
+  CC_FLAGS += -DDEBUG -O0
+else
+  CC_FLAGS += -DNDEBUG -Os
+endif
+
+.PHONY: all clean lst size
+
+all: $(PROJECT).bin $(PROJECT).hex size
+
+
+clean:
+	rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS) $(DEPS)
+
+
+.asm.o:
+	$(CC) $(CPU) -c -x assembler-with-cpp -o $@ $<
+.s.o:
+	$(CC) $(CPU) -c -x assembler-with-cpp -o $@ $<
+.S.o:
+	$(CC) $(CPU) -c -x assembler-with-cpp -o $@ $<
+
+.c.o:
+	$(CC)  $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99   $(INCLUDE_PATHS) -o $@ $<
+
+.cpp.o:
+	$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<
+
+
+
+$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
+	$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
+
+
+$(PROJECT).bin: $(PROJECT).elf
+	$(OBJCOPY) -O binary $< $@
+
+$(PROJECT).hex: $(PROJECT).elf
+	@$(OBJCOPY) -O ihex $< $@
+
+$(PROJECT).lst: $(PROJECT).elf
+	@$(OBJDUMP) -Sdh $< > $@
+
+lst: $(PROJECT).lst
+
+size: $(PROJECT).elf
+	$(SIZE) $(PROJECT).elf
+
+DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
+-include $(DEPS)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/cn0391_example/main.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,88 @@
+/**
+*   @file     main.cpp
+*   @brief    Main file for the CN0357-example project
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* Product: www.analog.com/EVAL-CN0357-ARDZ
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(c) Analog Devices, Inc.
+*
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*  - Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*  - Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in
+*    the documentation and/or other materials provided with the
+*    distribution.
+*  - Neither the name of Analog Devices, Inc. nor the names of its
+*    contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*  - The use of this software may or may not infringe the patent rights
+*    of one or more patent holders.  This license does not release you
+*    from the requirement that you obtain separate licenses from these
+*    patent holders to use this software.
+*  - Use of the software either in source or binary form, must be run
+*    on or directly connected to an Analog Devices Inc. component.
+*
+* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+* IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+********************************************************************************/
+#include "mbed.h"
+#include "Thermocouple.h"
+#include "CN0391.h"
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+int main()
+{
+    pc.baud(115200);
+    //Thermocouple *tcarray[4] = {new Thermocouple_Type_E, new Thermocouple_Type_E,new Thermocouple_Type_B,new Thermocouple_Type_B}
+    CN0391 cn0391(D10);
+    pc.printf("Reset the AD7124\r\n");
+    cn0391.reset();
+    wait_ms(500);
+    pc.printf("Init the AD7124\r\n");
+    cn0391.init();
+    wait_ms(500);
+    pc.printf("Done\r\n");
+
+    cn0391.set_thermocouple_type(CN0391::CHANNEL_P1, new Thermocouple_Type_E);
+    cn0391.set_thermocouple_type(CN0391::CHANNEL_P2, new Thermocouple_Type_B);
+    cn0391.set_thermocouple_type(CN0391::CHANNEL_P3, new Thermocouple_Type_J);
+    cn0391.set_thermocouple_type(CN0391::CHANNEL_P4, new Thermocouple_Type_S);
+
+
+
+    pc.printf("Calibration current for channel 1: %f\r\n", cn0391.calibrate(CN0391::CHANNEL_P1));
+    pc.printf("Calibration current for channel 2: %f\r\n", cn0391.calibrate(CN0391::CHANNEL_P2));
+    pc.printf("Calibration current for channel 3: %f\r\n", cn0391.calibrate(CN0391::CHANNEL_P3));
+    pc.printf("Calibration current for channel 4: %f\r\n", cn0391.calibrate(CN0391::CHANNEL_P4));
+    while(1) {
+        pc.printf("Thermocouple temperature channel 1: %f\r\n", cn0391.read_channel(CN0391::CHANNEL_P1));
+        pc.printf("Thermocouple temperature channel 2: %f\r\n", cn0391.read_channel(CN0391::CHANNEL_P2));
+        pc.printf("Thermocouple temperature channel 3: %f\r\n", cn0391.read_channel(CN0391::CHANNEL_P3));
+        pc.printf("Thermocouple temperature channel 4: %f\r\n", cn0391.read_channel(CN0391::CHANNEL_P4));
+
+        pc.printf("\r\n");
+
+        wait_ms(1000);
+    }
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/cn0396_example/Makefile	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,97 @@
+# This file was automagically generated by mbed.org. For more information, 
+# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
+
+ifeq ($(OS), Windows_NT)
+  # insert Windows path to arm-none-eabi toolchain
+  GCC_BIN = C:/Program\ Files\ \(x86\)/GNU\ Tools\ ARM\ Embedded/5.2\ 2015q4/bin/
+else
+  # insert Linux path to arm-none-eabi toolchain
+  GCC_BIN = ~/workspace/tools/gcc-arm-none-eabi-5_3-2016q1/bin/
+endif
+
+PROJECT = CN0396-MBED
+ADI_LIBRARIES_PATH = ../../libraries
+MBED_LIBRARIES_PATH = ../../mbed
+OBJECTS = ./main.o $(ADI_LIBRARIES_PATH)/AD7798/AD7798.o $(ADI_LIBRARIES_PATH)/ADT7310/ADT7310.o $(ADI_LIBRARIES_PATH)/AD5270/AD5270.o $(ADI_LIBRARIES_PATH)/CN0396/CN0396.o 
+SYS_OBJECTS = $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ramfunc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/board.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/hal_tick.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/mbed_overrides.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/retarget.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/startup_stm32f411xe.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_can.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cec.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cortex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_crc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma2d.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dsi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_eth.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_msp_template.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_gpio.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hcd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_irda.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_iwdg.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_lptim.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_smartcard.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nand.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nor.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pccard.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_qspi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rng.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sdram.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spdifrx.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sram.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_uart.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_usart.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_wwdg.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fsmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_sdmmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_usb.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/system_stm32f4xx.o 
+INCLUDE_PATHS = -I. -I$(MBED_LIBRARIES_PATH) -I$(ADI_LIBRARIES_PATH) -I$(ADI_LIBRARIES_PATH)/AD5270 -I$(ADI_LIBRARIES_PATH)/ADT7310 -I$(ADI_LIBRARIES_PATH)/AD7798 -I$(ADI_LIBRARIES_PATH)/CN0396 -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4 -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM 
+LIBRARY_PATHS = -L$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM 
+LIBRARIES = -lmbed 
+LINKER_SCRIPT = $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/STM32F411XE.ld
+
+############################################################################### 
+AS      = $(GCC_BIN)arm-none-eabi-as
+CC      = $(GCC_BIN)arm-none-eabi-gcc
+CPP     = $(GCC_BIN)arm-none-eabi-g++
+LD      = $(GCC_BIN)arm-none-eabi-gcc
+OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
+OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
+SIZE    = $(GCC_BIN)arm-none-eabi-size 
+
+ifeq ($(HARDFP),1)
+	FLOAT_ABI = hard
+else
+	FLOAT_ABI = softfp
+endif
+
+
+CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=$(FLOAT_ABI) 
+CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
+CC_SYMBOLS = -DTARGET_RTOS_M4_M7 -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTARGET_NUCLEO_F411RE -D__CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_CORTEX_M -D__FPU_PRESENT=1 -DTARGET_LIKE_CORTEX_M4 -DMBED_BUILD_TIMESTAMP=1458639619.11 -DTARGET_M4 -D__MBED__=1 -DTARGET_STM -DTARGET_STM32F4 -DTARGET_FF_MORPHO -DTOOLCHAIN_GCC -DTARGET_STM32F411RE -DARM_MATH_CM4 
+
+LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(PROJECT).map,--cref
+LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
+
+
+ifeq ($(DEBUG), 1)
+  CC_FLAGS += -DDEBUG -O0
+else
+  CC_FLAGS += -DNDEBUG -Os
+endif
+
+.PHONY: all clean lst size
+
+all: $(PROJECT).bin $(PROJECT).hex size
+
+
+clean:
+	rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS) $(DEPS)
+
+
+.asm.o:
+	$(CC) $(CPU) -c -x assembler-with-cpp -o $@ $<
+.s.o:
+	$(CC) $(CPU) -c -x assembler-with-cpp -o $@ $<
+.S.o:
+	$(CC) $(CPU) -c -x assembler-with-cpp -o $@ $<
+
+.c.o:
+	$(CC)  $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99   $(INCLUDE_PATHS) -o $@ $<
+
+.cpp.o:
+	$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<
+
+
+
+$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
+	$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
+
+
+$(PROJECT).bin: $(PROJECT).elf
+	$(OBJCOPY) -O binary $< $@
+
+$(PROJECT).hex: $(PROJECT).elf
+	@$(OBJCOPY) -O ihex $< $@
+
+$(PROJECT).lst: $(PROJECT).elf
+	@$(OBJDUMP) -Sdh $< > $@
+
+lst: $(PROJECT).lst
+
+size: $(PROJECT).elf
+	$(SIZE) $(PROJECT).elf
+
+DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
+-include $(DEPS)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/cn0396_example/main.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,65 @@
+/**
+*   @file     main.cpp
+*   @brief    Main file for the CN0357-example project
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* Product: www.analog.com/EVAL-CN0357-ARDZ
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(c) Analog Devices, Inc.
+*
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*  - Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*  - Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in
+*    the documentation and/or other materials provided with the
+*    distribution.
+*  - Neither the name of Analog Devices, Inc. nor the names of its
+*    contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*  - The use of this software may or may not infringe the patent rights
+*    of one or more patent holders.  This license does not release you
+*    from the requirement that you obtain separate licenses from these
+*    patent holders to use this software.
+*  - Use of the software either in source or binary form, must be run
+*    on or directly connected to an Analog Devices Inc. component.
+*
+* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+* IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+********************************************************************************/
+#include "mbed.h"
+#include "CN0396.h"
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+int main()
+{
+    pc.baud(115200);
+    pc.printf("Initializing \r\n");
+    CN0396 cn0396(D10, D6, D4);
+    cn0396.init();
+    wait_ms(500);
+
+    while(1) {
+        cn0396.read();
+        wait_ms(1000);
+    }
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/cn0397_example/Makefile	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,97 @@
+# This file was automagically generated by mbed.org. For more information, 
+# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
+
+ifeq ($(OS), Windows_NT)
+  # insert Windows path to arm-none-eabi toolchain
+  GCC_BIN = C:/Program\ Files\ \(x86\)/GNU\ Tools\ ARM\ Embedded/5.2\ 2015q4/bin/
+else
+  # insert Linux path to arm-none-eabi toolchain
+  GCC_BIN = ~/workspace/tools/gcc-arm-none-eabi-5_3-2016q1/bin/
+endif
+
+PROJECT = CN0397-MBED
+ADI_LIBRARIES_PATH = ../../libraries
+MBED_LIBRARIES_PATH = ../../mbed
+OBJECTS = ./main.o $(ADI_LIBRARIES_PATH)/AD7798/AD7798.o $(ADI_LIBRARIES_PATH)/CN0397/CN0397.o 
+SYS_OBJECTS = $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ramfunc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/board.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/hal_tick.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/mbed_overrides.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/retarget.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/startup_stm32f411xe.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_can.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cec.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cortex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_crc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma2d.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dsi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_eth.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_msp_template.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_gpio.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hcd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_irda.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_iwdg.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_lptim.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_smartcard.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nand.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nor.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pccard.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_qspi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rng.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sdram.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spdifrx.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sram.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_uart.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_usart.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_wwdg.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fsmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_sdmmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_usb.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/system_stm32f4xx.o 
+INCLUDE_PATHS = -I. -I$(MBED_LIBRARIES_PATH) -I$(ADI_LIBRARIES_PATH) -I$(ADI_LIBRARIES_PATH)/AD7798 -I$(ADI_LIBRARIES_PATH)/CN0397 -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4 -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM 
+LIBRARY_PATHS = -L$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM 
+LIBRARIES = -lmbed 
+LINKER_SCRIPT = $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/STM32F411XE.ld
+
+############################################################################### 
+AS      = $(GCC_BIN)arm-none-eabi-as
+CC      = $(GCC_BIN)arm-none-eabi-gcc
+CPP     = $(GCC_BIN)arm-none-eabi-g++
+LD      = $(GCC_BIN)arm-none-eabi-gcc
+OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
+OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
+SIZE    = $(GCC_BIN)arm-none-eabi-size 
+
+ifeq ($(HARDFP),1)
+	FLOAT_ABI = hard
+else
+	FLOAT_ABI = softfp
+endif
+
+
+CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=$(FLOAT_ABI) 
+CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
+CC_SYMBOLS = -DTARGET_RTOS_M4_M7 -DTARGET_FF_ARDUINO -DTOOLCHAIN_GCC_ARM -DTARGET_NUCLEO_F411RE -D__CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_CORTEX_M -D__FPU_PRESENT=1 -DTARGET_LIKE_CORTEX_M4 -DMBED_BUILD_TIMESTAMP=1458639619.11 -DTARGET_M4 -D__MBED__=1 -DTARGET_STM -DTARGET_STM32F4 -DTARGET_FF_MORPHO -DTOOLCHAIN_GCC -DTARGET_STM32F411RE -DARM_MATH_CM4 
+
+LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=$(PROJECT).map,--cref
+LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
+
+
+ifeq ($(DEBUG), 1)
+  CC_FLAGS += -DDEBUG -O0
+else
+  CC_FLAGS += -DNDEBUG -Os
+endif
+
+.PHONY: all clean lst size
+
+all: $(PROJECT).bin $(PROJECT).hex size
+
+
+clean:
+	rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS) $(DEPS)
+
+
+.asm.o:
+	$(CC) $(CPU) -c -x assembler-with-cpp -o $@ $<
+.s.o:
+	$(CC) $(CPU) -c -x assembler-with-cpp -o $@ $<
+.S.o:
+	$(CC) $(CPU) -c -x assembler-with-cpp -o $@ $<
+
+.c.o:
+	$(CC)  $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99   $(INCLUDE_PATHS) -o $@ $<
+
+.cpp.o:
+	$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<
+
+
+
+$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
+	$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
+
+
+$(PROJECT).bin: $(PROJECT).elf
+	$(OBJCOPY) -O binary $< $@
+
+$(PROJECT).hex: $(PROJECT).elf
+	@$(OBJCOPY) -O ihex $< $@
+
+$(PROJECT).lst: $(PROJECT).elf
+	@$(OBJDUMP) -Sdh $< > $@
+
+lst: $(PROJECT).lst
+
+size: $(PROJECT).elf
+	$(SIZE) $(PROJECT).elf
+
+DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
+-include $(DEPS)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/cn0397_example/main.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,65 @@
+/**
+*   @file     main.cpp
+*   @brief    Main file for the CN0397-example project
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* Product: www.analog.com/EVAL-CN0397-ARDZ
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(c) Analog Devices, Inc.
+*
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*  - Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*  - Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in
+*    the documentation and/or other materials provided with the
+*    distribution.
+*  - Neither the name of Analog Devices, Inc. nor the names of its
+*    contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*  - The use of this software may or may not infringe the patent rights
+*    of one or more patent holders.  This license does not release you
+*    from the requirement that you obtain separate licenses from these
+*    patent holders to use this software.
+*  - Use of the software either in source or binary form, must be run
+*    on or directly connected to an Analog Devices Inc. component.
+*
+* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+* IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+********************************************************************************/
+#include "mbed.h"
+#include "CN0397.h"
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+int main()
+{
+    pc.baud(115200);
+    CN0397 cn0397(D10);
+    cn0397.init();
+    wait_ms(500);
+
+    while(1) {
+        cn0397.set_app_data();
+        cn0397.display_data();
+        wait_ms(1000);
+    }
+    return 0;
+}
--- a/examples/drvdiag/Makefile	Wed Oct 26 16:47:55 2016 +0300
+++ b/examples/drvdiag/Makefile	Mon Nov 07 16:27:12 2016 +0200
@@ -13,9 +13,9 @@
 ADI_LIBRARIES_PATH = ../../libraries
 MBED_LIBRARIES_PATH = ../../mbed
 DRIVER_WRAPPER_PATH = ./driver_wrapper
-OBJECTS = ./main.o $(ADI_LIBRARIES_PATH)/ADXL362/ADXL362.o $(DRIVER_WRAPPER_PATH)/ADXL362_Diag.o $(DRIVER_WRAPPER_PATH)/CN0357_Diag.o $(DRIVER_WRAPPER_PATH)/CN0216_Diag.o $(DRIVER_WRAPPER_PATH)/AD7790_Diag.o $(DRIVER_WRAPPER_PATH)/AD7791_Diag.o $(DRIVER_WRAPPER_PATH)/AD5270_Diag.o $(ADI_LIBRARIES_PATH)/AD7790/AD7790.o $(ADI_LIBRARIES_PATH)/AD7791/AD7791.o $(ADI_LIBRARIES_PATH)/AD5270/AD5270.o $(ADI_LIBRARIES_PATH)/CN0357/CN0357.o $(ADI_LIBRARIES_PATH)/CN0216/CN0216.o
+OBJECTS = ./main.o $(ADI_LIBRARIES_PATH)/ADT7310/ADT7310.o $(ADI_LIBRARIES_PATH)/CN0396/CN0396.o $(DRIVER_WRAPPER_PATH)/CN0396_Diag.o $(DRIVER_WRAPPER_PATH)/CN0397_Diag.o $(DRIVER_WRAPPER_PATH)/CN0398_Diag.o $(ADI_LIBRARIES_PATH)/CN0396/CN0396.o $(ADI_LIBRARIES_PATH)/CN0397/CN0397.o $(ADI_LIBRARIES_PATH)/CN0398/CN0398.o $(ADI_LIBRARIES_PATH)/Thermocouple/Thermocouple.o $(ADI_LIBRARIES_PATH)/Thermocouple/Thermocouple_lut.o $(ADI_LIBRARIES_PATH)/AD7798/AD7798.o $(ADI_LIBRARIES_PATH)/AD7124/AD7124.o $(ADI_LIBRARIES_PATH)/ADXL362/ADXL362.o $(DRIVER_WRAPPER_PATH)/AD7124_Diag.o $(DRIVER_WRAPPER_PATH)/ADXL362_Diag.o $(DRIVER_WRAPPER_PATH)/CN0357_Diag.o $(DRIVER_WRAPPER_PATH)/CN0216_Diag.o $(DRIVER_WRAPPER_PATH)/AD7790_Diag.o $(DRIVER_WRAPPER_PATH)/AD7791_Diag.o $(DRIVER_WRAPPER_PATH)/AD5270_Diag.o $(ADI_LIBRARIES_PATH)/AD7790/AD7790.o $(ADI_LIBRARIES_PATH)/AD7791/AD7791.o $(ADI_LIBRARIES_PATH)/AD5270/AD5270.o $(ADI_LIBRARIES_PATH)/CN0357/CN0357.o $(ADI_LIBRARIES_PATH)/CN0216/CN0216.o
 SYS_OBJECTS = $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ramfunc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/board.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/cmsis_nvic.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/hal_tick.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/mbed_overrides.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/retarget.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/startup_stm32f411xe.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_adc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_can.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cec.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cortex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_crc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_cryp_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dac_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dcmi_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma2d.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dma_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_dsi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_eth.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_flash_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_fmpi2c.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_msp_template.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_gpio.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hash_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_hcd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2c_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_i2s_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_irda.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_iwdg.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_lptim.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_ltdc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_smartcard.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nand.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_nor.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pccard.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pcd_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_pwr_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_qspi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rcc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rng.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_rtc_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sai_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sd.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sdram.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spdifrx.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_spi.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_sram.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_tim_ex.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_uart.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_usart.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_hal_wwdg.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_fsmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_sdmmc.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/stm32f4xx_ll_usb.o $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/system_stm32f4xx.o 
-INCLUDE_PATHS = -I. -I$(MBED_LIBRARIES_PATH) -I$(ADI_LIBRARIES_PATH) -I$(ADI_LIBRARIES_PATH)/ADXL362 -I$(ADI_LIBRARIES_PATH)/AD5270 -I$(ADI_LIBRARIES_PATH)/AD7790 -I$(ADI_LIBRARIES_PATH)/AD7791 -I$(ADI_LIBRARIES_PATH)/CN0357 -I$(ADI_LIBRARIES_PATH)/CN0216 -I$(DRIVER_WRAPPER_PATH) -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4 -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM 
+INCLUDE_PATHS = -I. -I$(MBED_LIBRARIES_PATH) -I$(ADI_LIBRARIES_PATH) -I$(ADI_LIBRARIES_PATH)/CN0396 -I$(ADI_LIBRARIES_PATH)/ADT7310 -I$(ADI_LIBRARIES_PATH)/CN0396 -I$(ADI_LIBRARIES_PATH)/CN0397  -I$(ADI_LIBRARIES_PATH)/CN0398 -I$(ADI_LIBRARIES_PATH)/Thermocouple -I$(ADI_LIBRARIES_PATH)/ADXL362 -I$(ADI_LIBRARIES_PATH)/AD7798 -I$(ADI_LIBRARIES_PATH)/AD7124 -I$(ADI_LIBRARIES_PATH)/AD5270 -I$(ADI_LIBRARIES_PATH)/AD7790 -I$(ADI_LIBRARIES_PATH)/AD7791 -I$(ADI_LIBRARIES_PATH)/CN0357 -I$(ADI_LIBRARIES_PATH)/CN0216 -I$(DRIVER_WRAPPER_PATH) -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4 -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE -I$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM 
 LIBRARY_PATHS = -L$(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM 
 LIBRARIES = -lmbed 
 LINKER_SCRIPT = $(MBED_LIBRARIES_PATH)/TARGET_NUCLEO_F411RE/TOOLCHAIN_GCC_ARM/STM32F411XE.ld
@@ -45,9 +45,9 @@
 
 
 ifeq ($(DEBUG), 1)
-  CC_FLAGS += -DDEBUG -Og
+  CC_FLAGS += -DDEBUG -g3
 else
-  CC_FLAGS += -DNDEBUG -Og
+  CC_FLAGS += -DDEBUG -g3
 endif
 
 .PHONY: all clean lst size
--- a/examples/drvdiag/config.h	Wed Oct 26 16:47:55 2016 +0300
+++ b/examples/drvdiag/config.h	Mon Nov 07 16:27:12 2016 +0200
@@ -50,7 +50,11 @@
 //#define AD7790_PRESENT
 //#define AD5270_PRESENT
 //#define CN0357_PRESENT
-#define ADXL362_PRESENT
+//#define ADXL362_PRESENT
+//#define CN0398_PRESENT
+//#define CN0397_PRESENT
+#define CN0396_PRESENT
+//#define AD7124_PRESENT
 #define SPI_LOW_LEVEL
 
 #ifdef AD7791_PRESENT
@@ -83,6 +87,27 @@
 #include "ADXL362_Diag.h"
 #endif
 
+#ifdef AD7124_PRESENT
+#include "AD7124.h"
+#include "AD7124_Diag.h"
+#endif
+
+#ifdef CN0398_PRESENT
+#include "CN0398.h"
+#include "CN0398_Diag.h"
+#endif
+
+
+#ifdef CN0397_PRESENT
+#include "CN0397.h"
+#include "CN0397_Diag.h"
+#endif
+
+#ifdef CN0396_PRESENT
+#include "CN0396.h"
+#include "CN0396_Diag.h"
+#endif
+
 using namespace std;
 //------------------------------------
 // Hyperterminal configuration
@@ -91,7 +116,7 @@
 
 #ifdef SPI_LOW_LEVEL
 //DigitalOut CSA_pin(D8); // cs adc
-DigitalOut CSA_pin(D9); // cs accel
+DigitalOut CSA_pin(D4); // cs accel
 DigitalOut CSR_pin(D6); // cs rdac
 SPI spibus(SPI_MOSI, SPI_MISO, SPI_SCK);
 #endif
@@ -127,3 +152,27 @@
 ADXL362 adxl362(D9);
 ADXL362_Diag adxl362diag(adxl362);
 #endif
+
+
+#ifdef  AD7124_PRESENT
+AD7124 ad7124(D10);
+AD7124_Diag ad7124diag(ad7124);
+#endif
+
+#ifdef CN0398_PRESENT
+CN0398 cn0398(D10);
+CN0398_Diag cn0398diag(cn0398);
+
+#endif
+
+#ifdef CN0397_PRESENT
+CN0397 cn0397(D10);
+CN0397_Diag cn0397diag(cn0397);
+#endif
+
+#ifdef CN0396_PRESENT
+#include "AD5270_Diag.h"
+CN0396 cn0396(D10, D6, D4);
+CN0396_Diag cn0396diag(cn0396);
+AD5270_Diag ad5270diag(cn0396.rdac);
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/AD7124_Diag.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,454 @@
+/**
+ *   @file     ad7124_diag.cpp
+ *   @brief    Source file for the AD7124 wrapper used by the driver diag
+ *   @author   Analog Devices Inc.
+ *
+ * For support please go to:
+ * Github: https://github.com/analogdevicesinc/mbed-adi
+ * Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+ * More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+ ********************************************************************************
+ * Copyright 2016(c) Analog Devices, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  - Neither the name of Analog Devices, Inc. nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *  - The use of this software may or may not infringe the patent rights
+ *    of one or more patent holders.  This license does not release you
+ *    from the requirement that you obtain separate licenses from these
+ *    patent holders to use this software.
+ *  - Use of the software either in source or binary form, must be run
+ *    on or directly connected to an Analog Devices Inc. component.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ********************************************************************************/
+
+#include "mbed.h"
+#include <stdio.h>
+#include <vector>
+#include <string>
+#include "AD7124_Diag.h"
+
+#include "../../../libraries/Thermocouple/Thermocouple.h"
+
+
+extern Serial pc;
+extern vector<string> cmdbuffer;
+
+//#define CALIBRATION
+
+AD7124_Diag::AD7124_Diag(AD7124& ad) :
+    dut(ad)
+{
+
+}
+
+void AD7124_Diag::setup()
+{
+    dut.frequency(500000);
+    dut.Setup();
+}
+
+void AD7124_Diag::mvpInit()
+{
+    uint32_t setValue;
+    enum AD7124::ad7124_registers regNr;
+    dut.frequency(500000);
+
+    /* Set Config_0 0x19*/
+    regNr = AD7124::AD7124_Config_0;               //Select Config_0 register
+    setValue = dut.ReadDeviceRegister(regNr);
+    setValue |= AD7124_CFG_REG_BIPOLAR;     //Select bipolar operation
+    setValue |= AD7124_CFG_REG_BURNOUT(0);  //Burnout current source off
+    setValue |= AD7124_CFG_REG_REF_BUFP;
+    setValue |= AD7124_CFG_REG_REF_BUFM;
+    setValue |= AD7124_CFG_REG_AIN_BUFP;    //Buffer AIN5
+    setValue |= AD7124_CFG_REG_AINN_BUFM;   //Buffer AIN4
+    setValue |= AD7124_CFG_REG_REF_SEL(2); //Select REFIN1(+)/REFIN1(-)  internal reference
+    setValue |= AD7124_CFG_REG_PGA(0);
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    /* Set Channel_0 register 0x09*/
+    regNr = AD7124::AD7124_Channel_0;
+    setValue = dut.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(0);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_1;
+    setValue = dut.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(1);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_2;
+    setValue = dut.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(2);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_3;
+    setValue = dut.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(3);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_4;
+    setValue = dut.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(4);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+
+    regNr = AD7124::AD7124_Channel_5;
+    setValue = dut.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(5);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+
+    regNr = AD7124::AD7124_Channel_6;
+    setValue = dut.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(6);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_7;
+    setValue = dut.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(7);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_8;
+    setValue = dut.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(14);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+
+    /* Set Config_0 0x19*/
+#if 0
+    regNr = AD7124::AD7124_Config_1;               //Select Config_0 register
+    setValue = dut.ReadDeviceRegister(regNr);
+    setValue |= AD7124_CFG_REG_BIPOLAR;     //Select bipolar operation
+    setValue |= AD7124_CFG_REG_BURNOUT(0);  //Burnout current source off
+    setValue |= AD7124_CFG_REG_REF_BUFP;
+    setValue |= AD7124_CFG_REG_REF_BUFM;
+    setValue |= AD7124_CFG_REG_AIN_BUFP;    //Buffer AIN5
+    setValue |= AD7124_CFG_REG_AINN_BUFM;   //Buffer AIN4
+    setValue |= AD7124_CFG_REG_REF_SEL(2); //Select REFIN1(+)/REFIN1(-)  internal reference
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+#endif
+
+#ifdef  CALIBRATION
+    // start calibration
+    regNr = AD7124::AD7124_Offset_0;
+    setValue = 0x800000;
+    dut.WriteDeviceRegister(regNr, setValue);// Write data to ADC
+
+// internal fullscale before zero scale
+    pc.printf("\r\n Gain before cali :%x", dut.ReadDeviceRegister(AD7124::AD7124_Gain_0));
+    regNr = AD7124::AD7124_ADC_Control;//Select ADC_Control register
+    setValue = AD7124_ADC_CTRL_REG_MODE(6);
+    setValue |= AD7124_ADC_CTRL_REG_REF_EN;
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);// Write data to ADC
+    //dut.WaitForConvReady(10000);
+    wait_ms(2000);
+
+    pc.printf("\r\n Gain:%x", dut.ReadDeviceRegister(AD7124::AD7124_Gain_0));
+
+    pc.printf("\r\n Offset before cali:%x", dut.ReadDeviceRegister(AD7124::AD7124_Offset_0));
+// internal zeroscale
+    regNr = AD7124::AD7124_ADC_Control;//Select ADC_Control register
+    setValue = AD7124_ADC_CTRL_REG_MODE(5);
+    setValue |= AD7124_ADC_CTRL_REG_REF_EN;
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);// Write data to ADC
+    wait_ms(2000);
+    pc.printf("\r\n Offset:%x\r\n", dut.ReadDeviceRegister(AD7124::AD7124_Offset_0));
+
+    // end of calibration
+
+#endif
+
+    /* Set IO_Control_1 0x03 */
+    regNr = AD7124::AD7124_IOCon1;               //Select IO_Control_1 register
+    setValue = dut.ReadDeviceRegister(regNr);
+    setValue |= AD7124_IO_CTRL1_REG_IOUT0(0x4);// set IOUT0 current to 500uA
+    setValue |= AD7124_IO_CTRL1_REG_IOUT_CH0(0x1);
+    setValue &= 0xFFFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);// Write data to ADC
+#if 0
+    setValue = 0;
+    regNr = AD7124::AD7124_Channel_1;
+
+    /* Set Channel_1 register 0x0A*/
+
+    setValue = dut.ReadDeviceRegister( regNr );
+    setValue |= (uint32_t)AD7124_CH_MAP_REG_CH_ENABLE;//Enable channel1
+    setValue |= AD7124_CH_MAP_REG_SETUP(1);// Select setup1
+    setValue |= AD7124_CH_MAP_REG_AINP(2);// Set AIN2 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(1);// Set AIN1 as negative input
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);// Write data to ADC
+
+    /* Set Config_1 0x1A*/
+    regNr = AD7124::AD7124_Config_1;               //Select Config_1 register
+    setValue = dut.ReadDeviceRegister(regNr);
+    setValue |= AD7124_CFG_REG_BIPOLAR;//Select bipolar operation
+    setValue |= AD7124_CFG_REG_BURNOUT(0);//Burnout current source off
+    setValue |= AD7124_CFG_REG_REF_BUFP;
+    setValue |= AD7124_CFG_REG_REF_BUFM;
+    setValue |= AD7124_CFG_REG_AIN_BUFP;//Buffer AIN2
+    setValue |= AD7124_CFG_REG_AINN_BUFM;//Buffer AIN1
+    setValue |= AD7124_CFG_REG_REF_SEL(2);//Select internal reference
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);// Write data to ADC
+#endif
+
+    /* Set ADC_Control 0x01 */
+    regNr = AD7124::AD7124_ADC_Control;            //Select ADC_Control register
+    setValue = dut.ReadDeviceRegister(regNr);
+    setValue |= AD7124_ADC_CTRL_REG_DATA_STATUS; // set data status bit in order to check on which channel the conversion is
+    setValue |= AD7124_ADC_CTRL_REG_REF_EN;
+    setValue &= 0xFFC3;
+    setValue |= AD7124_ADC_CTRL_REG_MODE(1);
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);    // Write data to ADC
+}
+
+void AD7124_Diag::write_reg()
+{
+    uint8_t reg = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    uint32_t regData = strtol(cmdbuffer[2].c_str(), NULL, 16);
+    //dut.write_reg(reg, regData);
+    dut.WriteDeviceRegister(static_cast<AD7124::ad7124_registers>(reg),
+                            regData);
+    pc.printf("Wrote mode");
+}
+void AD7124_Diag::read_reg()
+{
+    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    pc.printf("Mode reg: %x ",
+              dut.ReadDeviceRegister(
+                  static_cast<AD7124::ad7124_registers>(regVal)));
+}
+void AD7124_Diag::reset()
+{
+    dut.frequency(500000);
+    dut.Reset();
+    pc.printf("Reseted AD7124");
+}
+
+float AD7124_Diag::data_to_voltage(uint32_t data)
+{
+    data = data & 0xFFFFFF;
+    return ((data / static_cast<float>(0xFFFFFF / 2)) - 1) * (2.5 / 1);
+}
+
+void AD7124_Diag::enable_channel(int channel)
+{
+    AD7124::ad7124_registers regNr = static_cast<AD7124::ad7124_registers> (AD7124::AD7124_Channel_0 + channel); //Select ADC_Control register
+    uint32_t setValue = dut.ReadDeviceRegister(regNr);
+    setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);    // Write data to ADC
+}
+
+void AD7124_Diag::disable_channel(int channel)
+{
+    AD7124::ad7124_registers regNr = static_cast<AD7124::ad7124_registers> (AD7124::AD7124_Channel_0 + channel); //Select ADC_Control register
+    uint32_t setValue = dut.ReadDeviceRegister(regNr);
+    setValue &= (~(uint32_t) AD7124_CH_MAP_REG_CH_ENABLE);  //Enable channel0
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);    // Write data to ADC
+}
+
+void AD7124_Diag::enable_current_source(int current_source_channel)
+{
+    AD7124::ad7124_registers regNr = AD7124::AD7124_IOCon1; //Select ADC_Control register
+    uint32_t setValue = dut.ReadDeviceRegister(regNr);
+    setValue &= ~(AD7124_IO_CTRL1_REG_IOUT_CH0(0xF));
+    setValue |= AD7124_IO_CTRL1_REG_IOUT_CH0(current_source_channel);// set IOUT0 current to 500uA
+    setValue &= 0xFFFFFF;
+
+    dut.WriteDeviceRegister(regNr, setValue);    // Write data to ADC
+    pc.printf("Enabled 500uA current source on channel %d\r\n", current_source_channel);
+}
+
+
+#define R2 (1600.0)
+#define RTD_SLOPE (15/39.0)
+#define RTD_CONSTANT (1039.0)
+#define RTD_CONVERSION(R1) RTD_SLOPE * (R1-RTD_CONSTANT)
+float convert_rtd(float volt, float current)
+{
+    float R1 = (volt / current) - R2;
+    float temp = RTD_CONVERSION(R1);
+    pc.printf("Resistance of RTD is: %f\r\n", R1);
+    pc.printf("Temperature is: %f\r\n", temp);
+//	pc.printf("mV equivalent(poly method) of thermocouple is %f \r\n",Thermocouple_Type_E::convert_inv(temp));
+//	pc.printf("mV equivalent(lut method) of thermocouple is %f \r\n",Thermocouple_Type_E::lookup_inv(temp));
+
+    return 0;
+}
+
+float cal_current(float volt, float current)
+{
+    float cal_current = volt / R2;
+    pc.printf("Calibrated current = %f mA \r\n", (cal_current * 1000.0));
+    return cal_current;
+}
+
+float dummy(float volt, float current)
+{
+    /* Nothing to do */
+    return volt;
+}
+
+float convert_thermocouple_e(float volt, float current)
+{
+    float mv = volt * 1000;
+    pc.printf("Voltage in mv = %f\r\n", mv);
+//	pc.printf("Temperature(lookup) in celsius = %f\r\n", Thermocouple_Type_E::lookup(mv));
+//	pc.printf("Temperature(poly) in celsius = %f\r\n\r\n", Thermocouple_Type_E::convert(mv));
+    return 0;
+}
+
+float convert_thermocouple_k(float volt, float current)
+{
+    float mv = volt * 1000;
+    pc.printf("Voltage in mv = %f\r\n", mv);
+//	pc.printf("Temperature(lookup) in celsius = %f\r\n", Thermocouple_Type_K::lookup(mv));
+//	pc.printf("Temperature(poly) in celsius = %f\r\n\r\n", Thermocouple_Type_K::convert(mv));
+    return 0;
+}
+
+
+float (*conversion_fkt[9])(float volt, float current) = {convert_thermocouple_e, convert_rtd, convert_thermocouple_k, convert_rtd, dummy, convert_rtd, dummy, convert_rtd, cal_current};
+float conversion_results[9];
+
+void AD7124_Diag::start_single_conversion()
+{
+    AD7124::ad7124_registers regNr = AD7124::AD7124_ADC_Control; //Select ADC_Control register
+    uint32_t setValue = dut.ReadDeviceRegister(regNr);
+    setValue &= 0xFFC3;
+    setValue |= 0x04;               //single conversion;
+    setValue |= 0x1600;
+    setValue &= 0xFFFF;
+    dut.WriteDeviceRegister(regNr, setValue);    // Write data to ADC*/
+    wait_ms(1);
+}
+
+void AD7124_Diag::read_data()
+{
+    int32_t data;
+    float volt;
+    float cal_current = 0;
+
+    for(int i = 0; i < 8; i++) {
+        if(i % 2 == 0) {
+            //enable_current_source(i+1);
+        } else {
+            enable_current_source(i);
+            enable_channel(8); // calibration channel
+            start_single_conversion();
+            if (dut.WaitForConvReady(10000) == -3) {
+                pc.printf("TIMEOUT");
+                return;
+            }
+
+            dut.ReadData(&data);
+            disable_channel(8);
+
+            pc.printf("Channel: %d\r\n", data & 0xff);
+            pc.printf("Data reg: %x \r\n", data);
+            volt = data_to_voltage(data >> 8);
+            pc.printf("Voltage = %f\r\n", volt);
+            cal_current = conversion_fkt[8](volt, 0);
+            conversion_results[8] = cal_current;
+
+        }
+
+        enable_channel(i);
+        start_single_conversion();
+
+
+        if (dut.WaitForConvReady(10000) == -3) {
+            pc.printf("TIMEOUT");
+            return;
+        }
+
+        dut.ReadData(&data);
+
+        disable_channel(i);
+
+
+        pc.printf("Channel: %d\r\n", data & 0xff);
+        pc.printf("Data reg: %x \r\n", data);
+        volt = data_to_voltage(data >> 8);
+        pc.printf("Voltage = %f\r\n", volt);
+        conversion_results[i] = conversion_fkt[i](volt, cal_current);
+        pc.printf("\r\n");
+
+    }
+}
+
+void AD7124_Diag::read_volt()
+{
+    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    pc.printf("Data reg: %x ",
+              dut.ReadDeviceRegister(
+                  static_cast<AD7124::ad7124_registers>(regVal)));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/AD7124_Diag.h	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,74 @@
+/**
+*   @file     ad7124_diag.h
+*   @brief    Header file for the AD7124 wrapper used by the driver diag
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(c) Analog Devices, Inc.
+*
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*  - Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*  - Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in
+*    the documentation and/or other materials provided with the
+*    distribution.
+*  - Neither the name of Analog Devices, Inc. nor the names of its
+*    contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*  - The use of this software may or may not infringe the patent rights
+*    of one or more patent holders.  This license does not release you
+*    from the requirement that you obtain separate licenses from these
+*    patent holders to use this software.
+*  - Use of the software either in source or binary form, must be run
+*    on or directly connected to an Analog Devices Inc. component.
+*
+* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+* IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+********************************************************************************/
+
+#ifndef AD7124_DIAG_H_
+#define AD7124_DIAG_H_
+#include "AD7124.h"
+
+class AD7124_Diag
+{
+public:
+    AD7124_Diag(AD7124& ad);
+
+    void setup();
+    void mvpInit();
+    void enable_channel(int channel);
+    void disable_channel(int channel);
+    void enable_current_source(int current_source_channel);
+    void write_reg();
+    void read_reg();
+    void reset();
+    void read_data();
+    void read_volt();
+    void start_single_conversion();
+    float data_to_voltage(uint32_t data);
+
+private:
+    AD7124& dut;
+};
+
+
+#endif /* AD5270_DIAG_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/CN0396_Diag.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,5 @@
+#include "CN0396_Diag.h"
+
+
+CN0396_Diag::CN0396_Diag(CN0396& ad) : dut(ad) {}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/CN0396_Diag.h	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,67 @@
+/**
+*   @file     ad7124_diag.h
+*   @brief    Header file for the AD7124 wrapper used by the driver diag
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(c) Analog Devices, Inc.
+*
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*  - Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*  - Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in
+*    the documentation and/or other materials provided with the
+*    distribution.
+*  - Neither the name of Analog Devices, Inc. nor the names of its
+*    contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*  - The use of this software may or may not infringe the patent rights
+*    of one or more patent holders.  This license does not release you
+*    from the requirement that you obtain separate licenses from these
+*    patent holders to use this software.
+*  - Use of the software either in source or binary form, must be run
+*    on or directly connected to an Analog Devices Inc. component.
+*
+* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+* IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+********************************************************************************/
+
+#ifndef CN0396_DIAG_H_
+#define CN0396_DIAG_H_
+#include "CN0396.h"
+#include <mbed.h>
+
+class CN0396_Diag
+{
+public:
+    CN0396_Diag(CN0396& ad);
+
+    /*   void init();
+       void read();
+       void reset();*/
+    CN0396& dut;
+private:
+
+
+};
+
+
+#endif /* AD5270_DIAG_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/CN0397_Diag.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,24 @@
+#include "CN0397_Diag.h"
+
+CN0397_Diag::CN0397_Diag(CN0397& ad) :
+    dut(ad)
+{
+
+}
+
+void CN0397_Diag::init()
+{
+    dut.init();
+}
+
+void CN0397_Diag::reset()
+{
+    dut.ad7798.reset();
+}
+
+void CN0397_Diag::read()
+{
+    dut.set_app_data();
+    dut.display_data();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/CN0397_Diag.h	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,68 @@
+/**
+*   @file     ad7124_diag.h
+*   @brief    Header file for the AD7124 wrapper used by the driver diag
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(c) Analog Devices, Inc.
+*
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*  - Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*  - Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in
+*    the documentation and/or other materials provided with the
+*    distribution.
+*  - Neither the name of Analog Devices, Inc. nor the names of its
+*    contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*  - The use of this software may or may not infringe the patent rights
+*    of one or more patent holders.  This license does not release you
+*    from the requirement that you obtain separate licenses from these
+*    patent holders to use this software.
+*  - Use of the software either in source or binary form, must be run
+*    on or directly connected to an Analog Devices Inc. component.
+*
+* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+* IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+********************************************************************************/
+
+#ifndef CN0398_DIAG_H_
+#define CN0398_DIAG_H_
+#include "CN0397.h"
+#include "AD7798.h"
+#include <mbed.h>
+
+class CN0397_Diag
+{
+public:
+    CN0397_Diag(CN0397& ad);
+
+    void init();
+    void read();
+    void reset();
+
+private:
+    CN0397& dut;
+
+};
+
+
+#endif /* AD5270_DIAG_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/CN0398_Diag.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,331 @@
+/**
+ *   @file     ad7124_diag.cpp
+ *   @brief    Source file for the AD7124 wrapper used by the driver diag
+ *   @author   Analog Devices Inc.
+ *
+ * For support please go to:
+ * Github: https://github.com/analogdevicesinc/mbed-adi
+ * Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+ * More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+ ********************************************************************************
+ * Copyright 2016(c) Analog Devices, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  - Neither the name of Analog Devices, Inc. nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *  - The use of this software may or may not infringe the patent rights
+ *    of one or more patent holders.  This license does not release you
+ *    from the requirement that you obtain separate licenses from these
+ *    patent holders to use this software.
+ *  - Use of the software either in source or binary form, must be run
+ *    on or directly connected to an Analog Devices Inc. component.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ********************************************************************************/
+
+#include "mbed.h"
+#include <stdio.h>
+#include <vector>
+#include <string>
+#include "CN0398_Diag.h"
+
+#include "Thermocouple.h"
+
+
+extern Serial pc;
+extern vector<string> cmdbuffer;
+
+//#define CALIBRATION
+#define VH400
+//#define EC5
+
+
+CN0398_Diag::CN0398_Diag(CN0398& ad) :
+    dut(ad), offset_voltage(default_offset_voltage)
+{
+    calibration_ph[0][0] = default_calibration_ph[0][0];
+    calibration_ph[0][1] = default_calibration_ph[0][1];
+    calibration_ph[1][0] = default_calibration_ph[1][0];
+    calibration_ph[1][1] = default_calibration_ph[1][1];
+}
+
+void CN0398_Diag::init()
+{
+    dut.reset();
+    dut.setup();
+    dut.init();
+}
+
+
+void CN0398_Diag::write_reg()
+{
+    uint8_t reg = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    uint32_t regData = strtol(cmdbuffer[2].c_str(), NULL, 16);
+    //dut.write_reg(reg, regData);
+    dut.ad7124.WriteDeviceRegister(static_cast<AD7124::ad7124_registers>(reg),
+                                   regData);
+    pc.printf("Wrote mode");
+}
+void CN0398_Diag::read_reg()
+{
+    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    pc.printf("Mode reg: %x ",
+              dut.ad7124.ReadDeviceRegister(
+                  static_cast<AD7124::ad7124_registers>(regVal)));
+}
+void CN0398_Diag::reset()
+{
+    dut.ad7124.frequency(500000);
+    dut.ad7124.Reset();
+    pc.printf("Reseted AD7124");
+    wait_ms(500);
+}
+
+float CN0398_Diag::data_to_voltage(uint32_t data)
+{
+    data = data & 0xFFFFFF;
+    return ((data / static_cast<float>(0xFFFFFF / 2)) - 1) * (2.5 / 1);
+}
+
+void CN0398_Diag::enable_channel(int channel)
+{
+    dut.enable_channel(channel);
+}
+
+void CN0398_Diag::disable_channel(int channel)
+{
+    dut.disable_channel(channel);
+}
+
+void CN0398_Diag::enable_current_source()
+{
+    dut.enable_current_source0(11);
+    dut.enable_current_source1(12);
+    pc.printf("Enabled 500uA current sources on channel 11, 12\r\n");
+}
+
+void CN0398_Diag::toggle_output(int channel, uint8_t state)
+{
+    dut.set_digital_output(static_cast<CN0398::ad_digital_output_t>(channel), state);
+}
+
+
+void CN0398_Diag::readt()
+{
+
+    //enable_current_source();
+    enable_channel(2);
+    //wait_ms(100);
+    start_single_conversion();
+    //wait_ms(100);
+    if (dut.ad7124.WaitForConvReady(10000) == -3) {
+        pc.printf("TIMEOUT");
+        return;
+    }
+    int32_t data;
+    dut.ad7124.ReadData(&data);
+    disable_channel(2);
+
+    pc.printf("Channel: %d\r\n", data & 0xff);
+    pc.printf("Data reg: %x \r\n", data);
+    float volt = dut.data_to_voltage(data >> 8, 16);
+    pc.printf("Voltage = %f\r\n", volt);
+    data = (data >> 8) & 0x00ffffff;
+    float a1 = (static_cast<float>(data) - (1 << 23));
+    float a2 = a1 * 5000;
+    float a3 = 16.0 * (1 << 23);
+
+    float resistance = a2 / a3; //((data- (1<<23)) * 5000.0) / 16.0*(1<<23) ;
+    pc.printf("Resistance: %f\r\n", resistance);
+    pc.printf("Temperature = %f\r\n", (resistance - 100.0) / 0.385);
+
+}
+
+void CN0398_Diag::readm()
+{
+
+    toggle_output(0, 1);
+#ifdef EC5
+    wait_ms(10);
+#endif
+    enable_channel(1);
+    //wait_ms(100);
+    start_single_conversion();
+    //wait_ms(100);
+    if (dut.ad7124.WaitForConvReady(10000) == -3) {
+        pc.printf("TIMEOUT");
+        return;
+    }
+    int32_t data;
+    dut.ad7124.ReadData(&data);
+    disable_channel(1);
+    toggle_output(0, 0);
+
+    pc.printf("Channel: %d\r\n", data & 0xff);
+    pc.printf("Data reg: %x \r\n", data);
+    float volt = dut.data_to_voltage(data >> 8, 16);
+    pc.printf("Voltage = %f\r\n", volt);
+    data = (data >> 8) & 0x00ffffff;
+
+
+    float moisture;
+#ifdef VH400
+    moisture = -1.18467 + 21.5371 * volt - 110.996 * (pow(volt, 2)) + 397.025 * (pow(volt, 3)) - 666.986 * (pow(volt, 4)) + 569.236 * (pow(volt, 5)) - 246.005 * (pow(volt, 6)) + 49.4867 * (pow(volt, 7)) - 3.37077 * (pow(volt, 8));
+#elif EC5
+    moisture = 0.000992 * (volt * 1000) - 0.45;
+#endif
+    pc.printf("Moisture = %f\r\n", moisture);
+
+
+
+}
+
+void CN0398_Diag::offsetph()
+{
+    enable_channel(0);
+    //wait_ms(100);
+    start_single_conversion();
+    //wait_ms(100);
+    if (dut.ad7124.WaitForConvReady(10000) == -3) {
+        pc.printf("TIMEOUT");
+        return;
+    }
+    int32_t data;
+    dut.ad7124.ReadData(&data);
+    disable_channel(0);
+    pc.printf("Channel: %d\r\n", data & 0xff);
+    pc.printf("Data reg: %x \r\n", data);
+    float volt = dut.data_to_voltage(data >> 8, 1);
+    pc.printf("Voltage = %f\r\n", volt);
+    offset_voltage = volt;
+
+}
+
+void CN0398_Diag::calibp(int point)
+{
+    calibration_ph[point][0] =  strtof(cmdbuffer[1].c_str(), NULL);
+    enable_channel(0);
+    start_single_conversion();
+    if (dut.ad7124.WaitForConvReady(10000) == -3) {
+        pc.printf("TIMEOUT");
+        return;
+    }
+    int32_t data;
+    dut.ad7124.ReadData(&data);
+    disable_channel(0);
+    pc.printf("Channel: %d\r\n", data & 0xff);
+    pc.printf("Data reg: %x \r\n", data);
+    float volt = dut.data_to_voltage(data >> 8, 1);
+    pc.printf("Voltage = %f\r\n", volt);
+    calibration_ph[point][1] =  volt;
+
+}
+void CN0398_Diag::readp()
+{
+    enable_channel(0);
+    start_single_conversion();
+    if (dut.ad7124.WaitForConvReady(10000) == -3) {
+        pc.printf("TIMEOUT");
+        return;
+    }
+    int32_t data;
+    dut.ad7124.ReadData(&data);
+    disable_channel(0);
+    pc.printf("Channel: %d\r\n", data & 0xff);
+    pc.printf("Data reg: %x \r\n", data);
+    float volt = dut.data_to_voltage(data >> 8, 1);
+    pc.printf("Voltage = %f\r\n", volt);
+    float m =  (calibration_ph[1][0] - calibration_ph[0][0]) / (calibration_ph[1][1] - calibration_ph[0][1]);
+    pc.printf("pH = %f", m * (volt - calibration_ph[1][1]) + calibration_ph[1][0]);
+
+}
+
+
+void CN0398_Diag::start_single_conversion()
+{
+    dut.start_single_conversion();
+}
+
+/*void CN0398_Diag::read_data()
+{
+    int32_t data;
+    float volt;
+    float cal_current = 0;
+
+    for(int i = 0; i < 8; i++) {
+        if(i % 2 == 0) {
+            //enable_current_source(i+1);
+        } else {
+            enable_current_source(i);
+            enable_channel(8); // calibration channel
+            start_single_conversion();
+            if (dut.WaitForConvReady(10000) == -3) {
+                pc.printf("TIMEOUT");
+                return;
+            }
+
+            dut.ReadData(&data);
+            disable_channel(8);
+
+            pc.printf("Channel: %d\r\n", data & 0xff);
+            pc.printf("Data reg: %x \r\n", data);
+            volt = data_to_voltage(data >> 8);
+            pc.printf("Voltage = %f\r\n", volt);
+            cal_current = conversion_fkt[8](volt, 0);
+            conversion_results[8] = cal_current;
+
+        }
+
+        enable_channel(i);
+        start_single_conversion();
+
+
+        if (dut.WaitForConvReady(10000) == -3) {
+            pc.printf("TIMEOUT");
+            return;
+        }
+
+        dut.ReadData(&data);
+
+        disable_channel(i);
+
+
+        pc.printf("Channel: %d\r\n", data & 0xff);
+        pc.printf("Data reg: %x \r\n", data);
+        volt = data_to_voltage(data >> 8);
+        pc.printf("Voltage = %f\r\n", volt);
+        conversion_results[i] = conversion_fkt[i](volt, cal_current);
+        pc.printf("\r\n");
+
+    }
+}
+
+void CN0398_Diag::read_volt()
+{
+    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    pc.printf("Data reg: %x ",
+              dut.ReadDeviceRegister(
+                  static_cast<AD7124::ad7124_registers>(regVal)));
+}
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/CN0398_Diag.h	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,86 @@
+/**
+*   @file     ad7124_diag.h
+*   @brief    Header file for the AD7124 wrapper used by the driver diag
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(c) Analog Devices, Inc.
+*
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*  - Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*  - Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in
+*    the documentation and/or other materials provided with the
+*    distribution.
+*  - Neither the name of Analog Devices, Inc. nor the names of its
+*    contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*  - The use of this software may or may not infringe the patent rights
+*    of one or more patent holders.  This license does not release you
+*    from the requirement that you obtain separate licenses from these
+*    patent holders to use this software.
+*  - Use of the software either in source or binary form, must be run
+*    on or directly connected to an Analog Devices Inc. component.
+*
+* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+* IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+********************************************************************************/
+
+#ifndef CN0398_DIAG_H_
+#define CN0398_DIAG_H_
+#include "CN0398.h"
+#include "AD7124.h"
+
+class CN0398_Diag
+{
+public:
+    CN0398_Diag(CN0398& ad);
+
+    void init();
+    void enable_channel(int channel);
+    void disable_channel(int channel);
+    void enable_current_source();
+    void toggle_output(int channel, uint8_t state);
+    void readt();
+
+    void readm();
+    void offsetph();
+    void calibp(int point);
+    void readp();
+
+    void write_reg();
+    void read_reg();
+    void reset();
+    /* void read_data();
+     void read_volt();*/
+    void start_single_conversion();
+    float data_to_voltage(uint32_t data);
+
+private:
+    CN0398& dut;
+    const float default_offset_voltage = -0.000136;
+    float offset_voltage;
+    float default_calibration_ph[2][2] = {{4, 0.114451051}, {10, -0.0795903802}};
+    float calibration_ph[2][2];
+};
+
+
+#endif /* AD5270_DIAG_H_ */
--- a/examples/drvdiag/main.cpp	Wed Oct 26 16:47:55 2016 +0300
+++ b/examples/drvdiag/main.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -53,6 +53,7 @@
 #include "config.h"
 
 Serial pc(SERIAL_TX, SERIAL_RX);
+Serial test(D8, D2);
 vector<string> cmdbuffer;
 
 class commands
@@ -65,11 +66,13 @@
     void (*fktPtr)(void);
 };
 
+
 // *INDENT-OFF*
 const vector<commands> cmdlist = {
 		{"nop" ,            0, [](){ }},
+		/*
 		{"echo",commands::VAR, [](){ 	for(auto i = begin(cmdbuffer) + 1, e = end(cmdbuffer); i!=e; ++i) 
-										printf("%s ", i->c_str()); printf("\r\n");}},
+										printf("%s ", i->c_str()); printf("\r\n");}},*/
 
 		{"help",           0 , [](){ 	for(auto command : cmdlist) 
 										pc.printf("%s ",command.cmd_str.c_str()); }},
@@ -159,12 +162,100 @@
 		{"xlfr16", 0, [](){adxl362diag.fifo_read_u16();           }},
 		{"xlfrs",  0, [](){adxl362diag.fifo_scan();               }},
 		{"xlintinit",0,[](){adxl362diag.intinit();}},
-		{"xlawake",0,[](){adxl362diag.checkawake();}
-		},
+		{"xlawake",0,[](){adxl362diag.checkawake();}},
+#endif
+
+
+// UART
+		{"uart" ,     0,   [](){test.putc('\n');}},
+		{"uartecho" ,     1,   [](){test.printf(cmdbuffer[1].c_str());}},
+		{"uartlisten",0 ,  [](){
+			  char buff[100] = {0};
+			    size_t readPosition = 0;
+
+			    // read from console until newline
+			    while(1) {
+			    	buff[readPosition] = test.getc();
+			        if(buff[readPosition] == '\n' || buff[readPosition] == '\r') {
+			        	buff[readPosition] = ' ';
+			            break;
+			        }
+			        readPosition++;
+			    }
+			    readPosition++;
+			    buff[readPosition] = '\0';
+			    //create std::string from char buffer
+
+			pc.printf("%s",buff);}},
+
+#ifdef AD7124_PRESENT
+		{"adrst" ,      0,   [](){ad7124diag.reset();}},
+		{"adrd"  ,    1,   [](){ad7124diag.read_reg();}},
+		{"adrdd"  ,    0,   [](){ad7124diag.read_data();}},
+		{"adrdv"  ,    0,   [](){ad7124diag.read_volt();}},
+		{"adwr"  ,      2,   [](){ad7124diag.write_reg();}},
+		{"adsetup",0,[]() {ad7124diag.setup();pc.printf("setup done\r\n");ad7124diag.mvpInit();pc.printf("init done\r\n");}}
+
 
 
 #endif
 
+#ifdef CN0398_PRESENT
+		{"cnrst" ,      0,   [](){cn0398diag.reset();}},
+		{"cnrd"  ,    1,   [](){cn0398diag.read_reg();}},
+		/*{"cnrdd"  ,    0,   [](){ad7124diag.read_data();}},
+		{"cnrdv"  ,    0,   [](){ad7124diag.read_volt();}},*/
+		{"cnwr"  ,      2,   [](){cn0398diag.write_reg();}},
+		{"cnsetup",0,[]() {cn0398diag.init();pc.printf("init done\r\n");}},
+		{"cnled0",1,[]() {cn0398diag.toggle_output(1,strtol(cmdbuffer[1].c_str(), NULL, 16)); pc.printf("LED1 toggled"); }},
+		{"cnled1",1,[]() {cn0398diag.toggle_output(2,strtol(cmdbuffer[1].c_str(), NULL, 16));pc.printf("LED2 toggled");}},
+		{"cnoffp",0,[]() {cn0398diag.offsetph();pc.printf("OffsetVoltage measured");}},
+		{"cnpcal0",1,[]() {cn0398diag.calibp(0);pc.printf("calibration point 0");}},
+		{"cnpcal1",1,[]() {cn0398diag.calibp(1);pc.printf("calibration point 1");}},
+		{"cnreadp",0,[]() {cn0398diag.readp();pc.printf("calibration point 1");}},
+		{"cnreadm",0,[]() {cn0398diag.readm();pc.printf("calibration point 1");}},
+		{"cnreadt",0,[]() {cn0398diag.readt();pc.printf("Temperature Read");}},
+
+
+
+
+#endif
+
+#ifdef CN0397_PRESENT
+		{"cnrst" ,      0,   [](){cn0397diag.reset();}},
+	/*	{"cnrd"  ,    1,   [](){cn0397diag.read_reg();}},
+		{"cnwr"  ,      2,   [](){cn0397diag.write_reg();}},*/
+		{"cnsetup",0,[]() {cn0397diag.init();pc.printf("init done\r\n");}},
+		{"cnread",0,[]() {cn0397diag.read();pc.printf("calibration point 1");}},
+#endif
+
+#ifdef CN0396_PRESENT
+		{"cntrst" ,      0,   [](){pc.printf("reset temp sensor \r\n");cn0396diag.dut.temp.reset();}},
+		{"cntrds" ,      0,   [](){pc.printf("temp status: %x \r\n",cn0396diag.dut.temp.read_status());}},
+		{"cntrdt" ,      0,   [](){pc.printf("temp val: %x \r\n",cn0396diag.dut.temp.read_temp());}},
+		{"cntrdc" ,      0,   [](){pc.printf("temp val: %x \r\n",cn0396diag.dut.temp.read_config());}},
+		{"cntwcf" ,      1,   [](){pc.printf("wrote config: %x \r\n",strtol(cmdbuffer[1].c_str(), NULL, 16));
+									cn0396diag.dut.temp.write_config(strtol(cmdbuffer[1].c_str(), NULL, 16));}},
+		{"cnardi" ,      0,   [](){pc.printf("adid : %x \r\n",cn0396diag.dut.ad.get_register_value(3,1,true));}},
+
+				{"rdwrr" ,       1,   [](){pc.printf("aa");ad5270diag.write_RDAC();}},
+				{"rdrdr" ,       0,   [](){ad5270diag.read_RDAC();}},
+				{"rdwrcmd" ,     2,   [](){ad5270diag.write_cmd();}},
+				{"rdsetz" ,      0,   [](){ad5270diag.set_HiZ();}},
+				{"rd50en",       0,   [](){ad5270diag.enable_50TP_programming();}},
+				{"rd50ds",       0,   [](){ad5270diag.disable_50TP_programming();}},
+				{"rd50st",       0,   [](){ad5270diag.store_50TP();}},
+				{"rd50a" ,       0,   [](){ad5270diag.read_50TP_last_address();}},
+				{"rd50m" ,       1,   [](){ad5270diag.read_50TP_memory();}},
+				{"rdwrc" ,       1,   [](){ad5270diag.write_ctrl_reg();}},
+				{"rdrdc" ,       0,   [](){ad5270diag.read_ctrl_reg();}},
+				{"rdrst" ,       0,   [](){ad5270diag.reset_RDAC();}},
+				{"rdchm" ,       1,   [](){ad5270diag.change_mode();}},
+				{"rdwrw" ,       1,   [](){ad5270diag.write_wiper_reg();}},
+				{"rdrdw" ,       0,   [](){ad5270diag.read_wiper_reg();}},
+
+
+#endif
 };
 // *INDENT-ON*
 
@@ -223,6 +314,8 @@
 int main()
 
 {
+    pc.baud(115200);
+    test.baud(76800);
     // ad7791.frequency(100000);
     pc.printf("\r\n#### DrvDiag ####\r\n");
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/AD7798/AD7798.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,350 @@
+/***************************************************************************//**
+ *   @file   AD7798.c
+ *   @brief  Implementation of AD7798 Driver.
+ *   @author
+********************************************************************************
+ * Copyright 2012(c) Analog Devices, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  - Neither the name of Analog Devices, Inc. nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *  - The use of this software may or may not infringe the patent rights
+ *    of one or more patent holders.  This license does not release you
+ *    from the requirement that you obtain separate licenses from these
+ *    patent holders to use this software.
+ *  - Use of the software either in source or binary form, must be run
+ *    on or directly connected to an Analog Devices Inc. component.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+********************************************************************************
+ *   SVN Revision: 577
+*******************************************************************************/
+
+/******************************************************************************/
+/* Include Files                                                              */
+/******************************************************************************/
+#include "AD7798.h"				// AD7798 definitions.
+#include <stdio.h>
+
+
+/***************************************************************************//**
+ * @brief Initializes the AD7798 and checks if the device is present.
+ *
+ * @param None.
+ *
+ * @return status - Result of the initialization procedure.
+ *                  Example: 1 - if initialization was successful (ID is 0x0B).
+ *                           0 - if initialization was unsuccessful.
+*******************************************************************************/
+AD7798::AD7798( PinName CS, PinName MOSI, PinName MISO, PinName SCK):
+    /*miso(MISO),*/ ad7798(MOSI, MISO, SCK), cs(CS)
+{
+    cs = true; // cs is active low
+    ad7798.format(8, _SPI_MODE);
+}
+uint8_t AD7798::init(void)
+{
+    unsigned char status = 0x1;
+
+    if ((get_register_value (AD7798_REG_ID, 1) & 0x0F) != AD7798_ID) {
+        status = 0x0;
+    }
+
+    return(status);
+}
+
+/***************************************************************************//**
+ * @brief Sends 32 consecutive 1's on SPI in order to reset the part.
+ *
+ * @param None.
+ *
+ * @return  None.
+*******************************************************************************/
+void AD7798::frequency(int hz)
+{
+    ad7798.frequency(hz);
+}
+void AD7798::reset(void)
+{
+    unsigned char dataToSend[4] = {0xFF, 0xFF, 0xFF, 0xFF};
+
+    spi_write(dataToSend, 4);
+
+    wait_ms(500);
+
+}
+/***************************************************************************//**
+ * @brief Reads the value of the selected register
+ *
+ * @param regAddress - The address of the register to read.
+ * @param size - The size of the register to read.
+ *
+ * @return data - The value of the selected register register.
+*******************************************************************************/
+uint16_t AD7798::get_register_value(uint8_t regAddress, uint8_t size, bool toggle_cs)
+{
+    unsigned char data[size];
+    uint16_t receivedData = 0x00;
+    unsigned char byte;
+
+    data[0] = AD7798_COMM_READ |  AD7798_COMM_ADDR(regAddress);
+
+    spi_read(data, size, toggle_cs);
+
+    receivedData = data[0];
+
+    if(size > 1) {
+
+        for(byte = 1; byte < size; byte++) {
+            receivedData = (receivedData << (byte * 8) | data[byte]);
+        }
+    }
+    return receivedData;
+}
+/***************************************************************************//**
+ * @brief Writes the value to the register
+ *
+ * @param -  regAddress - The address of the register to write to.
+ * @param -  regValue - The value to write to the register.
+ * @param -  size - The size of the register to write.
+ *
+ * @return  None.
+*******************************************************************************/
+void AD7798::set_register_value(uint8_t regAddress, uint16_t regValue,
+                                uint8_t size, bool toggle_cs)
+{
+    uint8_t data[size + 1];
+    uint8_t byte;
+    uint16_t mask;
+
+    data[0] = AD7798_COMM_WRITE |  AD7798_COMM_ADDR(regAddress);
+
+    if(size == 1) {
+
+        mask = 0x00FF;
+
+    } else {
+
+        mask = 0xFF00;
+    }
+
+    for(byte = 1; byte <= size; byte++) {
+        data[byte] = (uint8_t)((regValue & mask) >> ((size - byte) * 8));
+        mask = mask >> (byte * 8);
+    }
+
+    spi_write(data, (1 + size), toggle_cs);
+
+
+}
+/***************************************************************************//**
+ * @brief Reads /RDY bit of status reg.
+ *
+ * @param None.
+ *
+ * @return rdy	- 0 if RDY is 1.
+ *              - 1 if RDY is 0.
+*******************************************************************************/
+uint8_t AD7798::ready(void)
+{
+
+    while((get_register_value( AD7798_REG_STAT, 1) & 0x80) != 0x80);
+
+    return(1);
+}
+
+/***************************************************************************//**
+ * @brief Sets the operating mode of AD7798.
+ *
+ * @param mode - Mode of operation.
+ *
+ * @return  None.
+*******************************************************************************/
+void AD7798::set_mode(uint8_t mode)
+{
+    unsigned long command;
+    command = get_register_value(AD7798_REG_MODE, 2);
+    command &= ~AD7798_MODE_SEL(0xFF);
+    command |= AD7798_MODE_SEL(mode);
+    set_register_value(
+        AD7798_REG_MODE,
+        command,
+        2
+    );
+}
+/***************************************************************************//**
+ * @brief Selects the channel of AD7798.
+ *
+ * @param  channel - ADC channel selection.
+ *
+ * @return  None.
+*******************************************************************************/
+void AD7798::set_channel(uint8_t channel)
+{
+    unsigned long command;
+    command = get_register_value(AD7798_REG_CONF, 2);
+    command &= ~AD7798_CONF_CHAN(0xFF);
+    command |= AD7798_CONF_CHAN(channel);
+    set_register_value(
+        AD7798_REG_CONF,
+        command,
+        2
+    );
+}
+
+/***************************************************************************//**
+ * @brief  Sets the gain of the In-Amp.
+ *
+ * @param  gain - Gain.
+ *
+ * @return  None.
+*******************************************************************************/
+void AD7798::set_gain(uint16_t gain)
+{
+    uint16_t command;
+    command = get_register_value(AD7798_REG_CONF, 2);
+    command &= ~AD7798_CONF_GAIN(0xFF);
+    command |= AD7798_CONF_GAIN(gain);
+    set_register_value(
+        AD7798_REG_CONF,
+        command,
+        2
+    );
+}
+
+void AD7798::set_filter(uint8_t filter)
+{
+    unsigned long command;
+    command = get_register_value(AD7798_REG_MODE, 2);
+    command &= ~AD7798_MODE_RATE(0x0F);
+    command |= AD7798_MODE_RATE(filter);
+    set_register_value(
+        AD7798_REG_MODE,
+        command,
+        2
+    );
+}
+/***************************************************************************//**
+ * @brief Enables or disables the reference detect function.
+ *
+ * @param state - State of the reference detect function.
+ *               Example: 0	- Reference detect disabled.
+ *                        1	- Reference detect enabled.
+ *
+ * @return None.
+*******************************************************************************/
+void AD7798::set_reference(uint8_t state)
+{
+    unsigned long command = 0;
+    command = get_register_value(AD7798_REG_CONF, 2);
+    command &= ~AD7798_CONF_REFDET(1);
+    command |= AD7798_CONF_REFDET(state);
+    set_register_value(AD7798_REG_CONF,
+                       command,
+                       2);
+}
+
+void AD7798::set_coding_mode(uint8_t mode)
+{
+    uint16_t command;
+
+    command = get_register_value(AD7798_REG_CONF, 2);
+
+    if(mode == AD7798_BIPOLAR) {
+
+        command &= ~AD7798_CONF_UNIPOLAR;
+
+    } else if(mode == AD7798_UNIPOLAR) {
+
+        command |= AD7798_CONF_UNIPOLAR;
+    }
+    set_register_value(
+        AD7798_REG_CONF,
+        command,
+        2
+    );
+}
+
+void AD7798::set_burnout_current(uint8_t select)
+{
+    uint16_t command;
+
+    command = get_register_value(AD7798_REG_CONF, 2);
+
+    if(select == AD7798_DISABLE)
+        command &= ~AD7798_CONF_BO_EN;
+    else if(select == AD7798_ENABLE)
+        command |= AD7798_CONF_BO_EN;
+
+    set_register_value(
+        AD7798_REG_CONF,
+        command,
+        2
+    );
+}
+
+uint8_t AD7798::spi_read(uint8_t *data, uint8_t bytes_number, bool toggle_cs)
+{
+    cs = false & toggle_cs;
+    data[0] = ad7798.write(data[0]);
+    for(uint8_t byte = 1; byte <= bytes_number; byte++) {
+        data[byte - 1] = ad7798.write(data[byte]);
+    }
+    cs = true & toggle_cs;
+    return bytes_number;
+}
+uint8_t AD7798::spi_write(uint8_t *data, uint8_t bytes_number, bool toggle_cs)
+{
+    cs = false & toggle_cs;
+    for(uint8_t byte = 0; byte < bytes_number; byte++) {
+        ad7798.write(data[byte]);
+    }
+    cs = true & toggle_cs;
+    return bytes_number;
+}
+
+void AD7798::read_data(uint8_t adcChannel, uint16_t *adcData)
+{
+
+    uint8_t channel;
+
+    channel = 0x80 | adcChannel;
+
+    cs = 0;
+
+    set_register_value(AD7798_REG_MODE, 0x200A, 2);//, false);
+    uint16_t regVal = 0;
+    while( (regVal & channel) != channel) {
+        regVal = get_register_value( AD7798_REG_STAT, 1);//, false);
+    }
+
+    //timer_sleep(200);
+    wait_ms(200); // ???
+
+    *adcData = get_register_value(AD7798_REG_DATA, 2);//, false);
+
+    cs = 1;
+
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/AD7798/AD7798.h	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,148 @@
+#ifndef _AD7798_H_
+#define _AD7798_H_
+
+#include <mbed.h>
+
+/******************************************************************************/
+/* AD7798                                                                   */
+/******************************************************************************/
+
+/*AD7798 Registers*/
+#define AD7798_REG_COMM		0 /* Communications Register(WO, 8-bit) */
+#define AD7798_REG_STAT	    0 /* Status Register	    (RO, 8-bit) */
+#define AD7798_REG_MODE	    1 /* Mode Register	     	(RW, 16-bit */
+#define AD7798_REG_CONF	    2 /* Configuration Register (RW, 16-bit)*/
+#define AD7798_REG_DATA	    3 /* Data Register	     	(RO, 16-/24-bit) */
+#define AD7798_REG_ID	    4 /* ID Register	     	(RO, 8-bit) */
+#define AD7798_REG_IO	    5 /* IO Register	     	(RO, 8-bit) */
+#define AD7798_REG_OFFSET   6 /* Offset Register	    (RW, 24-bit */
+#define AD7798_REG_FULLSCALE	7 /* Full-Scale Register	(RW, 24-bit */
+
+/* Communications Register Bit Designations (AD7798_REG_COMM) */
+#define AD7798_COMM_WEN		(1 << 7) 			/* Write Enable */
+#define AD7798_COMM_WRITE	(0 << 6) 			/* Write Operation */
+#define AD7798_COMM_READ    (1 << 6) 			/* Read Operation */
+#define AD7798_COMM_ADDR(x)	(((x) & 0x7) << 3)	/* Register Address */
+#define AD7798_COMM_CREAD	(1 << 2) 			/* Continuous Read of Data Register */
+
+/* Status Register Bit Designations (AD7798_REG_STAT) */
+#define AD7798_STAT_RDY		(1 << 7) /* Ready */
+#define AD7798_STAT_ERR		(1 << 6) /* Error (Overrange, Underrange) */
+#define AD7798_STAT_CH3		(1 << 2) /* Channel 3 */
+#define AD7798_STAT_CH2		(1 << 1) /* Channel 2 */
+#define AD7798_STAT_CH1		(1 << 0) /* Channel 1 */
+
+
+#define AD7798_CH3		(1 << 2) /* Channel 3 */
+#define AD7798_CH2		(1 << 1) /* Channel 2 */
+#define AD7798_CH1		(1 << 0) /* Channel 1 */
+
+/* Mode Register Bit Designations (AD7798_REG_MODE) */
+#define AD7798_MODE_SEL(x)		(((x) & 0x7) << 13)	/* Operation Mode Select */
+#define AD7798_MODE_PSW(x)		(1 << 12)			/* Power Switch Control Bit */
+#define AD7798_MODE_RATE(x)		((x) & 0xF) 		/* Filter Update Rate Select */
+
+/* AD7798_MODE_SEL(x) options */
+#define AD7798_MODE_CONT		 0 /* Continuous Conversion Mode */
+#define AD7798_MODE_SINGLE		 1 /* Single Conversion Mode */
+#define AD7798_MODE_IDLE		 2 /* Idle Mode */
+#define AD7798_MODE_PWRDN		 3 /* Power-Down Mode */
+#define AD7798_MODE_CAL_INT_ZERO 4 /* Internal Zero-Scale Calibration */
+#define AD7798_MODE_CAL_INT_FULL 5 /* Internal Full-Scale Calibration */
+#define AD7798_MODE_CAL_SYS_ZERO 6 /* System Zero-Scale Calibration */
+#define AD7798_MODE_CAL_SYS_FULL 7 /* System Full-Scale Calibration */
+
+/* Configuration Register Bit Designations (AD7798_REG_CONF) */
+#define AD7798_CONF_BO_EN	  (1 << 13) 			/* Burnout Current Enable */
+#define AD7798_CONF_UNIPOLAR  (1 << 12) 			/* Unipolar/Bipolar Enable */
+#define AD7798_CONF_GAIN(x)	  (((x) & 0x7) << 8) 	/* Gain Select */
+#define AD7798_CONF_REFDET(x) (((x) & 0x1) << 5) 	/* Reference detect function */
+#define AD7798_CONF_BUF		  (1 << 4) 				/* Buffered Mode Enable */
+#define AD7798_CONF_CHAN(x)	  ((x) & 0x7) 			/* Channel select */
+
+/* AD7798_CONF_GAIN(x) options */
+#define AD7798_GAIN_1       0
+#define AD7798_GAIN_2       1
+#define AD7798_GAIN_4       2
+#define AD7798_GAIN_8       3
+#define AD7798_GAIN_16      4
+#define AD7798_GAIN_32      5
+#define AD7798_GAIN_64      6
+#define AD7798_GAIN_128     7
+
+/* AD7798_CONF_REFDET(x) options */
+#define AD7798_REFDET_ENA   1
+#define AD7798_REFDET_DIS   0
+
+/* AD7798_CONF_CHAN(x) options */
+#define AD7798_CH_AIN1P_AIN1M	0 /* AIN1(+) - AIN1(-) */
+#define AD7798_CH_AIN2P_AIN2M	1 /* AIN2(+) - AIN2(-) */
+#define AD7798_CH_AIN3P_AIN3M	2 /* AIN3(+) - AIN3(-) */
+#define AD7798_CH_AIN1M_AIN1M	3 /* AIN1(-) - AIN1(-) */
+#define AD7798_CH_AVDD_MONITOR	7 /* AVDD Monitor */
+
+/* ID Register Bit Designations (AD7798_REG_ID) */
+#define AD7798_ID			0x8
+#define AD7798_ID_MASK		0xF
+
+/* IO (Excitation Current Sources) Register Bit Designations (AD7798_REG_IO) */
+#define AD7798_IOEN			(1 << 6)
+#define AD7798_IO1(x)		(((x) & 0x1) << 4)
+#define AD7798_IO2(x)		(((x) & 0x1) << 5)
+
+#define TRUE              1
+#define FALSE             0
+
+#define AD7798_UNIPOLAR     TRUE
+#define AD7798_BIPOLAR      FALSE
+
+#define AD7798_ENABLE       TRUE
+#define AD7798_DISABLE      FALSE
+
+/******************************************************************************/
+/* Functions Prototypes                                                       */
+/*****************************************************************************/
+
+class AD7798
+{
+public:
+    AD7798( PinName CS, PinName MOSI = SPI_MOSI, PinName MISO = SPI_MISO, PinName SCK = SPI_SCK);
+    /* Initialize AD7798 and check if the device is present*/
+    uint8_t init(void);
+    void frequency(int hz);
+    /* Sends 32 consecutive 1's on SPI in order to reset the part. */
+    void reset(void);
+    /* Reads the value of the selected register. */
+    uint16_t get_register_value(uint8_t regAddress, uint8_t size, bool toggle_cs = true);
+    /* Writes a value to the register. */
+    void set_register_value(uint8_t regAddress, uint16_t regValue, uint8_t size, bool toggle_cs = true);
+    /* Sets the operating mode of AD7798. */
+    void set_mode(uint8_t mode);
+    /* Reads /RDY bit of Status register. */
+    uint8_t ready(void);
+    /* Selects the channel of AD7798. */
+    void set_channel(uint8_t channel);
+    /* Sets the gain of the In-Amp. */
+    void set_gain(uint16_t gain);
+    /* Enables or disables the reference detect function. */
+    void set_reference(uint8_t state);
+
+    void set_filter(uint8_t filter);
+    void set_coding_mode(uint8_t mode);
+    void set_burnout_current(uint8_t select);
+
+    void read_data(uint8_t adcChannel, uint16_t *adcData);
+
+    uint8_t spi_read(uint8_t *data, uint8_t bytes_number, bool toggle_cs = true);
+    uint8_t spi_write(uint8_t *data, uint8_t bytes_number, bool toggle_cs = true);
+
+
+
+    //DigitalIn miso;///< DigitalIn must be initialized before SPI to prevent pin MUX overwrite
+    SPI ad7798;
+    DigitalOut cs;
+
+private:
+    const uint8_t _SPI_MODE = 0x03;
+};
+#endif	// _AD7798_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/ADT7310/ADT7310.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,75 @@
+#include "ADT7310.h"
+
+
+ADT7310::ADT7310(PinName CS, PinName MOSI, PinName MISO, PinName SCK) :/* miso(MISO),*/ adt7310(MOSI, MISO, SCK), cs(CS)
+{
+    cs = true;
+    adt7310.format(8, SPI_MODE);
+}
+
+void ADT7310::reset()
+{
+    cs = false;
+    adt7310.write(0xff);
+    adt7310.write(0xff);
+    adt7310.write(0xff);
+    adt7310.write(0xff);
+    cs = true;
+}
+uint8_t ADT7310::read_status()
+{
+    uint8_t spi_data[2] = {ADT7310_READ | (ADT7310_STATUS << 3), ADT7310_DUMMY};
+    spi_read(spi_data, 2);
+    return spi_data[1];
+}
+
+void ADT7310::start_single_conversion()
+{
+    uint8_t spi_data[2] = {ADT7310_READ | (ADT7310_CONFIG << 3), ADT7310_DUMMY};
+    spi_read(spi_data, 2);
+    spi_data[0] = ADT7310_WRITE | (ADT7310_CONFIG << 3);
+    spi_data[1] = (spi_data[1] & (~(0x60))) |  (0x20); // Oneshot conversion
+    spi_write(spi_data, 2);
+}
+void ADT7310::write_config(uint8_t data)
+{
+    uint8_t spi_data[2] = {ADT7310_WRITE | (ADT7310_CONFIG << 3), data};
+    spi_write(spi_data, 2);
+}
+
+uint8_t ADT7310::read_config()
+{
+    uint8_t spi_data[2] = {ADT7310_READ | (ADT7310_CONFIG << 3), ADT7310_DUMMY};
+    spi_read(spi_data, 2);
+    return spi_data[1];
+}
+uint16_t ADT7310::read_temp()
+{
+    uint8_t spi_data[3] = {ADT7310_READ | (ADT7310_TEMP << 3), ADT7310_DUMMY, ADT7310_DUMMY };
+    spi_read(spi_data, 3);
+    return ((static_cast<uint16_t>(spi_data[1]) << 8) | spi_data[2]);
+}
+void ADT7310::write_temp_setpoint(uint8_t setpoint, uint16_t data)
+{
+    uint8_t spi_data[3] = {ADT7310_WRITE | (setpoint << 3), ((data & 0xff00) >> 8), data & 0xff };
+    spi_write(spi_data, 3);
+}
+
+void ADT7310::spi_write(uint8_t *data, uint8_t size)
+{
+    cs = false;
+    uint8_t i;
+    for(i = 0; i < size; i++)
+        adt7310.write(data[i]);
+    cs = true;
+
+}
+void ADT7310::spi_read(uint8_t *data, uint8_t size)
+{
+    cs = false;
+    uint8_t i;
+    for(i = 0; i < size; i++)
+        data[i] = adt7310.write(data[i]);
+
+    cs = true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/ADT7310/ADT7310.h	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,87 @@
+
+#ifndef ADT7310_H
+#define ADT7310_H
+
+#include "mbed.h"
+
+/**
+ * @brief Analog Devices ADT7310 temperature sensor
+ */
+class ADT7310
+{
+public:
+
+
+#define ADT7310_READ (1<<6)
+#define ADT7310_WRITE (0)
+#define ADT7310_DUMMY (0)
+#define ADT7310_STATUS (0)
+#define ADT7310_CONFIG (1)
+#define ADT7310_TEMP  (2)
+#define ADT7310_ID    (3)
+#define ADT7310_TCRIT (4)
+#define ADT7310_THYST (5)
+#define ADT7310_THIGH (6)
+#define ADT7310_TLOW  (7)
+
+
+	/**
+	 * @brief ADT7310 class
+	 * @param CS - chipselect pin
+	 * @param MOSI - MOSI pin
+	 * @param MISO - MISO pin
+	 * @param SCK - Clock pin
+	 */
+    ADT7310(PinName CS = SPI_CS, PinName MOSI = SPI_MOSI, PinName MISO = SPI_MISO, PinName SCK = SPI_SCK);
+
+    /**
+     * @brief resets the ADT7310
+     */
+    void reset();
+
+    /**
+     * @brief reads status register of the temperature sensor
+     * @return value of the status register
+     */
+    uint8_t read_status();
+
+    /**
+     * @brief writes configuration register of the temperature sensor
+     * @param data - data to be written
+     */
+    void write_config(uint8_t data);
+
+    /**
+     * @brief issues a conversion to the temperature sensor
+     */
+    void start_single_conversion();
+
+    /**
+     * @brief reads configuration register
+     * @return configuration register value
+     */
+    uint8_t read_config();
+
+    /**
+     * @brief reads the temperature
+     * @return temperature
+     */
+    uint16_t read_temp();
+
+    /**
+     * @brief writes temperature setpoints
+     * @param setpoint - setpoint register
+     * @param data - data to be written to the setpoint register
+     */
+    void write_temp_setpoint(uint8_t setpoint, uint16_t data);
+
+    void spi_write(uint8_t *data, uint8_t size);
+    void spi_read(uint8_t *data, uint8_t size);
+    //DigitalIn miso;
+    DigitalOut cs;
+    SPI adt7310;
+private:
+    const uint8_t SPI_MODE = 0x03;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/CN0391/CN0391.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,358 @@
+#include "CN0391.h"
+#include "Thermocouple.h"
+#include "AD7124.h"
+
+//#define DEBUG_MODE
+
+extern Serial pc;
+
+
+#define ms_delay (1)
+#define R2 (1600.0)
+#define RTD_SLOPE (15/39.0)
+#define RTD_CONSTANT (1039.0)
+#define RTD_CONVERSION(R1) RTD_SLOPE * (R1-RTD_CONSTANT)
+#define CAL_CHANNEL (8)
+Thermocouple_Channel::Thermocouple_Channel()
+{
+    this->t = NULL;
+}
+
+Thermocouple* Thermocouple_Channel::get_thermocouple_type()
+{
+    return t;
+}
+void Thermocouple_Channel::set_thermocouple_type(Thermocouple* new_t)
+{
+    t = new_t;
+}
+
+void Thermocouple_Channel::setup_channel(Thermocouple* new_t, uint16_t thermocouple_channel, uint16_t rtd_channel, uint16_t calibration_channel)
+{
+
+    this->t = new_t;
+    this->thermocouple_channel = thermocouple_channel;
+    this->rtd_channel = rtd_channel;
+    this->calibration_channel = calibration_channel;
+    this->calibration_current = 0.0005;
+}
+
+CN0391::CN0391(PinName cs) : ad7124(cs)
+{
+
+}
+
+void CN0391::set_thermocouple_type(channel_t ch, Thermocouple* new_t)
+{
+    tc[ch].setup_channel(new_t, ch * 2, (ch * 2) + 1, CAL_CHANNEL);
+}
+
+
+float CN0391::read_channel(channel_t ch)
+{
+    int32_t data;
+
+    enable_current_source(tc[ch].rtd_channel);
+    enable_channel(tc[ch].rtd_channel);
+    start_single_conversion();
+
+    if (ad7124.WaitForConvReady(10000) == -3) {
+        pc.printf("TIMEOUT");
+        return 0;
+    }
+
+    ad7124.ReadData(&data);
+    disable_channel(tc[ch].rtd_channel);
+    float volt = data_to_voltage(data >> 8);
+    float R1 = (volt / tc[ch].calibration_current) - R2;
+    float temp = RTD_CONVERSION(R1);
+    float mv_cold_junction = tc[ch].t->convert_inv(temp);
+    //disable_current_source(tc[ch].rtd_channel);
+#ifdef DEBUG_MODE
+    pc.printf("Resistance of RTD on channel %d is: %f\r\n", ch , R1);
+    pc.printf("Temperature of RTD on channel %d is: %f\r\n", ch, temp);
+    pc.printf("mV equivalent(poly method) of thermocouple is %f \r\n", mv_cold_junction);
+#endif
+    // read thermocouple
+    enable_channel(tc[ch].thermocouple_channel);
+    start_single_conversion();
+
+    if (ad7124.WaitForConvReady(10000) == -3) {
+        pc.printf("TIMEOUT");
+        return 0;
+    }
+
+    ad7124.ReadData(&data);
+    disable_channel(tc[ch].thermocouple_channel);
+
+
+    volt = data_to_voltage(data >> 8);
+    float mv = volt * 1000 + mv_cold_junction;
+    temp = tc[ch].t->convert(mv);
+#ifdef DEBUG_MODE
+    pc.printf("mV of thermocouple on channel %d is: %f\r\n", ch, volt * 1000.0);
+    pc.printf("mV(compensated) of thermocouple on channel %d is: %f\r\n", ch, mv);
+    pc.printf("Temperature on channel %d is: %f\r\n", ch, temp);
+#endif
+    return temp;
+}
+float CN0391::calibrate(channel_t ch)
+{
+    int32_t data;
+    enable_current_source(tc[ch].rtd_channel);
+    enable_channel(tc[ch].calibration_channel); // calibration channel
+    start_single_conversion();
+    if (ad7124.WaitForConvReady(10000) == -3) {
+        pc.printf("TIMEOUT");
+        return 0;
+    }
+
+    ad7124.ReadData(&data);
+    disable_channel(tc[ch].calibration_channel);
+    //disable_current_source(tc[ch].rtd_channel);
+    float volt = data_to_voltage(data >> 8);
+    tc[ch].calibration_current = volt / R2;
+
+#ifdef DEBUG_MODE
+    pc.printf("Calibration current for channel %d is: %f \r\n", ch, tc[ch].calibration_current);
+#endif
+    return tc[ch].calibration_current;
+
+}
+
+
+float CN0391::data_to_voltage(uint32_t data)
+{
+    data = data & 0xFFFFFF;
+    return ((data / static_cast<float>(0xFFFFFF / 2)) - 1) * (2.5 / 1);
+}
+
+void CN0391::enable_channel(int channel)
+{
+    AD7124::ad7124_registers regNr = static_cast<AD7124::ad7124_registers> (AD7124::AD7124_Channel_0 + channel); //Select ADC_Control register
+    uint32_t setValue = ad7124.ReadDeviceRegister(regNr);
+    setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);    // Write data to ADC
+    wait_ms(ms_delay);
+}
+
+void CN0391::disable_channel(int channel)
+{
+    AD7124::ad7124_registers regNr = static_cast<AD7124::ad7124_registers> (AD7124::AD7124_Channel_0 + channel); //Select ADC_Control register
+    uint32_t setValue = ad7124.ReadDeviceRegister(regNr);
+    setValue &= (~(uint32_t) AD7124_CH_MAP_REG_CH_ENABLE);  //Enable channel
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);    // Write data to ADC
+    wait_ms(ms_delay);
+}
+
+void CN0391::enable_current_source(int current_source_channel)
+{
+    AD7124::ad7124_registers regNr = AD7124::AD7124_IOCon1; //Select ADC_Control register
+    uint32_t setValue = ad7124.ReadDeviceRegister(regNr);
+    setValue &= ~(AD7124_IO_CTRL1_REG_IOUT_CH0(0xF));
+    setValue |= AD7124_IO_CTRL1_REG_IOUT_CH0(current_source_channel);// set IOUT0 current to 500uA
+    setValue &= 0xFFFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);    // Write data to ADC
+    wait_ms(ms_delay);
+}
+
+void CN0391::start_single_conversion()
+{
+    AD7124::ad7124_registers regNr = AD7124::AD7124_ADC_Control; //Select ADC_Control register
+    uint32_t setValue = ad7124.ReadDeviceRegister(regNr);
+    setValue &= 0xFFC3;
+    setValue |= 0x04;               //single conversion;
+    setValue |= 0x1600;
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);    // Write data to ADC*/
+    wait_ms(ms_delay);
+}
+
+void CN0391::reset()
+{
+    ad7124.frequency(500000);
+    ad7124.Reset();
+    pc.printf("Reseted AD7124\r\n");
+}
+
+void CN0391::setup()
+{
+    ad7124.frequency(500000);
+    ad7124.Setup();
+}
+
+void CN0391::init()
+{
+    uint32_t setValue;
+    enum AD7124::ad7124_registers regNr;
+    setup();
+    wait_ms(ms_delay);
+
+    /* Set Config_0 0x19*/
+    regNr = AD7124::AD7124_Config_0;               //Select Config_0 register
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    setValue |= AD7124_CFG_REG_BIPOLAR;     //Select bipolar operation
+    setValue |= AD7124_CFG_REG_BURNOUT(0);  //Burnout current source off
+    setValue |= AD7124_CFG_REG_REF_BUFP;
+    setValue |= AD7124_CFG_REG_REF_BUFM;
+    setValue |= AD7124_CFG_REG_AIN_BUFP;    //Buffer AIN5
+    setValue |= AD7124_CFG_REG_AINN_BUFM;   //Buffer AIN4
+    setValue |= AD7124_CFG_REG_REF_SEL(2); //Select REFIN1(+)/REFIN1(-)  internal reference
+    setValue |= AD7124_CFG_REG_PGA(0);
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    /* Set Channel_0 register 0x09*/
+    regNr = AD7124::AD7124_Channel_0;
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue &= (~(uint32_t)AD7124_CH_MAP_REG_CH_ENABLE);
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(0);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_1;
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue &= (~(uint32_t)AD7124_CH_MAP_REG_CH_ENABLE);
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(1);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_2;
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue &= (~(uint32_t)AD7124_CH_MAP_REG_CH_ENABLE);
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(2);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_3;
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue &= (~(uint32_t)AD7124_CH_MAP_REG_CH_ENABLE);
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(3);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_4;
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue &= (~(uint32_t)AD7124_CH_MAP_REG_CH_ENABLE);
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(4);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+
+    regNr = AD7124::AD7124_Channel_5;
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue &= (~(uint32_t)AD7124_CH_MAP_REG_CH_ENABLE);
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(5);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+
+    regNr = AD7124::AD7124_Channel_6;
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue &= (~(uint32_t)AD7124_CH_MAP_REG_CH_ENABLE);
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(6);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_7;
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue &= (~(uint32_t)AD7124_CH_MAP_REG_CH_ENABLE);
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(7);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+    regNr = AD7124::AD7124_Channel_8;
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    //setValue |= (uint32_t) AD7124_CH_MAP_REG_CH_ENABLE;  //Enable channel0
+    setValue &= (~(uint32_t)AD7124_CH_MAP_REG_CH_ENABLE);
+    setValue |= AD7124_CH_MAP_REG_SETUP(0);             // Select setup0
+    setValue |= AD7124_CH_MAP_REG_AINP(14);         // Set AIN4 as positive input
+    setValue |= AD7124_CH_MAP_REG_AINM(15);         // Set AIN5 as negative input
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);   // Write data to ADC
+
+
+    /* Set Config_0 0x19*/
+
+#ifdef  CALIBRATION
+    // start calibration
+    regNr = AD7124::AD7124_Offset_0;
+    setValue = 0x800000;
+    ad7124.WriteDeviceRegister(regNr, setValue);// Write data to ADC
+
+// internal fullscale before zero scale
+    pc.printf("\r\n Gain before cali :%x", ad7124.ReadDeviceRegister(AD7124::AD7124_Gain_0));
+    regNr = AD7124::AD7124_ADC_Control;//Select ADC_Control register
+    setValue = AD7124_ADC_CTRL_REG_MODE(6);
+    setValue |= AD7124_ADC_CTRL_REG_REF_EN;
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);// Write data to ADC
+    //dut.WaitForConvReady(10000);
+    wait_ms(2000);
+
+    pc.printf("\r\n Gain:%x", ad7124.ReadDeviceRegister(AD7124::AD7124_Gain_0));
+
+    pc.printf("\r\n Offset before cali:%x", ad7124.ReadDeviceRegister(AD7124::AD7124_Offset_0));
+// internal zeroscale
+    regNr = AD7124::AD7124_ADC_Control;//Select ADC_Control register
+    setValue = AD7124_ADC_CTRL_REG_MODE(5);
+    setValue |= AD7124_ADC_CTRL_REG_REF_EN;
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);// Write data to ADC
+    wait_ms(2000);
+    pc.printf("\r\n Offset:%x\r\n", ad7124.ReadDeviceRegister(AD7124::AD7124_Offset_0));
+
+    // end of calibration
+
+#endif
+
+    /* Set IO_Control_1 0x03 */
+    regNr = AD7124::AD7124_IOCon1;               //Select IO_Control_1 register
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    setValue |= AD7124_IO_CTRL1_REG_IOUT0(0x4);// set IOUT0 current to 500uA
+    setValue |= AD7124_IO_CTRL1_REG_IOUT_CH0(0x1);
+    setValue &= 0xFFFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);// Write data to ADC
+
+    /* Set ADC_Control 0x01 */
+    regNr = AD7124::AD7124_ADC_Control;            //Select ADC_Control register
+    setValue = ad7124.ReadDeviceRegister(regNr);
+    setValue |= AD7124_ADC_CTRL_REG_DATA_STATUS; // set data status bit in order to check on which channel the conversion is
+    setValue |= AD7124_ADC_CTRL_REG_REF_EN;
+    setValue &= 0xFFC3;
+    setValue |= AD7124_ADC_CTRL_REG_MODE(1);
+    setValue &= 0xFFFF;
+    ad7124.WriteDeviceRegister(regNr, setValue);    // Write data to ADC
+    wait_ms(ms_delay);
+}
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/CN0391/CN0391.h	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,136 @@
+#ifndef _CN0391_H_
+#define _CN0391_H_
+#include "AD7124.h"
+#include "Thermocouple.h"
+
+
+/**
+ * @brief Thermocouple_Channel class
+ */
+class Thermocouple_Channel
+{
+private:
+public:
+	/**
+	 * @brief Thermocouple channel constructor
+	 */
+    Thermocouple_Channel();
+    /**
+     * @brief Constructs thermocouple channel using thermocouple type t
+     */
+    Thermocouple_Channel(Thermocouple *t);
+
+    Thermocouple *t;
+    uint16_t thermocouple_channel;
+    uint16_t rtd_channel;
+    uint16_t calibration_channel;
+    float calibration_current;
+
+	/**
+	 * @brief gets thermocouple type
+	 * @return thermocouple type
+	 */
+    Thermocouple* get_thermocouple_type();
+
+	/**
+	 * @brief sets new thermocouple type
+	 * @param new_t new thermocouple type
+	 */
+    void set_thermocouple_type(Thermocouple* new_t);
+
+    /**
+     * @brief sets up thermocouple channel
+     * @param new_t thermocouple type
+     * @param thermocouple_channel - thermocouple ADC channel
+     * @param rtd_channel - RTD ADC channel
+     * @param calibration_channel - ADC channel used in calibration
+     *
+     */
+    void setup_channel(Thermocouple* new_t, uint16_t thermocouple_channel, uint16_t rtd_channel, uint16_t calibration_channel);
+};
+
+class CN0391
+{
+private:
+public:
+    CN0391(PinName cs);
+
+    typedef enum {
+        CHANNEL_P1 = 0,
+        CHANNEL_P2,
+        CHANNEL_P3,
+        CHANNEL_P4
+    } channel_t;
+
+    Thermocouple_Channel tc[4];
+
+    /**
+     * @brief sets channel with thermocouple type
+     * @param ch - channel
+     * @param new_t - thermocouple type
+     */
+    void set_thermocouple_type(channel_t ch, Thermocouple* new_t);
+
+    /**
+     * @brief Reads thermocouple channel
+     * @param ch - channel
+     */
+    float read_channel(channel_t ch);
+
+    /**
+     * @brief Calibrate channel
+     * @param ch - channel
+     */
+    float calibrate(channel_t ch);
+
+
+    /**
+     * @brief converts ADC  counts to voltage
+     * @param data - ADC counts
+     * @return voltage
+     */
+    float data_to_voltage(uint32_t data);
+
+    /**
+     * @brief enables thermocouple channel
+     * @param channel
+     */
+    void enable_channel(int channel);
+
+    /**
+     * @brief disables thermocouple channel
+     * @param channel
+     */
+    void disable_channel(int channel);
+
+    /**
+     * @brief enables ADC current source
+     * @param current_source_channel
+     */
+    void enable_current_source(int current_source_channel);
+
+    /**
+     * @brief starts ADC single conversion
+     */
+    void start_single_conversion();
+
+    /**
+     * @brief resets the ADC
+     */
+    void reset();
+
+    /**
+     * @brief Performs ADC setup
+     */
+    void setup();
+
+    /**
+     * @brief Initializes the CN0391 shield
+     */
+    void init();
+
+    AD7124 ad7124;
+
+
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/CN0396/CN0396.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,152 @@
+
+#include "AD5270.h"
+#include <math.h>
+#include "CN0396.h"
+
+#define ADC_GAIN      AD7798_GAIN_1
+#define ADC_SPS        0x05  //50SPS
+
+#define CO_SENS    (75 * pow(10, -9))    /* Sensitivity nA/ppm in 400ppm CO 50 to 100 */
+#define CO_RANGE   1000 /* Range ppm CO limit of performance warranty 1,000 */
+#define H2S_SENS   (700 * pow(10, -9)) /* Sensitivity nA/ppm in 20ppm H2S 450 to 900 */
+#define H2S_RANGE  100  /* Range ppm H2S limit of performance warranty 100 */
+
+/*	CO side	H2S side
+Temperature	Mean 	Mean*/
+
+extern Serial pc;
+
+CN0396::CN0396(PinName csad, PinName csrdac, PinName cstemp) :
+    csad(csad), csrdac(csrdac), cstemp(cstemp), ad(csad), rdac(csrdac), temp(cstemp)
+{
+
+}
+
+void CN0396::data_to_voltage(uint16_t adcValue, float *voltage, int gain_adc)
+{
+    *voltage = (float)(adcValue * V_REF) / (float)(_2_16 * gain_adc);
+}
+
+void CN0396::data_to_voltage_bipolar(uint16_t adcValue, float *voltage, int gain_adc)
+{
+    *voltage = ((static_cast<float>(adcValue) / _2_15) - 1.0) * (V_REF / static_cast<float>(gain_adc));
+}
+
+float CN0396::get_feedback_resistor_value(float sensitivity, float range)
+{
+    return 1.2 / (sensitivity * range);
+}
+
+void CN0396::configure_feedback_resistors(float resistance1, float resistance2)
+{
+    uint16_t R1 = rdac.calc_RDAC(resistance1);
+    uint16_t R2 = rdac.calc_RDAC(resistance2);
+
+    csrdac = false;
+    rdac.write_cmd(AD5270::WRITE_CTRL_REG,  AD5270::RDAC_WRITE_PROTECT, false); // RDAC register write protect -  allow update of wiper position through digital interface
+    rdac.write_cmd(AD5270::WRITE_CTRL_REG,  AD5270::RDAC_WRITE_PROTECT, false); // RDAC register write protect -  allow update of wiper position through digital interface
+    csrdac = true;
+    wait_us(2);
+    csrdac = false;
+    rdac.write_cmd(AD5270::WRITE_RDAC, R2, false); // write data to the RDAC register
+    rdac.write_cmd(AD5270::WRITE_RDAC, R1, false); // write data to the RDAC register
+    csrdac = true;
+    wait_us(2);
+    csrdac = false;
+    rdac.write_cmd(AD5270::WRITE_CTRL_REG, 0, false); // RDAC register write protect -  allow update of wiper position through digital interface
+    rdac.write_cmd(AD5270::WRITE_CTRL_REG, 0, false); // RDAC register write protect -  allow update of wiper position through digital interface
+    csrdac = false;
+    wait_us(2);
+    csrdac = false;
+    rdac.write_reg(AD5270::HI_Z_Cmd, false);
+    rdac.write_reg(AD5270::HI_Z_Cmd, false);
+    csrdac = true;
+    wait_us(2);
+    csrdac = false;
+    rdac.write_reg(AD5270::NO_OP_cmd, false);
+    rdac.write_reg(AD5270::NO_OP_cmd, false);
+    csrdac = true;
+}
+
+void CN0396::init()
+{
+    // set rdac
+
+    pc.printf("Computing resistor values \r\n");
+
+    resistance1 = get_feedback_resistor_value(CO_SENS,  CO_RANGE );
+    resistance0 = get_feedback_resistor_value(H2S_SENS, H2S_RANGE);
+
+    pc.printf("R1 = %f\r\nR2=%f\r\n", resistance0, resistance1);
+    pc.printf("Configuring feedback resistors\r\n");
+    configure_feedback_resistors(resistance1, resistance1);
+    pc.printf("Done\r\n");
+    // config temp
+    pc.printf("Configuring temperature sensor\r\n");
+    temp.reset();
+    temp.write_config(0x90);
+    pc.printf("Done\r\n");
+
+    pc.printf("Configuring ADC\r\n");
+    ad.reset();
+    if(ad.init()) {
+        ad.set_coding_mode(AD7798_UNIPOLAR);
+        ad.set_mode(AD7798_MODE_SINGLE);
+        ad.set_gain(ADC_GAIN);
+        ad.set_filter(ADC_SPS);
+        ad.set_reference(AD7798_REFDET_ENA);
+        pc.printf("ADC Config succesful\r\n");
+    } else {
+        pc.printf("ADC Config failed\r\n");
+
+    }
+
+
+}
+
+float CN0396::compensate_ppm(float result, float temp, sensor_type_t sensor)
+{
+    for(uint8_t i = 1; i < COMPENSATION_TABLE_SIZE; i++) {
+        if(temp < ppm_compensation[i].temp && temp > ppm_compensation[i - 1].temp) {
+            float compensation_coef;
+            if(sensor == H2S_SENSOR) {
+                compensation_coef = (((temp - (ppm_compensation[i - 1].temp )) * (ppm_compensation[i].H2S_percent - ppm_compensation[i - 1].H2S_percent)) / (ppm_compensation[i].temp  - ppm_compensation[i - 1].temp)) + ppm_compensation[i - 1].H2S_percent;
+            } else {
+                compensation_coef = (((temp - (ppm_compensation[i - 1].temp )) * (ppm_compensation[i].CO_percent - ppm_compensation[i - 1].CO_percent)) / (ppm_compensation[i].temp  - ppm_compensation[i - 1].temp)) + ppm_compensation[i - 1].CO_percent;
+            }
+
+            return (result * compensation_coef) / 100.0;
+        }
+    }
+}
+void CN0396::read()
+{
+    uint16_t data0, data1;
+    // read temperature
+    uint16_t temp_data = temp.read_temp();
+    float temp = 0;
+
+    if(temp_data & 0x8000) {
+        temp = (temp_data - 65536) / (128.0);
+    } else {
+        temp = temp_data / (128.0);
+    }
+
+    // read channels
+    ad.set_channel(0);
+    ad.read_data(0, &data0);
+    float volt0;
+    data_to_voltage(data0, &volt0);
+    float result0 = (volt0 / resistance0) / CO_SENS;
+    ad.set_channel(1);
+    ad.read_data(1, &data1);
+    float volt1;
+    data_to_voltage(data1, &volt1);
+    float result1 = (volt1 / resistance1) / H2S_SENS;
+    // compute ppm based on formula
+    // return ppm
+    result0 = compensate_ppm(result0, temp, CO_SENSOR);
+    result1 = compensate_ppm(result1, temp, H2S_SENSOR);
+
+    pc.printf("%f %f %f \r\n", temp, result0, result1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/CN0396/CN0396.h	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,113 @@
+#ifndef _CN0396_H_
+#define _CN0396_H_
+#include <mbed.h>
+#include "AD7798.h"
+#include "AD5270.h"
+#include "ADT7310.h"
+
+/**
+ * @brief The CN0396 class
+ */
+class CN0396
+{
+public:
+
+#define V_REF                1.200    // [V]
+#define _2_16                65535.0   // 2^16
+#define _2_15                32767.0   // 2^16
+#define COMPENSATION_TABLE_SIZE 9
+
+    typedef enum {
+        CO_SENSOR,
+        H2S_SENSOR
+    } sensor_type_t;
+
+    typedef struct {
+        int8_t temp;
+        float CO_percent;
+        float H2S_percent;
+    } ppm_compensation_t;
+
+	/**
+	 *  @brief compensation look-up table
+	 */
+    const ppm_compensation_t ppm_compensation[COMPENSATION_TABLE_SIZE] = {
+        { -30	, 29.9  , 82.3 },
+        { -20	, 38.8  , 84.6 },
+        { -10	, 53.7  , 88.6 },
+        {0		, 69.6  , 92.2 },
+        {10		, 84.9  , 96.2 },
+        {20		, 100.0 , 100.0},
+        {30		, 112.7 , 103.1},
+        {40		, 123.7 , 105.6},
+        {50		, 133.1 , 107.4}
+    };
+
+
+    /**
+     * @brief CN0396 class constructor
+     * @param csad  - chipselect pin of the ADC
+     * @param csrdac - chipselect pin of the RDAC
+     * @param cstemp - chipselect pin of the temperature sensor
+     */
+    CN0396(PinName csad, PinName csrdac, PinName cstemp);
+    /**
+     * @brief Initializes the board
+     */
+    void init();
+
+    /**
+     * @brief - Reads the sensor and computes the PPM values
+     */
+    void read();
+
+    /**
+     * @brief computes the feedback resistor value for the sensor
+     * @param sensitivity - sensor sensitivity
+     * @param range - sensor range
+     * @return resistor value
+     */
+    float get_feedback_resistor_value(float sensitivity, float range);
+
+    /**
+     * @brief configures the RDACs with the resistance values
+     * @param resistance1 - resistance of RDAC1
+     * @param resistance2 - resistance of RDAC2
+     * @return
+     */
+    void configure_feedback_resistors(float resistance1, float resistance2);
+
+    /**
+    * @brief computes ADC counts-to-voltage in unipolar configuration
+    * @param adcValue - value in counts
+    * @param voltage - voltage value returned by the method
+    * @param gain_adc - the gain of the adc
+    */
+    void data_to_voltage(uint16_t adcValue, float *voltage, int gain_adc = 1);
+
+    /**
+     * @brief computes ADC counts-to-voltage in bipolar configuration
+     * @param adcValue - value in counts
+     * @param voltage - voltage value returned by the method
+     * @param gain_adc - the gain of the adc
+     */
+    void data_to_voltage_bipolar(uint16_t adcValue, float *voltage, int gain_adc = 1);
+
+    /**
+     * @brief compensates ppm value based on temperature reading
+     * @param result - ppm value before compensation
+     * @param temp - temperature used in compensation
+     * @param sensor - sensor id
+     * @return compensated value
+     */
+    float compensate_ppm(float result, float temp, sensor_type_t sensor);
+    DigitalOut csad, csrdac, cstemp;
+    AD7798 ad;
+    AD5270 rdac;
+    ADT7310 temp;
+    float resistance0, resistance1;
+private:
+
+
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/CN0397/CN0397.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,253 @@
+/**
+*   @file     CN0397.cpp
+*   @brief    Source file for the CN0397
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* Product: www.analog.com/EVAL-CN0397-ARDZ
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(c) Analog Devices, Inc.
+*
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*  - Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*  - Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in
+*    the documentation and/or other materials provided with the
+*    distribution.
+*  - Neither the name of Analog Devices, Inc. nor the names of its
+*    contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*  - The use of this software may or may not infringe the patent rights
+*    of one or more patent holders.  This license does not release you
+*    from the requirement that you obtain separate licenses from these
+*    patent holders to use this software.
+*  - Use of the software either in source or binary form, must be run
+*    on or directly connected to an Analog Devices Inc. component.
+*
+* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+* IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+********************************************************************************/
+
+#include "CN0397.h"
+#include "AD7798.h"
+#include "Timer.h"
+#include <stdio.h>
+#include <math.h>
+#include <mbed.h>
+
+extern Serial pc;
+
+
+void flush_serial()
+{
+    wait_ms(10); // wait for all data to come through
+    while (pc.readable())  pc.getc();
+}
+
+
+CN0397::CN0397(PinName cs) : ad7798(cs)
+{
+
+}
+void CN0397::display_data(void)
+{
+
+    uint8_t channel = 0, i;
+
+    /* for(channel = 0; channel < CHANNELS; channel++){
+
+        pc.printf("%s (channel %d):\n", colour[channel], (channel + 1));
+        pc.printf("\tADC output = %u (%#06x)\n", adcValue[channel], adcValue[channel]);
+        pc.printf("\tVoltage = %f mV\n", voltageValue[channel]);
+        pc.printf("\tLight Intensity = %.2f lux\n", intensityValue[channel]);
+        pc.printf("\tLight Concentration = %.2f%c\n", lightConcentration[channel], 37);
+
+     }*/
+
+
+    for(channel = 0; channel < CHANNELS; channel++) {
+
+        pc.printf("\t\t\033[2;%dm%s\033[0m channel:\t\t", ColorPrint[channel], colour[channel]);
+    }
+
+    pc.printf("\n");
+    pc.printf("\t");
+
+    /*
+    	for(channel = 0; channel < CHANNELS; channel++) {
+
+    		pc.printf("\t\t\tADC output = %u (%#06x)", adcValue[channel], adcValue[channel]);
+    	}
+
+    	pc.printf("\n");
+    	pc.printf("\t");
+
+    */
+    for(channel = 0; channel < CHANNELS; channel++) {
+
+        pc.printf("\t\tLight Intensity = %.2f lux", intensityValue[channel]);
+    }
+
+    pc.printf("\n");
+    pc.printf("\t");
+
+
+    for(channel = 0; channel < CHANNELS; channel++) {
+
+        pc.printf("\t\tLight Concentration = %.2f%c", lightConcentration[channel], 37);
+    }
+
+    pc.printf("\n");/*pc.printf("\t");
+
+	for(channel = 0; channel < CHANNELS; channel++) {
+
+		pc.printf("\t\t\tLight Concentration = %.2f%c", lightConcentration[channel], 37);
+	}
+
+	pc.printf("\n");pc.printf("\t");
+
+	/* for(channel = 0; channel < CHANNELS; channel++){
+
+             pc.printf("\t\t\t\033[2;%dm|\033[0m\t", ColorPrint[channel]);
+
+     }*/
+
+    for(channel = 0; channel < 5; channel++) {
+        pc.printf("\n");
+    }
+
+    //  pc.printf("\n");
+    //  pc.printf("\n");
+    pc.printf("\n");
+}
+
+
+void CN0397::data_to_voltage(uint16_t adcValue, float *voltage)
+{
+
+    *voltage = (float)(adcValue * V_REF) / (float)(_2_16 * gainAdc);
+
+}
+
+void CN0397::init(void)
+{
+    ad7798.reset();
+    uint8_t channel;
+
+    if(ad7798.init()) {
+
+        ad7798.set_coding_mode(AD7798_UNIPOLAR);
+        ad7798.set_mode(AD7798_MODE_SINGLE);
+        ad7798.set_gain(ADC_GAIN);
+        ad7798.set_filter(ADC_SPS);
+        ad7798.set_reference(AD7798_REFDET_ENA);
+
+    }
+
+    gainAdc = Gain[ADC_GAIN];
+#ifdef USE_CALIBRATION
+    pc.printf("Calibrate the system:\n");
+    pc.printf("\n");
+
+    for(channel = 0; channel < CHANNELS; channel++) {
+
+        pc.printf("\tCalibrate channel %d: be sure that %s photodiode is cover and press <ENTER>.\n", (Channels[channel] + 1), colour[channel]);
+        pc.getc();
+        flush_serial();
+        calibration(Channels[channel]);
+        pc.printf("\t\tChannel %d is calibrated!\n", (Channels[channel] + 1));
+        pc.printf("\n");
+
+    }
+
+    printf("System calibration complete!\n");
+    printf("\n");
+    printf("\n");
+
+#endif
+}
+
+void CN0397::calc_light_intensity(uint8_t channel, uint16_t adcValue, float *intensity)
+{
+
+    *intensity = adcValue * Lux_LSB[channel];
+
+}
+
+void CN0397::calc_light_concentration(uint8_t channel, float intensity, float *conc)
+{
+
+    *conc = (intensity * 100) / Optimal_Levels[channel];
+
+}
+
+void CN0397::set_app_data(void)
+{
+    uint8_t channel, rgbChannel;
+    uint16_t *adcData = &adcValue[0];
+    float *voltageData = &voltageValue[0], *intensityData = &intensityValue[0];
+    float *concData = &lightConcentration[0];
+
+    for(channel = 0; channel < CHANNELS; channel++) {
+
+        rgbChannel = Channels[channel];
+
+        ad7798.set_channel(channel);
+
+        adcData = &adcValue[rgbChannel];
+        voltageData = &voltageValue[rgbChannel];
+        intensityData = &intensityValue[rgbChannel];
+        concData = &lightConcentration[rgbChannel];
+        ad7798.read_data(channel, adcData);
+        data_to_voltage(*adcData, voltageData);
+        calc_light_intensity(rgbChannel, *adcData, intensityData);
+        calc_light_concentration(rgbChannel, *intensityData, concData);
+
+        /*    adcData++;
+            voltageData++;
+            intensityData++;
+            concData++;*/
+
+    }
+}
+
+void CN0397::calibration(uint8_t channel)
+{
+
+    uint16_t setValue;
+
+    ad7798.set_channel(channel);  //select channel to calibrate
+
+    // Perform system zero-scale calibration
+    setValue = ad7798.get_register_value(AD7798_REG_MODE, 2);
+    setValue &= ~(AD7798_MODE_SEL(0x07));
+    setValue |= AD7798_MODE_SEL(AD7798_MODE_CAL_SYS_ZERO);
+    ad7798.set_register_value(AD7798_REG_MODE, setValue, 2);
+
+    while((ad7798.get_register_value( AD7798_REG_STAT, 1) & channel) != channel); // wait for RDY bit to go low
+
+    while(ad7798.get_register_value(AD7798_REG_MODE, 2) != 0x4005);    // wait for ADC to go in idle mode
+
+
+}
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/CN0397/CN0397.h	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,173 @@
+/**
+*   @file     CN0397.cpp
+*   @brief    Header file for the CN0397
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* Product: www.analog.com/EVAL-CN0397-ARDZ
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(c) Analog Devices, Inc.
+*
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*  - Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*  - Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in
+*    the documentation and/or other materials provided with the
+*    distribution.
+*  - Neither the name of Analog Devices, Inc. nor the names of its
+*    contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*  - The use of this software may or may not infringe the patent rights
+*    of one or more patent holders.  This license does not release you
+*    from the requirement that you obtain separate licenses from these
+*    patent holders to use this software.
+*  - Use of the software either in source or binary form, must be run
+*    on or directly connected to an Analog Devices Inc. component.
+*
+* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+* IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+********************************************************************************/
+
+#ifndef CN0397_H_
+#define CN0397_H_
+
+#include <stdio.h>
+#include <string.h>
+#include "AD7798.h"
+
+#define REGISTERS_VALUES     3
+#define CONVERSION_DATA      4
+
+#define V_REF                3150.0    // [mV]
+#define _2_16                65535.0   // 2^16
+
+
+/* Available settings:
+ * AD7798_CH_AIN1P_AIN1M - select channel 1
+ * AD7798_CH_AIN2P_AIN2M - select channel 2
+ * AD7798_CH_AIN3P_AIN3M - select channel 3
+ */
+#define ADC_CHANNEL   AD7798_CH_AIN2P_AIN2M
+
+/* Available settings:
+ *  AD7798_GAIN_1, AD7798_GAIN_2,
+ *  AD7798_GAIN_4, AD7798_GAIN_8,
+ *  AD7798_GAIN_16, AD7798_GAIN_32,
+ *  AD7798_GAIN_64, AD7798_GAIN_128
+ */
+#define ADC_GAIN      AD7798_GAIN_1
+/* Available settings:
+ * Check available value from datasheet
+ */
+#define ADC_SPS        0x05  /*50SPS*/
+
+
+/* Available settings:
+ * How often to display output values on terminal -> msec
+ */
+#define DISPLAY_REFRESH        1000   /*[msec]*/
+
+#define CHANNELS  3
+
+
+#define USE_CALIBRATION      /* Select if you want to use system zero-scale calibration before reading the system data*/
+/**
+ * Helper function used to flush the serial interface
+ */
+void flush_serial();
+
+/**
+ * @brief The CN0397 shield class
+ */
+class CN0397
+{
+public:
+	/**
+	 * @brief The CN0397 class constructor
+	 */
+    CN0397(PinName cs);
+    /**
+     * @brief Initialization method of the class. Initializes the AD7798 and initiates calibration if needed
+     */
+    void init(void);
+
+    /**
+     * @brief Displays data on the serial interface
+     */
+    void display_data(void);
+
+    /**
+     * @brief Converts ADC counts to voltage
+     * @param adcValue - ADC counts
+     * @param voltage - computed voltage
+     */
+    void data_to_voltage(uint16_t adcValue, float *voltage);
+
+    /**
+     * @brief Computes light intensity of the channel
+     * @param channel - channel to be converted
+     * @param adcValue - ADC counts
+     * @param intensity - computed light intensity
+     */
+    void calc_light_intensity(uint8_t channel, uint16_t adcValue, float *intensity);
+
+    /**
+     * @brief Computes light concentration from light intensity
+     * @param channel - channel to be converted
+     * @param intensity - light intensity
+     * @param conc - computed light concentration
+     */
+    void calc_light_concentration(uint8_t channel, float intensity, float *conc);
+
+    /**
+     * @brief Reads the ADC channels and computes intensity and concentration
+     */
+    void set_app_data(void);
+
+    /**
+     * @brief Calibrates the channel
+     * @param channel - channel to be calibrated
+     */
+    void calibration(uint8_t channel);
+
+    /**
+     * @brief Instance of the AD7798
+     */
+    AD7798 ad7798;
+private:
+
+    uint8_t statusReg, idReg, ioReg, gainAdc;
+    uint16_t modeReg, configReg, offsetReg, fullscaleReg, dataReg;
+    uint16_t adcValue[3];
+    float voltageValue[3], intensityValue[3], lightConcentration[3];
+    const uint8_t Channels[3] = { 1, 0, 2};
+    const char colour[3][6] = {
+        "RED", "GREEN", "BLUE",
+    };
+
+    const uint8_t ColorPrint[3] = { 31, 32, 34 };
+    const uint8_t Gain[8] = { 1, 2, 4, 8, 16, 32, 64, 128};
+    const float Lux_LSB[3] = {2.122, 2.124, 2.113};
+    const float Optimal_Levels[3] = {26909.0, 8880.0, 26909.0};
+
+};
+
+#endif /* CN0397_H_ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/.idea/Thermocouple.iml	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+  <component name="TestRunnerService">
+    <option name="PROJECT_TEST_RUNNER" value="Unittests" />
+  </component>
+</module>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/.idea/misc.xml	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+    <OptionsSetting value="true" id="Add" />
+    <OptionsSetting value="true" id="Remove" />
+    <OptionsSetting value="true" id="Checkout" />
+    <OptionsSetting value="true" id="Update" />
+    <OptionsSetting value="true" id="Status" />
+    <OptionsSetting value="true" id="Edit" />
+    <ConfirmationsSetting value="0" id="Add" />
+    <ConfirmationsSetting value="0" id="Remove" />
+  </component>
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.11 (C:\Python27\python.exe)" project-jdk-type="Python SDK" />
+</project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/.idea/modules.xml	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/Thermocouple.iml" filepath="$PROJECT_DIR$/.idea/Thermocouple.iml" />
+    </modules>
+  </component>
+</project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/.idea/workspace.xml	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,433 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ChangeListManager">
+    <list default="true" id="f1485c9f-2a73-4178-9cda-6c023146ce0e" name="Default" comment="" />
+    <ignored path="Thermocouple.iws" />
+    <ignored path=".idea/workspace.xml" />
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
+    <option name="TRACKING_ENABLED" value="true" />
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
+  <component name="CreatePatchCommitExecutor">
+    <option name="PATCH_PATH" value="" />
+  </component>
+  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
+  <component name="FavoritesManager">
+    <favorites_list name="Thermocouple" />
+  </component>
+  <component name="FileEditorManager">
+    <leaf>
+      <file leaf-file-name="lut_script.py" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/lut_script.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="230">
+              <caret line="156" column="32" selection-start-line="156" selection-start-column="32" selection-end-line="156" selection-end-column="32" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="tc.txt" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/tc.txt">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="170">
+              <caret line="10" column="21" selection-start-line="10" selection-start-column="21" selection-end-line="10" selection-end-column="21" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Thermocouple.cpp" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/Thermocouple.cpp">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="561">
+              <caret line="257" column="1" selection-start-line="257" selection-start-column="0" selection-end-line="257" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Thermocouple_core_cpp.txt" pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/Thermocouple_core_cpp.txt">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="68">
+              <caret line="4" column="29" selection-start-line="4" selection-start-column="29" selection-end-line="4" selection-end-column="29" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Thermocouple_core_h.txt" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/Thermocouple_core_h.txt">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="360">
+              <caret line="30" column="28" selection-start-line="30" selection-start-column="28" selection-end-line="30" selection-end-column="28" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Thermocouple.h" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/Thermocouple.h">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="119">
+              <caret line="61" column="0" selection-start-line="61" selection-start-column="0" selection-end-line="61" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="Thermocouple_lut.cpp" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/Thermocouple_lut.cpp">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="0">
+              <caret line="262" column="0" selection-start-line="262" selection-start-column="0" selection-end-line="262" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+    </leaf>
+  </component>
+  <component name="IdeDocumentHistory">
+    <option name="CHANGED_PATHS">
+      <list>
+        <option value="$PROJECT_DIR$/Thermocouple_core_h.txt" />
+        <option value="$PROJECT_DIR$/lut_script.py" />
+        <option value="$PROJECT_DIR$/Thermocouple_core_cpp.txt" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectFrameBounds">
+    <option name="x" value="1911" />
+    <option name="y" value="-9" />
+    <option name="width" value="1938" />
+    <option name="height" value="1098" />
+  </component>
+  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+    <OptionsSetting value="true" id="Add" />
+    <OptionsSetting value="true" id="Remove" />
+    <OptionsSetting value="true" id="Checkout" />
+    <OptionsSetting value="true" id="Update" />
+    <OptionsSetting value="true" id="Status" />
+    <OptionsSetting value="true" id="Edit" />
+    <ConfirmationsSetting value="0" id="Add" />
+    <ConfirmationsSetting value="0" id="Remove" />
+  </component>
+  <component name="ProjectView">
+    <navigator currentView="ProjectPane" proportions="" version="1">
+      <flattenPackages />
+      <showMembers />
+      <showModules />
+      <showLibraryContents />
+      <hideEmptyPackages />
+      <abbreviatePackageNames />
+      <autoscrollToSource />
+      <autoscrollFromSource />
+      <sortByType />
+      <manualOrder />
+      <foldersAlwaysOnTop value="true" />
+    </navigator>
+    <panes>
+      <pane id="Scope" />
+      <pane id="ProjectPane">
+        <subPane>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="Thermocouple" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+          </PATH>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="Thermocouple" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="Thermocouple" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+          </PATH>
+        </subPane>
+      </pane>
+      <pane id="Scratches" />
+    </panes>
+  </component>
+  <component name="RunManager" selected="Python.lut_script">
+    <configuration default="false" name="lut_script" type="PythonConfigurationType" factoryName="Python" temporary="true">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+      <option name="IS_MODULE_SDK" value="true" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="Thermocouple" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/lut_script.py" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="PythonConfigurationType" factoryName="Python">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="Thermocouple" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="Tox" factoryName="Tox">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="Thermocouple" />
+      <method />
+    </configuration>
+    <configuration default="true" type="tests" factoryName="Attests">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="Thermocouple" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="FOLDER_NAME" value="" />
+      <option name="TEST_TYPE" value="TEST_SCRIPT" />
+      <option name="PATTERN" value="" />
+      <option name="USE_PATTERN" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="tests" factoryName="Doctests">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="Thermocouple" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="FOLDER_NAME" value="" />
+      <option name="TEST_TYPE" value="TEST_SCRIPT" />
+      <option name="PATTERN" value="" />
+      <option name="USE_PATTERN" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="tests" factoryName="Nosetests">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="Thermocouple" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="FOLDER_NAME" value="" />
+      <option name="TEST_TYPE" value="TEST_SCRIPT" />
+      <option name="PATTERN" value="" />
+      <option name="USE_PATTERN" value="false" />
+      <option name="PARAMS" value="" />
+      <option name="USE_PARAM" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="tests" factoryName="Unittests">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="Thermocouple" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="FOLDER_NAME" value="" />
+      <option name="TEST_TYPE" value="TEST_SCRIPT" />
+      <option name="PATTERN" value="" />
+      <option name="USE_PATTERN" value="false" />
+      <option name="PUREUNITTEST" value="true" />
+      <option name="PARAMS" value="" />
+      <option name="USE_PARAM" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="tests" factoryName="py.test">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="Thermocouple" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="FOLDER_NAME" value="" />
+      <option name="TEST_TYPE" value="TEST_SCRIPT" />
+      <option name="PATTERN" value="" />
+      <option name="USE_PATTERN" value="false" />
+      <option name="testToRun" value="" />
+      <option name="keywords" value="" />
+      <option name="params" value="" />
+      <option name="USE_PARAM" value="false" />
+      <option name="USE_KEYWORD" value="false" />
+      <method />
+    </configuration>
+    <list size="1">
+      <item index="0" class="java.lang.String" itemvalue="Python.lut_script" />
+    </list>
+    <recent_temporary>
+      <list size="1">
+        <item index="0" class="java.lang.String" itemvalue="Python.lut_script" />
+      </list>
+    </recent_temporary>
+  </component>
+  <component name="ShelveChangesManager" show_recycled="false">
+    <option name="remove_strategy" value="false" />
+  </component>
+  <component name="SvnConfiguration">
+    <configuration />
+  </component>
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="f1485c9f-2a73-4178-9cda-6c023146ce0e" name="Default" comment="" />
+      <created>1465996779514</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1465996779514</updated>
+    </task>
+    <servers />
+  </component>
+  <component name="ToolWindowManager">
+    <frame x="1911" y="-9" width="1938" height="1098" extended-state="6" />
+    <editor active="true" />
+    <layout>
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
+      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
+      <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32919255" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+    </layout>
+  </component>
+  <component name="Vcs.Log.UiProperties">
+    <option name="RECENTLY_FILTERED_USER_GROUPS">
+      <collection />
+    </option>
+    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
+      <collection />
+    </option>
+  </component>
+  <component name="VcsContentAnnotationSettings">
+    <option name="myLimit" value="2678400000" />
+  </component>
+  <component name="XDebuggerManager">
+    <breakpoint-manager />
+    <watches-manager />
+  </component>
+  <component name="editorHistoryManager">
+    <entry file="file://$PROJECT_DIR$/Thermocouple.h">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="119">
+          <caret line="61" column="0" selection-start-line="61" selection-start-column="0" selection-end-line="61" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/Thermocouple_lut.cpp">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="262" column="0" selection-start-line="262" selection-start-column="0" selection-end-line="262" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/tc.txt">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="170">
+          <caret line="10" column="21" selection-start-line="10" selection-start-column="21" selection-end-line="10" selection-end-column="21" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/Thermocouple_core_h.txt">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="360">
+          <caret line="30" column="28" selection-start-line="30" selection-start-column="28" selection-end-line="30" selection-end-column="28" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/Thermocouple.cpp">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="561">
+          <caret line="257" column="1" selection-start-line="257" selection-start-column="0" selection-end-line="257" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/lut_script.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="230">
+          <caret line="156" column="32" selection-start-line="156" selection-start-column="32" selection-end-line="156" selection-end-column="32" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/Thermocouple_core_cpp.txt">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="68">
+          <caret line="4" column="29" selection-start-line="4" selection-start-column="29" selection-end-line="4" selection-end-column="29" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+  </component>
+</project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/Thermocouple.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,645 @@
+#include "thermocouple.h"
+
+// http://srdata.nist.gov/its90/download/allcoeff.tab
+
+Thermocouple::Thermocouple() {}
+Thermocouple::~Thermocouple() {}
+
+float Thermocouple::lookup(const int32_t *lut, float voltage, uint16_t size, int16_t offset)
+{
+    uint16_t first = 0;
+    uint16_t last = size - 1;
+    uint16_t middle = (first + last) / 2;
+    int32_t integer_voltage = int32_t(voltage * 1000);
+    while (first <= last) {
+        if (lut[middle] < integer_voltage)
+            first = middle + 1;
+        else if (lut[middle] == integer_voltage) {
+            return static_cast<float>(middle + offset);
+        } else
+            last = middle - 1;
+
+        middle = (first + last) / 2;
+    }
+    if (first > last)
+        return static_cast<float>(first + offset);
+
+    return 0; // should never get here
+}
+
+float Thermocouple::convert(float voltage, const thermocouple_poly_subrange range[], const int n)
+{
+    int range_id = 0;
+    float temperature = 0;
+    for(range_id = 0 ; range_id < n; range_id++) {
+        if(voltage > range[range_id].min_voltage_range && voltage <= range[range_id].max_voltage_range)
+            break;
+    }
+
+    for (int i = 0; i < range[range_id].n; i++) {
+        temperature += (range[range_id].coef[i] * pow(10, range[range_id].power[i])) * pow(voltage, i);
+    }
+    return temperature;
+}
+
+
+
+
+const int Thermocouple_Type_B::inv_poly_size = 2;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_B::inv_poly[2] = {
+    {
+        0.000,   630.615,// characteristic curve for temp range between 0.000, and 630.615,
+        {0.000000000000, -0.246508183460, 0.590404211710, -0.132579316360, 0.156682919010, -0.169445292400, 0.629903470940,},
+        {          0,         -3,         -5,         -8,        -11,        -14,        -18,},
+        7
+    },
+    {
+        630.615,  1820.000,// characteristic curve for temp range between 630.615, and 1820.000,
+        { -0.389381686210, 0.285717474700, -0.848851047850, 0.157852801640, -0.168353448640, 0.111097940130, -0.445154310330, 0.989756408210, -0.937913302890,},
+        {          1,         -1,         -4,         -6,         -9,        -12,        -16,        -20,        -24,},
+        9
+    }
+};
+
+float Thermocouple_Type_B::convert_inv(float temp)
+{
+    return Thermocouple::convert(temp, inv_poly, inv_poly_size);
+}
+
+float Thermocouple_Type_B::lookup_inv(float temp)
+{
+#ifdef TYPE_B_LUT
+    if((temp + lut_offset) > lut_size)
+        return lut[lut_size - 1];
+    else
+        return lut[(uint16_t)temp + lut_offset];
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_B::poly_size = 2;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_B::poly[2] = {
+    {
+        0.291,       2.431, // characteristic curve for mV range between 0.291 and 2.431
+        {  9.8423321,  6.9971500, -8.4765304,  1.0052644, -8.3345952,  4.5508542, -1.5523037,  2.9886750, -2.4742860,},
+        {          1,          2,          2,          3,          2,          2,          2,          1,          0,},
+        9
+    },
+    {
+        2.431,      13.820, // characteristic curve for mV range between 2.431 and 13.820
+        {  2.1315071,  2.8510504, -5.2742887,  9.9160804, -1.2965303,  1.1195870, -6.0625199,  1.8661696, -2.4878585,},
+        {          2,          2,          1,          0,          0,         -1,         -3,         -4,         -6,},
+        9
+    }
+};
+
+Thermocouple_Type_B::~Thermocouple_Type_B()
+{
+
+}
+
+float Thermocouple_Type_B::convert(float voltage)
+{
+    return Thermocouple::convert(voltage, poly, poly_size);
+}
+
+float Thermocouple_Type_B::lookup(float voltage)
+{
+#ifdef TYPE_B_LUT
+    return Thermocouple::lookup(lut, voltage, lut_size, lut_offset);
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_E::inv_poly_size = 2;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_E::inv_poly[2] = {
+    {
+        -270.000,     0.000,// characteristic curve for temp range between -270.000, and 0.000,
+        {0.000000000000, 0.586655087080, 0.454109771240, -0.779980486860, -0.258001608430, -0.594525830570, -0.932140586670, -0.102876055340, -0.803701236210, -0.439794973910, -0.164147763550, -0.396736195160, -0.558273287210, -0.346578420130,},
+        {          0,         -1,         -4,         -6,         -7,         -9,        -11,        -12,        -15,        -17,        -19,        -22,        -25,        -28,},
+        14
+    },
+    {
+        0.000,  1000.000,// characteristic curve for temp range between 0.000, and 1000.000,
+        {0.000000000000, 0.586655087100, 0.450322755820, 0.289084072120, -0.330568966520, 0.650244032700, -0.191974955040, -0.125366004970, 0.214892175690, -0.143880417820, 0.359608994810,},
+        {          0,         -1,         -4,         -7,         -9,        -12,        -15,        -17,        -20,        -23,        -27,},
+        11
+    }
+};
+
+float Thermocouple_Type_E::convert_inv(float temp)
+{
+    return Thermocouple::convert(temp, inv_poly, inv_poly_size);
+}
+
+float Thermocouple_Type_E::lookup_inv(float temp)
+{
+#ifdef TYPE_E_LUT
+    if((temp + lut_offset) > lut_size)
+        return lut[lut_size - 1];
+    else
+        return lut[(uint16_t)temp + lut_offset];
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_E::poly_size = 2;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_E::poly[2] = {
+    {
+        -8.825,       0.000, // characteristic curve for mV range between -8.825 and 0.000
+        {  0.0000000,  1.6977288, -4.3514970, -1.5859697, -9.2502871, -2.6084314, -4.1360199, -3.4034030, -1.1564890,  0.0000000,},
+        {          0,          1,         -1,         -1,         -2,         -2,         -3,         -4,         -5,          0,},
+        10
+    },
+    {
+        0.000,      76.373, // characteristic curve for mV range between 0.000 and 76.373
+        {  0.0000000,  1.7057035, -2.3301759,  6.5435585, -7.3562749, -1.7896001,  8.4036165, -1.3735879,  1.0629823, -3.2447087,},
+        {          0,          1,         -1,         -3,         -5,         -6,         -8,         -9,        -11,        -14,},
+        10
+    }
+};
+
+Thermocouple_Type_E::~Thermocouple_Type_E()
+{
+
+}
+
+float Thermocouple_Type_E::convert(float voltage)
+{
+    return Thermocouple::convert(voltage, poly, poly_size);
+}
+
+float Thermocouple_Type_E::lookup(float voltage)
+{
+#ifdef TYPE_E_LUT
+    return Thermocouple::lookup(lut, voltage, lut_size, lut_offset);
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_J::inv_poly_size = 2;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_J::inv_poly[2] = {
+    {
+        -210.000,   760.000,// characteristic curve for temp range between -210.000, and 760.000,
+        {0.000000000000, 0.503811878150, 0.304758369300, -0.856810657200, 0.132281952950, -0.170529583370, 0.209480906970, -0.125383953360, 0.156317256970,},
+        {          0,         -1,         -4,         -7,         -9,        -12,        -15,        -18,        -22,},
+        9
+    },
+    {
+        760.000,  1200.000,// characteristic curve for temp range between 760.000, and 1200.000,
+        {0.296456256810, -0.149761277860, 0.317871039240, -0.318476867010, 0.157208190040, -0.306913690560,},
+        {          3,          1,         -2,         -5,         -8,        -12,},
+        6
+    }
+};
+
+float Thermocouple_Type_J::convert_inv(float temp)
+{
+    return Thermocouple::convert(temp, inv_poly, inv_poly_size);
+}
+
+float Thermocouple_Type_J::lookup_inv(float temp)
+{
+#ifdef TYPE_J_LUT
+    if((temp + lut_offset) > lut_size)
+        return lut[lut_size - 1];
+    else
+        return lut[(uint16_t)temp + lut_offset];
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_J::poly_size = 3;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_J::poly[3] = {
+    {
+        -8.095,       0.000, // characteristic curve for mV range between -8.095 and 0.000
+        {  0.0000000,  1.9528268, -1.2286185, -1.0752178, -5.9086933, -1.7256713, -2.8131513, -2.3963370, -8.3823321,},
+        {          0,          1,          0,          0,         -1,         -1,         -2,         -3,         -5,},
+        9
+    },
+    {
+        0.000,      42.919, // characteristic curve for mV range between 0.000 and 42.919
+        {   0.000000,   1.978425,  -2.001204,   1.036969,  -2.549687,   3.585153,  -5.344285,   5.099890,   0.000000,},
+        {          0,          1,         -1,         -2,         -4,         -6,         -8,        -10,          0,},
+        9
+    },
+    {
+        42.919,      69.553, // characteristic curve for mV range between 42.919 and 69.553
+        { -3.11358187, 3.00543684, -9.94773230, 1.70276630, -1.43033468, 4.73886084, 0.00000000, 0.00000000, 0.00000000,},
+        {          3,          2,          0,         -1,         -3,         -6,          0,          0,          0,},
+        9
+    }
+};
+
+Thermocouple_Type_J::~Thermocouple_Type_J()
+{
+
+}
+
+float Thermocouple_Type_J::convert(float voltage)
+{
+    return Thermocouple::convert(voltage, poly, poly_size);
+}
+
+float Thermocouple_Type_J::lookup(float voltage)
+{
+#ifdef TYPE_J_LUT
+    return Thermocouple::lookup(lut, voltage, lut_size, lut_offset);
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_K::inv_poly_size = 2;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_K::inv_poly[2] = {
+    {
+        -270.000,     0.000,// characteristic curve for temp range between -270.000, and 0.000,
+        {0.000000000000, 0.394501280250, 0.236223735980, -0.328589067840, -0.499048287770, -0.675090591730, -0.574103274280, -0.310888728940, -0.104516093650, -0.198892668780, -0.163226974860,},
+        {          0,         -1,         -4,         -6,         -8,        -10,        -12,        -14,        -16,        -19,        -22,},
+        11
+    },
+    {
+        0.000,  1372.000,// characteristic curve for temp range between 0.000, and 1372.000,
+        { -0.176004136860, 0.389212049750, 0.185587700320, -0.994575928740, 0.318409457190, -0.560728448890, 0.560750590590, -0.320207200030, 0.971511471520, -0.121047212750,},
+        {         -1,         -1,         -4,         -7,         -9,        -12,        -15,        -18,        -22,        -25,},
+        10
+    }
+};
+
+float Thermocouple_Type_K::convert_inv(float temp)
+{
+    return Thermocouple::convert(temp, inv_poly, inv_poly_size);
+}
+
+float Thermocouple_Type_K::lookup_inv(float temp)
+{
+#ifdef TYPE_K_LUT
+    if((temp + lut_offset) > lut_size)
+        return lut[lut_size - 1];
+    else
+        return lut[(uint16_t)temp + lut_offset];
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_K::poly_size = 3;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_K::poly[3] = {
+    {
+        -5.891,       0.000, // characteristic curve for mV range between -5.891 and 0.000
+        {  0.0000000,  2.5173462, -1.1662878, -1.0833638, -8.9773540, -3.7342377, -8.6632643, -1.0450598, -5.1920577,  0.0000000,},
+        {          0,          1,          0,          0,         -1,         -1,         -2,         -2,         -4,          0,},
+        10
+    },
+    {
+        0.000,      20.644, // characteristic curve for mV range between 0.000 and 20.644
+        {   0.000000,   2.508355,   7.860106,  -2.503131,   8.315270,  -1.228034,   9.804036,  -4.413030,   1.057734,  -1.052755,},
+        {          0,          1,         -2,         -1,         -2,         -2,         -4,         -5,         -6,         -8,},
+        10
+    },
+    {
+        20.644,      54.886, // characteristic curve for mV range between 20.644 and 54.886
+        {  -1.318058,   4.830222,  -1.646031,   5.464731,  -9.650715,   8.802193,  -3.110810,   0.000000,   0.000000,   0.000000,},
+        {          2,          1,          0,         -2,         -4,         -6,         -8,          0,          0,          0,},
+        10
+    }
+};
+
+Thermocouple_Type_K::~Thermocouple_Type_K()
+{
+
+}
+
+float Thermocouple_Type_K::convert(float voltage)
+{
+    return Thermocouple::convert(voltage, poly, poly_size);
+}
+
+float Thermocouple_Type_K::lookup(float voltage)
+{
+#ifdef TYPE_K_LUT
+    return Thermocouple::lookup(lut, voltage, lut_size, lut_offset);
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_N::inv_poly_size = 2;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_N::inv_poly[2] = {
+    {
+        -270.000,     0.000,// characteristic curve for temp range between -270.000, and 0.000,
+        {0.000000000000, 0.261591059620, 0.109574842280, -0.938411115540, -0.464120397590, -0.263033577160, -0.226534380030, -0.760893007910, -0.934196678350,},
+        {          0,         -1,         -4,         -7,        -10,        -11,        -13,        -16,        -19,},
+        9
+    },
+    {
+        0.000,  1300.000,// characteristic curve for temp range between 0.000, and 1300.000,
+        {0.000000000000, 0.259293946010, 0.157101418800, 0.438256272370, -0.252611697940, 0.643118193390, -0.100634715190, 0.997453389920, -0.608632456070, 0.208492293390, -0.306821961510,},
+        {          0,         -1,         -4,         -7,         -9,        -12,        -14,        -18,        -21,        -24,        -28,},
+        11
+    }
+};
+
+float Thermocouple_Type_N::convert_inv(float temp)
+{
+    return Thermocouple::convert(temp, inv_poly, inv_poly_size);
+}
+
+float Thermocouple_Type_N::lookup_inv(float temp)
+{
+#ifdef TYPE_N_LUT
+    if((temp + lut_offset) > lut_size)
+        return lut[lut_size - 1];
+    else
+        return lut[(uint16_t)temp + lut_offset];
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_N::poly_size = 3;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_N::poly[3] = {
+    {
+        -3.990,       0.000, // characteristic curve for mV range between -3.990 and 0.000
+        {  0.0000000,  3.8436847,  1.1010485,  5.2229312,  7.2060525,  5.8488586,  2.7754916,  7.7075166,  1.1582665,  7.3138868,},
+        {          0,          1,          0,          0,          0,          0,          0,         -1,         -1,         -3,},
+        10
+    },
+    {
+        0.000,      20.613, // characteristic curve for mV range between 0.000 and 20.613
+        {    0.00000,    3.86896,   -1.08267,    4.70205,   -2.12169,   -1.17272,    5.39280,   -7.98156,    0.00000,    0.00000,},
+        {          0,          1,          0,         -2,         -6,         -4,         -6,         -8,          0,          0,},
+        10
+    },
+    {
+        20.613,      47.513, // characteristic curve for mV range between 20.613 and 47.513
+        {   1.972485,   3.300943,  -3.915159,   9.855391,  -1.274371,   7.767022,   0.000000,   0.000000,   0.000000,   0.000000,},
+        {          1,          1,         -1,         -3,         -4,         -7,          0,          0,          0,          0,},
+        10
+    }
+};
+
+Thermocouple_Type_N::~Thermocouple_Type_N()
+{
+
+}
+
+float Thermocouple_Type_N::convert(float voltage)
+{
+    return Thermocouple::convert(voltage, poly, poly_size);
+}
+
+float Thermocouple_Type_N::lookup(float voltage)
+{
+#ifdef TYPE_N_LUT
+    return Thermocouple::lookup(lut, voltage, lut_size, lut_offset);
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_R::inv_poly_size = 3;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_R::inv_poly[3] = {
+    {
+        -50.000,  1064.180,// characteristic curve for temp range between -50.000, and 1064.180,
+        {0.000000000000, 0.528961729765, 0.139166589782, -0.238855693017, 0.356916001063, -0.462347666298, 0.500777441034, -0.373105886191, 0.157716482367, -0.281038625251,},
+        {          0,         -2,         -4,         -7,        -10,        -13,        -16,        -19,        -22,        -26,},
+        10
+    },
+    {
+        1064.180,  1664.500,// characteristic curve for temp range between 1064.180, and 1664.500,
+        {0.295157925316, -0.252061251332, 0.159564501865, -0.764085947576, 0.205305291024, -0.293359668173,},
+        {          1,         -2,         -4,         -8,        -11,        -15,},
+        6
+    },
+    {
+        1664.500,  1768.100,// characteristic curve for temp range between 1664.500, and 1768.100,
+        {0.152232118209, -0.268819888545, 0.171280280471, -0.345895706453, -0.934633971046,},
+        {          3,          0,         -3,         -7,        -14,},
+        5
+    }
+};
+
+float Thermocouple_Type_R::convert_inv(float temp)
+{
+    return Thermocouple::convert(temp, inv_poly, inv_poly_size);
+}
+
+float Thermocouple_Type_R::lookup_inv(float temp)
+{
+#ifdef TYPE_R_LUT
+    if((temp + lut_offset) > lut_size)
+        return lut[lut_size - 1];
+    else
+        return lut[(uint16_t)temp + lut_offset];
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_R::poly_size = 4;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_R::poly[4] = {
+    {
+        -0.226,       1.923, // characteristic curve for mV range between -0.226 and 1.923
+        {  0.0000000,  1.8891380, -9.3835290,  1.3068619, -2.2703580,  3.5145659, -3.8953900,  2.8239471, -1.2607281,  3.1353611, -3.3187769,},
+        {          0,          2,          1,          2,          2,          2,          2,          2,          2,          1,          0,},
+        11
+    },
+    {
+        1.923,      13.228, // characteristic curve for mV range between 1.923 and 13.228
+        {1.334584505, 1.472644573, -1.844024844, 4.031129726, -6.249428360, 6.468412046, -4.458750426, 1.994710149, -5.313401790, 6.481976217, 0.000000000,},
+        {          1,          2,          1,          0,         -1,         -2,         -3,         -4,         -6,         -8,          0,},
+        11
+    },
+    {
+        11.361,      19.739, // characteristic curve for mV range between 11.361 and 19.739
+        { -8.199599416, 1.553962042, -8.342197663, 4.279433549, -1.191577910, 1.492290091, 0.000000000, 0.000000000, 0.000000000, 0.000000000, 0.000000000,},
+        {          1,          2,          0,         -1,         -2,         -4,          0,          0,          0,          0,          0,},
+        11
+    },
+    {
+        19.739,      21.103, // characteristic curve for mV range between 19.739 and 21.103
+        {3.406177836, -7.023729171, 5.582903813, -1.952394635, 2.560740231, 0.000000000, 0.000000000, 0.000000000, 0.000000000, 0.000000000, 0.000000000,},
+        {          4,          3,          2,          1,         -1,          0,          0,          0,          0,          0,          0,},
+        11
+    }
+};
+
+Thermocouple_Type_R::~Thermocouple_Type_R()
+{
+
+}
+
+float Thermocouple_Type_R::convert(float voltage)
+{
+    return Thermocouple::convert(voltage, poly, poly_size);
+}
+
+float Thermocouple_Type_R::lookup(float voltage)
+{
+#ifdef TYPE_R_LUT
+    return Thermocouple::lookup(lut, voltage, lut_size, lut_offset);
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_S::inv_poly_size = 3;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_S::inv_poly[3] = {
+    {
+        -50.000,  1064.180,// characteristic curve for temp range between -50.000, and 1064.180,
+        {0.000000000000, 0.540313308631, 0.125934289740, -0.232477968689, 0.322028823036, -0.331465196389, 0.255744251786, -0.125068871393, 0.271443176145,},
+        {          0,         -2,         -4,         -7,        -10,        -13,        -16,        -19,        -23,},
+        9
+    },
+    {
+        1064.180,  1664.500,// characteristic curve for temp range between 1064.180, and 1664.500,
+        {0.132900444085, 0.334509311344, 0.654805192818, -0.164856259209, 0.129989605174,},
+        {          1,         -2,         -5,         -8,        -13,},
+        5
+    },
+    {
+        1664.500,  1768.100,// characteristic curve for temp range between 1664.500, and 1768.100,
+        {0.146628232636, -0.258430516752, 0.163693574641, -0.330439046987, -0.943223690612,},
+        {          3,          0,         -3,         -7,        -14,},
+        5
+    }
+};
+
+float Thermocouple_Type_S::convert_inv(float temp)
+{
+    return Thermocouple::convert(temp, inv_poly, inv_poly_size);
+}
+
+float Thermocouple_Type_S::lookup_inv(float temp)
+{
+#ifdef TYPE_S_LUT
+    if((temp + lut_offset) > lut_size)
+        return lut[lut_size - 1];
+    else
+        return lut[(uint16_t)temp + lut_offset];
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_S::poly_size = 4;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_S::poly[4] = {
+    {
+        -0.235,       1.874, // characteristic curve for mV range between -0.235 and 1.874
+        { 0.00000000, 1.84949460, -8.00504062, 1.02237430, -1.52248592, 1.88821343, -1.59085941, 8.23027880, -2.34181944, 2.79786260,},
+        {          0,          2,          1,          2,          2,          2,          2,          1,          1,          0,},
+        10
+    },
+    {
+        1.874,      11.950, // characteristic curve for mV range between 1.874 and 11.950
+        {1.291507177, 1.466298863, -1.534713402, 3.145945973, -4.163257839, 3.187963771, -1.291637500, 2.183475087, -1.447379511, 8.211272125,},
+        {          1,          2,          1,          0,         -1,         -2,         -3,         -5,         -7,         -9,},
+        10
+    },
+    {
+        10.332,      17.536, // characteristic curve for mV range between 10.332 and 17.536
+        { -8.087801117, 1.621573104, -8.536869453, 4.719686976, -1.441693666, 2.081618890, 0.000000000, 0.000000000, 0.000000000, 0.000000000,},
+        {          1,          2,          0,         -1,         -2,         -4,          0,          0,          0,          0,},
+        10
+    },
+    {
+        17.536,      18.693, // characteristic curve for mV range between 17.536 and 18.693
+        {5.333875126, -1.235892298, 1.092657613, -4.265693686, 6.247205420, 0.000000000, 0.000000000, 0.000000000, 0.000000000, 0.000000000,},
+        {          4,          4,          3,          1,         -1,          0,          0,          0,          0,          0,},
+        10
+    }
+};
+
+Thermocouple_Type_S::~Thermocouple_Type_S()
+{
+
+}
+
+float Thermocouple_Type_S::convert(float voltage)
+{
+    return Thermocouple::convert(voltage, poly, poly_size);
+}
+
+float Thermocouple_Type_S::lookup(float voltage)
+{
+#ifdef TYPE_S_LUT
+    return Thermocouple::lookup(lut, voltage, lut_size, lut_offset);
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_T::inv_poly_size = 2;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_T::inv_poly[2] = {
+    {
+        -270.000,     0.000,// characteristic curve for temp range between -270.000, and 0.000,
+        {0.000000000000, 0.387481063640, 0.441944343470, 0.118443231050, 0.200329735540, 0.901380195590, 0.226511565930, 0.360711542050, 0.384939398830, 0.282135219250, 0.142515947790, 0.487686622860, 0.107955392700, 0.139450270620, 0.797951539270,},
+        {          0,         -1,         -4,         -6,         -7,         -9,        -10,        -12,        -14,        -16,        -18,        -21,        -23,        -26,        -30,},
+        15
+    },
+    {
+        0.000,   400.000,// characteristic curve for temp range between 0.000, and 400.000,
+        {0.000000000000, 0.387481063640, 0.332922278800, 0.206182434040, -0.218822568460, 0.109968809280, -0.308157587720, 0.454791352900, -0.275129016730,},
+        {          0,         -1,         -4,         -6,         -8,        -10,        -13,        -16,        -19,},
+        9
+    }
+};
+
+float Thermocouple_Type_T::convert_inv(float temp)
+{
+    return Thermocouple::convert(temp, inv_poly, inv_poly_size);
+}
+
+float Thermocouple_Type_T::lookup_inv(float temp)
+{
+#ifdef TYPE_T_LUT
+    if((temp + lut_offset) > lut_size)
+        return lut[lut_size - 1];
+    else
+        return lut[(uint16_t)temp + lut_offset];
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
+const int Thermocouple_Type_T::poly_size = 2;
+const Thermocouple::thermocouple_poly_subrange Thermocouple_Type_T::poly[2] = {
+    {
+        -5.603,       0.000, // characteristic curve for mV range between -5.603 and 0.000
+        {  0.0000000,  2.5949192, -2.1316967,  7.9018692,  4.2527777,  1.3304473,  2.0241446,  1.2668171,},
+        {          0,          1,         -1,         -1,         -1,         -1,         -2,         -3,},
+        8
+    },
+    {
+        0.000,      20.872, // characteristic curve for mV range between 0.000 and 20.872
+        {   0.000000,   2.592800,  -7.602961,   4.637791,  -2.165394,   6.048144,  -7.293422,   0.000000,},
+        {          0,          1,         -1,         -2,         -3,         -5,         -7,          0,},
+        8
+    }
+};
+
+Thermocouple_Type_T::~Thermocouple_Type_T()
+{
+
+}
+
+float Thermocouple_Type_T::convert(float voltage)
+{
+    return Thermocouple::convert(voltage, poly, poly_size);
+}
+
+float Thermocouple_Type_T::lookup(float voltage)
+{
+#ifdef TYPE_T_LUT
+    return Thermocouple::lookup(lut, voltage, lut_size, lut_offset);
+#else
+    /* NOT IMPLEMENTED */
+    return 0;
+#endif
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/Thermocouple.h	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,212 @@
+#include "mbed.h"
+#ifndef _THERMOCOUPLE_H_
+#define _THERMOCOUPLE_H_
+
+#define DEFINE_LOOKUP_TABLES
+#ifdef DEFINE_LOOKUP_TABLES
+#define TYPE_B_LUT
+#define TYPE_E_LUT
+#define TYPE_J_LUT
+#define TYPE_K_LUT
+#define TYPE_N_LUT
+#define TYPE_R_LUT
+#define TYPE_S_LUT
+#define TYPE_T_LUT
+#endif
+
+class Thermocouple
+{
+private:
+
+public:
+    typedef struct {
+        float min_voltage_range;
+        float max_voltage_range;
+        float coef[16];
+        float power[16];
+        int n;
+    } thermocouple_poly_subrange;
+    Thermocouple();
+    virtual ~Thermocouple();
+    static float convert(float voltage, const thermocouple_poly_subrange range[], const int n);
+    static float lookup(const int32_t *lut, float voltage, uint16_t size, int16_t offset);
+    virtual float convert(float voltage) = 0;
+    virtual float convert_inv(float temp) = 0;
+    virtual float lookup(float voltage) = 0;
+    virtual float lookup_inv(float temp) = 0;
+
+};
+
+
+
+
+class Thermocouple_Type_B : public Thermocouple
+{
+public:
+    ~Thermocouple_Type_B();
+    static const thermocouple_poly_subrange inv_poly[2];
+    static const int inv_poly_size;
+    float convert_inv(float temp);
+
+    static const thermocouple_poly_subrange poly[2];
+    static const int poly_size;
+    float convert(float voltage);
+#ifdef TYPE_B_LUT
+    static const int32_t lut[];
+    static const int16_t lut_offset;
+    static const uint16_t lut_size;
+    float lookup(float voltage);
+    float lookup_inv(float temp);
+#endif
+};
+
+
+class Thermocouple_Type_E : public Thermocouple
+{
+public:
+    ~Thermocouple_Type_E();
+    static const thermocouple_poly_subrange inv_poly[2];
+    static const int inv_poly_size;
+    float convert_inv(float temp);
+
+    static const thermocouple_poly_subrange poly[2];
+    static const int poly_size;
+    float convert(float voltage);
+#ifdef TYPE_E_LUT
+    static const int32_t lut[];
+    static const int16_t lut_offset;
+    static const uint16_t lut_size;
+    float lookup(float voltage);
+    float lookup_inv(float temp);
+#endif
+};
+
+
+class Thermocouple_Type_J : public Thermocouple
+{
+public:
+    ~Thermocouple_Type_J();
+    static const thermocouple_poly_subrange inv_poly[2];
+    static const int inv_poly_size;
+    float convert_inv(float temp);
+
+    static const thermocouple_poly_subrange poly[3];
+    static const int poly_size;
+    float convert(float voltage);
+#ifdef TYPE_J_LUT
+    static const int32_t lut[];
+    static const int16_t lut_offset;
+    static const uint16_t lut_size;
+    float lookup(float voltage);
+    float lookup_inv(float temp);
+#endif
+};
+
+
+class Thermocouple_Type_K : public Thermocouple
+{
+public:
+    ~Thermocouple_Type_K();
+    static const thermocouple_poly_subrange inv_poly[2];
+    static const int inv_poly_size;
+    float convert_inv(float temp);
+
+    static const thermocouple_poly_subrange poly[3];
+    static const int poly_size;
+    float convert(float voltage);
+#ifdef TYPE_K_LUT
+    static const int32_t lut[];
+    static const int16_t lut_offset;
+    static const uint16_t lut_size;
+    float lookup(float voltage);
+    float lookup_inv(float temp);
+#endif
+};
+
+
+class Thermocouple_Type_N : public Thermocouple
+{
+public:
+    ~Thermocouple_Type_N();
+    static const thermocouple_poly_subrange inv_poly[2];
+    static const int inv_poly_size;
+    float convert_inv(float temp);
+
+    static const thermocouple_poly_subrange poly[3];
+    static const int poly_size;
+    float convert(float voltage);
+#ifdef TYPE_N_LUT
+    static const int32_t lut[];
+    static const int16_t lut_offset;
+    static const uint16_t lut_size;
+    float lookup(float voltage);
+    float lookup_inv(float temp);
+#endif
+};
+
+
+class Thermocouple_Type_R : public Thermocouple
+{
+public:
+    ~Thermocouple_Type_R();
+    static const thermocouple_poly_subrange inv_poly[3];
+    static const int inv_poly_size;
+    float convert_inv(float temp);
+
+    static const thermocouple_poly_subrange poly[4];
+    static const int poly_size;
+    float convert(float voltage);
+#ifdef TYPE_R_LUT
+    static const int32_t lut[];
+    static const int16_t lut_offset;
+    static const uint16_t lut_size;
+    float lookup(float voltage);
+    float lookup_inv(float temp);
+#endif
+};
+
+
+class Thermocouple_Type_S : public Thermocouple
+{
+public:
+    ~Thermocouple_Type_S();
+    static const thermocouple_poly_subrange inv_poly[3];
+    static const int inv_poly_size;
+    float convert_inv(float temp);
+
+    static const thermocouple_poly_subrange poly[4];
+    static const int poly_size;
+    float convert(float voltage);
+#ifdef TYPE_S_LUT
+    static const int32_t lut[];
+    static const int16_t lut_offset;
+    static const uint16_t lut_size;
+    float lookup(float voltage);
+    float lookup_inv(float temp);
+#endif
+};
+
+
+class Thermocouple_Type_T : public Thermocouple
+{
+public:
+    ~Thermocouple_Type_T();
+    static const thermocouple_poly_subrange inv_poly[2];
+    static const int inv_poly_size;
+    float convert_inv(float temp);
+
+    static const thermocouple_poly_subrange poly[2];
+    static const int poly_size;
+    float convert(float voltage);
+#ifdef TYPE_T_LUT
+    static const int32_t lut[];
+    static const int16_t lut_offset;
+    static const uint16_t lut_size;
+    float lookup(float voltage);
+    float lookup_inv(float temp);
+#endif
+};
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/Thermocouple_core_cpp.txt	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,43 @@
+#include "thermocouple.h"
+
+// http://srdata.nist.gov/its90/download/allcoeff.tab
+
+Thermocouple::Thermocouple(){}
+Thermocouple::~Thermocouple() {}
+
+float Thermocouple::lookup(const int32_t *lut, float voltage, uint16_t size, int16_t offset) {
+    uint16_t first = 0;
+    uint16_t last = size - 1;
+    uint16_t middle = (first + last) / 2;
+    int32_t integer_voltage = int32_t(voltage*1000);
+    while (first <= last) {
+        if (lut[middle] < integer_voltage)
+            first = middle + 1;
+        else if (lut[middle] == integer_voltage) {
+            return static_cast<float>(middle + offset);
+        } else
+            last = middle - 1;
+
+        middle = (first + last) / 2;
+    }
+    if (first > last)
+        return static_cast<float>(first+offset);
+
+    return 0; // should never get here
+}
+
+float Thermocouple::convert(float voltage, const thermocouple_poly_subrange range[], const int n) {
+    int range_id = 0;
+    float temperature=0;
+    for(range_id = 0 ; range_id<n;range_id++)
+    {
+        if(voltage > range[range_id].min_voltage_range && voltage <= range[range_id].max_voltage_range)
+            break;
+    }
+
+    for (int i = 0; i < range[range_id].n; i++) {
+        temperature += (range[range_id].coef[i] * pow(10,range[range_id].power[i])) * pow(voltage, i);
+    }
+    return temperature;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/Thermocouple_core_h.txt	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#ifndef _THERMOCOUPLE_H_
+#define _THERMOCOUPLE_H_
+
+#define DEFINE_LOOKUP_TABLES
+#ifdef DEFINE_LOOKUP_TABLES
+#define TYPE_B_LUT
+#define TYPE_E_LUT
+#define TYPE_J_LUT
+#define TYPE_K_LUT
+#define TYPE_N_LUT
+#define TYPE_R_LUT
+#define TYPE_S_LUT
+#define TYPE_T_LUT
+#endif
+
+class Thermocouple
+{
+private:
+
+public:
+	typedef struct
+		{
+			float min_voltage_range;
+			float max_voltage_range;
+			float coef[16];
+			float power[16];
+			int n;
+		}thermocouple_poly_subrange;
+	Thermocouple();
+	virtual ~Thermocouple();
+	static float convert(float voltage, const thermocouple_poly_subrange range[], const int n);
+	static float lookup(const int32_t *lut, float voltage,uint16_t size,int16_t offset);
+	virtual float convert(float voltage) = 0;
+	virtual float convert_inv(float temp) = 0;
+	virtual float lookup(float voltage) = 0;
+	virtual float lookup_inv(float temp) = 0;
+
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/Thermocouple_lut.cpp	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,1262 @@
+#include "thermocouple.h"
+
+
+#ifdef TYPE_B_LUT
+const int16_t Thermocouple_Type_B::lut_offset = 0;
+const uint16_t Thermocouple_Type_B::lut_size = 1820;
+const int32_t Thermocouple_Type_B::lut[1820] = {
+    -3,       -3,       -3,       -3,       -3,       -3,       -3,       -2,       -2,       -2,
+    -2,       -2,       -2,       -2,       -2,       -2,       -2,       -2,       -2,       -2,
+    -2,       -2,       -2,       -2,       -2,       -2,       -2,       -1,       -1,       -1,
+    -1,       -1,       -1,       -1,       -1,       -1,       -1,        0,        0,        0,
+    0,        0,        0,        0,        1,        1,        1,        2,        2,        2,
+    3,        3,        3,        4,        4,        4,        5,        5,        6,        6,
+    7,        7,        8,        8,        9,        9,       10,       10,       11,       11,
+    12,       12,       13,       14,       14,       15,       15,       16,       17,       17,
+    18,       19,       20,       20,       21,       22,       22,       23,       24,       25,
+    26,       26,       27,       28,       29,       30,       31,       31,       32,       33,
+    34,       35,       36,       37,       38,       39,       40,       41,       42,       43,
+    44,       45,       46,       47,       48,       49,       50,       51,       52,       53,
+    55,       56,       57,       58,       59,       60,       62,       63,       64,       65,
+    66,       68,       69,       70,       72,       73,       74,       75,       77,       78,
+    79,       81,       82,       84,       85,       86,       88,       89,       91,       92,
+    94,       95,       96,       98,       99,      101,      102,      104,      106,      107,
+    109,      110,      112,      113,      115,      117,      118,      120,      122,      123,
+    125,      127,      128,      130,      132,      134,      135,      137,      139,      141,
+    142,      144,      146,      148,      150,      151,      153,      155,      157,      159,
+    161,      163,      165,      166,      168,      170,      172,      174,      176,      178,
+    180,      182,      184,      186,      188,      190,      192,      195,      197,      199,
+    201,      203,      205,      207,      209,      212,      214,      216,      218,      220,
+    222,      225,      227,      229,      231,      234,      236,      238,      241,      243,
+    245,      248,      250,      252,      255,      257,      259,      262,      264,      267,
+    269,      271,      274,      276,      279,      281,      284,      286,      289,      291,
+    294,      296,      299,      301,      304,      307,      309,      312,      314,      317,
+    320,      322,      325,      328,      330,      333,      336,      338,      341,      344,
+    347,      349,      352,      355,      358,      360,      363,      366,      369,      372,
+    375,      377,      380,      383,      386,      389,      392,      395,      398,      401,
+    404,      407,      410,      413,      416,      419,      422,      425,      428,      431,
+    434,      437,      440,      443,      446,      449,      452,      455,      458,      462,
+    465,      468,      471,      474,      478,      481,      484,      487,      490,      494,
+    497,      500,      503,      507,      510,      513,      517,      520,      523,      527,
+    530,      533,      537,      540,      544,      547,      550,      554,      557,      561,
+    564,      568,      571,      575,      578,      582,      585,      589,      592,      596,
+    599,      603,      607,      610,      614,      617,      621,      625,      628,      632,
+    636,      639,      643,      647,      650,      654,      658,      662,      665,      669,
+    673,      677,      680,      684,      688,      692,      696,      700,      703,      707,
+    711,      715,      719,      723,      727,      731,      735,      738,      742,      746,
+    750,      754,      758,      762,      766,      770,      774,      778,      782,      787,
+    791,      795,      799,      803,      807,      811,      815,      819,      824,      828,
+    832,      836,      840,      844,      849,      853,      857,      861,      866,      870,
+    874,      878,      883,      887,      891,      896,      900,      904,      909,      913,
+    917,      922,      926,      930,      935,      939,      944,      948,      953,      957,
+    961,      966,      970,      975,      979,      984,      988,      993,      997,     1002,
+    1006,     1010,     1016,     1020,     1025,     1030,     1034,     1039,     1043,     1048,
+    1053,     1057,     1062,     1067,     1071,     1076,     1081,     1086,     1090,     1095,
+    1100,     1105,     1109,     1114,     1119,     1124,     1129,     1133,     1138,     1143,
+    1148,     1153,     1158,     1163,     1167,     1172,     1177,     1182,     1187,     1192,
+    1197,     1202,     1207,     1212,     1217,     1222,     1227,     1232,     1237,     1242,
+    1247,     1252,     1257,     1262,     1267,     1272,     1277,     1282,     1288,     1293,
+    1298,     1303,     1308,     1313,     1318,     1324,     1329,     1334,     1339,     1344,
+    1350,     1355,     1360,     1365,     1371,     1376,     1381,     1387,     1392,     1397,
+    1402,     1408,     1413,     1418,     1424,     1429,     1435,     1440,     1445,     1451,
+    1456,     1462,     1467,     1472,     1478,     1483,     1489,     1494,     1500,     1505,
+    1511,     1516,     1522,     1527,     1533,     1539,     1544,     1550,     1555,     1561,
+    1566,     1572,     1578,     1583,     1589,     1595,     1600,     1606,     1612,     1617,
+    1623,     1629,     1634,     1640,     1646,     1652,     1657,     1663,     1669,     1675,
+    1680,     1686,     1692,     1698,     1704,     1709,     1715,     1721,     1727,     1733,
+    1739,     1745,     1750,     1756,     1762,     1768,     1774,     1780,     1786,     1792,
+    1798,     1804,     1810,     1816,     1822,     1828,     1834,     1840,     1846,     1852,
+    1858,     1864,     1870,     1876,     1882,     1888,     1894,     1901,     1907,     1913,
+    1919,     1925,     1931,     1937,     1944,     1950,     1956,     1962,     1968,     1975,
+    1981,     1987,     1993,     1999,     2005,     2012,     2017,     2025,     2031,     2037,
+    2043,     2050,     2056,     2062,     2069,     2075,     2082,     2088,     2094,     2101,
+    2107,     2113,     2120,     2126,     2133,     2139,     2146,     2152,     2158,     2165,
+    2171,     2178,     2184,     2191,     2197,     2204,     2210,     2217,     2224,     2230,
+    2237,     2243,     2250,     2256,     2263,     2270,     2276,     2283,     2289,     2296,
+    2303,     2309,     2316,     2323,     2329,     2336,     2343,     2350,     2356,     2363,
+    2370,     2376,     2383,     2390,     2397,     2403,     2410,     2417,     2424,     2431,
+    2437,     2444,     2451,     2458,     2465,     2472,     2479,     2485,     2492,     2499,
+    2506,     2513,     2520,     2527,     2534,     2541,     2548,     2555,     2562,     2569,
+    2576,     2583,     2590,     2597,     2604,     2611,     2618,     2625,     2632,     2639,
+    2646,     2653,     2660,     2667,     2674,     2681,     2688,     2696,     2703,     2710,
+    2717,     2724,     2731,     2738,     2746,     2753,     2760,     2767,     2775,     2782,
+    2789,     2796,     2803,     2811,     2818,     2825,     2833,     2840,     2847,     2854,
+    2862,     2869,     2876,     2884,     2891,     2898,     2906,     2913,     2921,     2928,
+    2935,     2943,     2950,     2958,     2965,     2973,     2980,     2987,     2995,     3002,
+    3010,     3017,     3025,     3032,     3040,     3047,     3055,     3062,     3070,     3078,
+    3085,     3093,     3100,     3108,     3116,     3123,     3131,     3138,     3146,     3154,
+    3161,     3169,     3177,     3184,     3192,     3200,     3207,     3215,     3223,     3230,
+    3238,     3246,     3254,     3261,     3269,     3277,     3285,     3292,     3300,     3308,
+    3316,     3324,     3331,     3339,     3347,     3355,     3363,     3371,     3379,     3386,
+    3394,     3402,     3410,     3418,     3426,     3434,     3442,     3450,     3458,     3466,
+    3474,     3482,     3490,     3498,     3506,     3514,     3522,     3530,     3538,     3546,
+    3554,     3562,     3570,     3578,     3586,     3594,     3602,     3610,     3618,     3626,
+    3634,     3643,     3651,     3659,     3667,     3675,     3683,     3692,     3700,     3708,
+    3716,     3724,     3732,     3741,     3749,     3757,     3765,     3774,     3782,     3790,
+    3798,     3807,     3815,     3823,     3832,     3840,     3848,     3857,     3865,     3873,
+    3882,     3890,     3898,     3907,     3915,     3923,     3932,     3940,     3949,     3957,
+    3965,     3974,     3982,     3991,     3999,     4008,     4016,     4024,     4033,     4041,
+    4050,     4058,     4067,     4075,     4083,     4093,     4101,     4110,     4118,     4127,
+    4135,     4144,     4152,     4161,     4170,     4178,     4187,     4195,     4204,     4213,
+    4221,     4230,     4239,     4247,     4256,     4265,     4273,     4282,     4291,     4299,
+    4308,     4317,     4326,     4334,     4343,     4352,     4360,     4369,     4378,     4387,
+    4396,     4404,     4413,     4422,     4431,     4440,     4448,     4457,     4466,     4475,
+    4484,     4493,     4501,     4510,     4519,     4528,     4537,     4546,     4555,     4564,
+    4573,     4582,     4591,     4599,     4608,     4617,     4626,     4635,     4644,     4653,
+    4662,     4671,     4680,     4689,     4698,     4707,     4716,     4725,     4734,     4743,
+    4753,     4762,     4771,     4780,     4789,     4798,     4807,     4816,     4825,     4834,
+    4843,     4853,     4862,     4871,     4880,     4889,     4898,     4908,     4917,     4926,
+    4935,     4944,     4954,     4963,     4972,     4981,     4990,     5000,     5009,     5018,
+    5027,     5037,     5046,     5055,     5065,     5074,     5083,     5092,     5102,     5111,
+    5120,     5130,     5139,     5148,     5158,     5167,     5176,     5186,     5195,     5205,
+    5214,     5223,     5233,     5242,     5252,     5261,     5270,     5280,     5289,     5299,
+    5308,     5318,     5327,     5337,     5346,     5356,     5365,     5375,     5384,     5394,
+    5403,     5413,     5422,     5432,     5441,     5451,     5460,     5470,     5480,     5489,
+    5499,     5508,     5518,     5528,     5537,     5547,     5556,     5566,     5576,     5585,
+    5595,     5605,     5614,     5624,     5634,     5643,     5653,     5663,     5672,     5682,
+    5692,     5702,     5711,     5721,     5731,     5740,     5750,     5760,     5770,     5780,
+    5789,     5799,     5809,     5819,     5828,     5838,     5848,     5858,     5868,     5878,
+    5887,     5897,     5907,     5917,     5927,     5937,     5947,     5956,     5966,     5976,
+    5986,     5996,     6006,     6016,     6026,     6036,     6046,     6055,     6065,     6075,
+    6085,     6095,     6105,     6115,     6125,     6135,     6145,     6155,     6165,     6175,
+    6185,     6195,     6205,     6215,     6225,     6235,     6245,     6256,     6266,     6276,
+    6286,     6296,     6306,     6316,     6326,     6336,     6346,     6356,     6367,     6377,
+    6387,     6397,     6407,     6417,     6427,     6438,     6448,     6458,     6468,     6478,
+    6488,     6499,     6509,     6519,     6529,     6539,     6550,     6560,     6570,     6580,
+    6591,     6601,     6611,     6621,     6632,     6642,     6652,     6663,     6673,     6683,
+    6693,     6704,     6714,     6724,     6735,     6745,     6755,     6766,     6776,     6786,
+    6797,     6807,     6818,     6828,     6838,     6849,     6859,     6869,     6880,     6890,
+    6901,     6911,     6922,     6932,     6942,     6953,     6963,     6974,     6984,     6995,
+    7005,     7016,     7026,     7037,     7047,     7058,     7068,     7079,     7089,     7100,
+    7110,     7121,     7131,     7142,     7152,     7163,     7173,     7184,     7194,     7205,
+    7216,     7226,     7237,     7247,     7258,     7269,     7279,     7290,     7300,     7311,
+    7322,     7332,     7343,     7353,     7364,     7375,     7385,     7396,     7407,     7417,
+    7428,     7439,     7449,     7460,     7471,     7482,     7492,     7503,     7514,     7524,
+    7535,     7546,     7557,     7567,     7578,     7589,     7600,     7610,     7621,     7632,
+    7643,     7653,     7664,     7675,     7686,     7697,     7707,     7718,     7729,     7740,
+    7751,     7761,     7772,     7783,     7794,     7805,     7816,     7827,     7837,     7848,
+    7859,     7870,     7881,     7892,     7903,     7914,     7924,     7935,     7946,     7957,
+    7968,     7979,     7990,     8000,     8012,     8023,     8034,     8045,     8055,     8066,
+    8077,     8087,     8099,     8109,     8121,     8132,     8143,     8154,     8164,     8176,
+    8186,     8198,     8209,     8220,     8231,     8242,     8253,     8264,     8275,     8286,
+    8298,     8309,     8320,     8331,     8342,     8353,     8364,     8375,     8386,     8397,
+    8408,     8419,     8430,     8441,     8453,     8464,     8475,     8486,     8497,     8508,
+    8519,     8530,     8542,     8553,     8564,     8575,     8586,     8597,     8608,     8620,
+    8631,     8642,     8653,     8664,     8675,     8687,     8698,     8709,     8720,     8731,
+    8743,     8754,     8765,     8776,     8787,     8799,     8810,     8821,     8832,     8844,
+    8855,     8866,     8877,     8889,     8900,     8911,     8922,     8934,     8945,     8956,
+    8967,     8979,     8990,     9001,     9013,     9024,     9035,     9047,     9058,     9069,
+    9080,     9092,     9103,     9114,     9126,     9137,     9148,     9160,     9171,     9182,
+    9194,     9205,     9216,     9228,     9239,     9251,     9262,     9273,     9285,     9296,
+    9307,     9319,     9330,     9342,     9353,     9364,     9376,     9387,     9398,     9410,
+    9421,     9433,     9444,     9456,     9467,     9478,     9490,     9501,     9513,     9524,
+    9536,     9547,     9558,     9570,     9581,     9593,     9604,     9616,     9627,     9639,
+    9650,     9662,     9673,     9684,     9696,     9707,     9719,     9730,     9742,     9753,
+    9765,     9776,     9788,     9799,     9811,     9822,     9834,     9845,     9857,     9868,
+    9880,     9891,     9903,     9914,     9926,     9937,     9949,     9961,     9972,     9984,
+    9995,    10007,    10018,    10030,    10041,    10053,    10064,    10076,    10088,    10099,
+    10111,    10122,    10134,    10145,    10157,    10168,    10180,    10192,    10203,    10215,
+    10226,    10238,    10249,    10261,    10273,    10284,    10296,    10307,    10319,    10331,
+    10342,    10354,    10365,    10377,    10389,    10400,    10412,    10423,    10435,    10447,
+    10458,    10470,    10482,    10493,    10505,    10516,    10528,    10540,    10551,    10563,
+    10575,    10586,    10598,    10609,    10621,    10633,    10644,    10656,    10668,    10679,
+    10691,    10703,    10714,    10726,    10738,    10749,    10761,    10773,    10784,    10796,
+    10808,    10819,    10831,    10843,    10854,    10866,    10877,    10889,    10901,    10913,
+    10924,    10936,    10948,    10959,    10971,    10983,    10994,    11006,    11018,    11029,
+    11041,    11053,    11064,    11076,    11088,    11099,    11111,    11123,    11134,    11146,
+    11158,    11169,    11181,    11193,    11205,    11216,    11228,    11240,    11251,    11263,
+    11275,    11286,    11298,    11310,    11321,    11333,    11345,    11357,    11368,    11380,
+    11392,    11403,    11415,    11427,    11438,    11450,    11462,    11474,    11485,    11497,
+    11509,    11520,    11532,    11544,    11555,    11567,    11579,    11591,    11602,    11614,
+    11626,    11637,    11649,    11661,    11673,    11684,    11696,    11708,    11719,    11731,
+    11743,    11754,    11766,    11778,    11790,    11801,    11813,    11825,    11836,    11848,
+    11860,    11871,    11883,    11895,    11907,    11918,    11930,    11942,    11953,    11965,
+    11977,    11988,    12000,    12012,    12024,    12035,    12047,    12059,    12070,    12082,
+    12094,    12105,    12117,    12129,    12141,    12152,    12164,    12176,    12187,    12199,
+    12211,    12222,    12234,    12246,    12257,    12269,    12281,    12292,    12304,    12316,
+    12327,    12339,    12351,    12363,    12374,    12386,    12398,    12409,    12421,    12433,
+    12444,    12456,    12468,    12479,    12491,    12503,    12514,    12526,    12538,    12549,
+    12561,    12572,    12584,    12596,    12607,    12619,    12631,    12642,    12654,    12666,
+    12677,    12689,    12701,    12712,    12724,    12736,    12747,    12759,    12770,    12782,
+    12794,    12805,    12817,    12829,    12840,    12852,    12863,    12875,    12887,    12898,
+    12910,    12921,    12933,    12945,    12956,    12968,    12980,    12991,    13003,    13014,
+    13026,    13037,    13049,    13061,    13072,    13084,    13095,    13107,    13119,    13130,
+    13142,    13153,    13165,    13176,    13188,    13200,    13211,    13223,    13234,    13246,
+    13257,    13269,    13280,    13292,    13304,    13315,    13327,    13338,    13350,    13361,
+    13373,    13384,    13396,    13407,    13419,    13430,    13442,    13453,    13465,    13476,
+    13488,    13499,    13511,    13522,    13534,    13545,    13557,    13568,    13580,    13591,
+    13603,    13614,    13626,    13637,    13649,    13660,    13672,    13683,    13694,    13706,
+    13717,    13729,    13740,    13752,    13763,    13775,    13786,    13797,    13809,    13820,
+};
+#endif
+
+#ifdef TYPE_E_LUT
+const int16_t Thermocouple_Type_E::lut_offset = -270;
+const uint16_t Thermocouple_Type_E::lut_size = 1270;
+const int32_t Thermocouple_Type_E::lut[1270] = {
+    -9835,    -9833,    -9831,    -9828,    -9825,    -9821,    -9817,    -9813,    -9808,    -9802,
+    -9797,    -9790,    -9784,    -9777,    -9770,    -9762,    -9754,    -9746,    -9737,    -9728,
+    -9718,    -9709,    -9698,    -9688,    -9677,    -9666,    -9654,    -9642,    -9630,    -9617,
+    -9604,    -9591,    -9577,    -9563,    -9548,    -9534,    -9519,    -9503,    -9487,    -9471,
+    -9455,    -9438,    -9421,    -9404,    -9386,    -9368,    -9350,    -9331,    -9313,    -9293,
+    -9274,    -9254,    -9234,    -9214,    -9193,    -9172,    -9151,    -9129,    -9107,    -9085,
+    -9063,    -9040,    -9017,    -8994,    -8971,    -8947,    -8923,    -8899,    -8874,    -8850,
+    -8825,    -8799,    -8774,    -8748,    -8722,    -8696,    -8669,    -8643,    -8616,    -8588,
+    -8561,    -8533,    -8505,    -8477,    -8449,    -8420,    -8391,    -8362,    -8333,    -8303,
+    -8273,    -8243,    -8213,    -8183,    -8151,    -8121,    -8090,    -8058,    -8026,    -7995,
+    -7963,    -7931,    -7899,    -7866,    -7833,    -7800,    -7767,    -7733,    -7700,    -7666,
+    -7632,    -7597,    -7563,    -7528,    -7493,    -7458,    -7423,    -7387,    -7351,    -7315,
+    -7279,    -7243,    -7206,    -7170,    -7133,    -7096,    -7058,    -7021,    -6983,    -6945,
+    -6907,    -6869,    -6831,    -6792,    -6753,    -6714,    -6675,    -6636,    -6596,    -6556,
+    -6516,    -6476,    -6436,    -6396,    -6355,    -6314,    -6273,    -6232,    -6191,    -6149,
+    -6107,    -6065,    -6023,    -5981,    -5939,    -5896,    -5853,    -5810,    -5767,    -5724,
+    -5681,    -5637,    -5593,    -5549,    -5505,    -5461,    -5417,    -5372,    -5327,    -5282,
+    -5237,    -5192,    -5147,    -5101,    -5055,    -5009,    -4963,    -4917,    -4871,    -4824,
+    -4777,    -4731,    -4684,    -4636,    -4589,    -4542,    -4494,    -4446,    -4398,    -4350,
+    -4302,    -4254,    -4205,    -4156,    -4107,    -4058,    -4009,    -3960,    -3911,    -3861,
+    -3811,    -3761,    -3711,    -3661,    -3611,    -3561,    -3510,    -3459,    -3408,    -3357,
+    -3306,    -3255,    -3204,    -3152,    -3100,    -3048,    -2996,    -2944,    -2892,    -2840,
+    -2787,    -2735,    -2682,    -2629,    -2576,    -2523,    -2469,    -2416,    -2362,    -2309,
+    -2255,    -2201,    -2147,    -2093,    -2037,    -1984,    -1929,    -1874,    -1820,    -1765,
+    -1709,    -1654,    -1599,    -1543,    -1488,    -1432,    -1376,    -1320,    -1264,    -1208,
+    -1152,    -1095,    -1039,     -982,     -925,     -868,     -811,     -754,     -697,     -639,
+    -582,     -524,     -466,     -408,     -350,     -292,     -234,     -176,     -117,      -59,
+    59,      118,      176,      235,      294,      354,      413,      472,      532,      591,
+    651,      711,      770,      830,      890,      950,     1010,     1071,     1131,     1192,
+    1252,     1313,     1373,     1434,     1495,     1556,     1617,     1678,     1740,     1801,
+    1862,     1924,     1986,     2047,     2109,     2171,     2233,     2295,     2357,     2420,
+    2482,     2545,     2607,     2670,     2733,     2795,     2858,     2921,     2984,     3048,
+    3111,     3174,     3238,     3301,     3365,     3429,     3492,     3556,     3620,     3685,
+    3749,     3813,     3877,     3942,     4006,     4070,     4136,     4200,     4265,     4330,
+    4395,     4460,     4526,     4591,     4656,     4722,     4788,     4853,     4919,     4985,
+    5051,     5117,     5183,     5249,     5315,     5382,     5448,     5514,     5581,     5648,
+    5714,     5781,     5848,     5915,     5982,     6049,     6117,     6184,     6251,     6319,
+    6386,     6454,     6522,     6590,     6658,     6725,     6794,     6862,     6930,     6998,
+    7066,     7135,     7203,     7272,     7341,     7409,     7478,     7547,     7616,     7685,
+    7754,     7823,     7892,     7962,     8031,     8101,     8170,     8240,     8309,     8379,
+    8449,     8519,     8589,     8659,     8729,     8799,     8869,     8940,     9010,     9081,
+    9151,     9222,     9292,     9363,     9434,     9505,     9576,     9647,     9718,     9789,
+    9860,     9931,    10003,    10074,    10145,    10217,    10288,    10360,    10432,    10503,
+    10575,    10647,    10719,    10791,    10863,    10935,    11007,    11080,    11152,    11224,
+    11297,    11369,    11442,    11514,    11587,    11660,    11733,    11805,    11878,    11951,
+    12024,    12097,    12170,    12243,    12317,    12390,    12463,    12537,    12610,    12684,
+    12757,    12831,    12904,    12978,    13052,    13126,    13199,    13273,    13347,    13421,
+    13495,    13569,    13644,    13718,    13792,    13866,    13941,    14015,    14090,    14164,
+    14239,    14313,    14388,    14463,    14537,    14612,    14687,    14762,    14837,    14912,
+    14987,    15062,    15137,    15212,    15287,    15362,    15438,    15513,    15588,    15664,
+    15739,    15815,    15890,    15966,    16041,    16117,    16193,    16268,    16344,    16420,
+    16496,    16572,    16648,    16724,    16800,    16876,    16952,    17028,    17104,    17181,
+    17257,    17333,    17409,    17486,    17562,    17639,    17715,    17792,    17868,    17945,
+    18021,    18098,    18175,    18252,    18328,    18405,    18482,    18559,    18636,    18713,
+    18790,    18867,    18944,    19021,    19098,    19175,    19252,    19330,    19407,    19484,
+    19561,    19639,    19716,    19794,    19871,    19948,    20026,    20103,    20181,    20259,
+    20336,    20414,    20492,    20569,    20647,    20725,    20803,    20880,    20958,    21036,
+    21114,    21192,    21270,    21348,    21426,    21504,    21582,    21660,    21739,    21817,
+    21895,    21973,    22051,    22130,    22208,    22286,    22365,    22443,    22522,    22600,
+    22678,    22757,    22835,    22914,    22993,    23071,    23150,    23228,    23307,    23386,
+    23464,    23543,    23622,    23701,    23780,    23858,    23937,    24016,    24095,    24174,
+    24253,    24332,    24411,    24490,    24569,    24648,    24727,    24806,    24885,    24964,
+    25044,    25123,    25202,    25281,    25360,    25440,    25519,    25598,    25678,    25757,
+    25836,    25916,    25995,    26075,    26154,    26233,    26313,    26392,    26472,    26552,
+    26631,    26711,    26790,    26870,    26950,    27029,    27109,    27189,    27268,    27348,
+    27428,    27507,    27587,    27667,    27747,    27827,    27907,    27986,    28066,    28146,
+    28226,    28306,    28386,    28466,    28546,    28626,    28706,    28786,    28866,    28946,
+    29026,    29106,    29186,    29266,    29346,    29427,    29507,    29587,    29667,    29747,
+    29827,    29908,    29988,    30068,    30148,    30229,    30309,    30389,    30470,    30550,
+    30630,    30711,    30791,    30871,    30952,    31032,    31112,    31193,    31273,    31354,
+    31434,    31515,    31595,    31676,    31756,    31837,    31917,    31998,    32078,    32159,
+    32238,    32320,    32400,    32481,    32561,    32642,    32723,    32803,    32884,    32965,
+    33045,    33126,    33207,    33287,    33368,    33449,    33529,    33610,    33691,    33772,
+    33852,    33933,    34014,    34095,    34175,    34256,    34337,    34418,    34498,    34579,
+    34660,    34741,    34822,    34902,    34983,    35064,    35145,    35226,    35307,    35387,
+    35468,    35549,    35630,    35711,    35792,    35873,    35954,    36034,    36115,    36196,
+    36277,    36358,    36439,    36520,    36601,    36682,    36763,    36843,    36924,    37005,
+    37086,    37167,    37248,    37329,    37410,    37491,    37572,    37653,    37734,    37815,
+    37896,    37977,    38058,    38139,    38220,    38300,    38381,    38462,    38543,    38624,
+    38705,    38786,    38867,    38948,    39029,    39110,    39191,    39272,    39353,    39434,
+    39515,    39596,    39677,    39758,    39839,    39920,    40001,    40082,    40163,    40243,
+    40324,    40405,    40486,    40567,    40648,    40729,    40810,    40891,    40972,    41053,
+    41134,    41215,    41296,    41377,    41457,    41538,    41619,    41700,    41781,    41862,
+    41943,    42024,    42105,    42185,    42266,    42347,    42428,    42509,    42590,    42671,
+    42751,    42832,    42913,    42994,    43075,    43156,    43236,    43317,    43398,    43479,
+    43560,    43640,    43721,    43802,    43883,    43963,    44044,    44125,    44206,    44286,
+    44367,    44448,    44529,    44609,    44690,    44771,    44851,    44932,    45013,    45093,
+    45174,    45255,    45335,    45416,    45497,    45577,    45658,    45738,    45819,    45900,
+    45980,    46061,    46141,    46222,    46302,    46383,    46463,    46544,    46624,    46705,
+    46785,    46866,    46946,    47027,    47107,    47188,    47268,    47349,    47429,    47509,
+    47590,    47670,    47751,    47831,    47911,    47992,    48072,    48152,    48233,    48313,
+    48393,    48474,    48554,    48634,    48715,    48795,    48875,    48955,    49035,    49116,
+    49196,    49276,    49356,    49436,    49517,    49597,    49677,    49757,    49837,    49917,
+    49997,    50077,    50157,    50238,    50318,    50398,    50478,    50558,    50638,    50718,
+    50798,    50878,    50958,    51038,    51118,    51197,    51277,    51357,    51437,    51517,
+    51597,    51677,    51757,    51837,    51916,    51996,    52076,    52156,    52236,    52315,
+    52395,    52475,    52555,    52634,    52714,    52794,    52873,    52953,    53033,    53112,
+    53192,    53272,    53351,    53431,    53510,    53590,    53670,    53749,    53829,    53908,
+    53988,    54067,    54147,    54226,    54306,    54385,    54465,    54544,    54624,    54703,
+    54782,    54862,    54941,    55021,    55100,    55179,    55259,    55338,    55417,    55497,
+    55576,    55655,    55734,    55814,    55893,    55972,    56051,    56131,    56210,    56289,
+    56368,    56447,    56526,    56606,    56685,    56764,    56843,    56922,    57001,    57080,
+    57159,    57238,    57317,    57396,    57475,    57554,    57633,    57712,    57791,    57870,
+    57949,    58028,    58107,    58186,    58265,    58343,    58422,    58501,    58580,    58659,
+    58738,    58816,    58895,    58974,    59053,    59131,    59210,    59289,    59367,    59446,
+    59525,    59604,    59682,    59761,    59839,    59918,    59997,    60075,    60154,    60232,
+    60311,    60390,    60468,    60547,    60625,    60704,    60782,    60860,    60939,    61017,
+    61096,    61174,    61253,    61331,    61409,    61488,    61566,    61644,    61723,    61801,
+    61879,    61958,    62036,    62114,    62192,    62271,    62349,    62427,    62505,    62583,
+    62662,    62740,    62818,    62896,    62974,    63052,    63130,    63208,    63286,    63364,
+    63442,    63520,    63598,    63676,    63754,    63832,    63910,    63988,    64066,    64144,
+    64221,    64300,    64376,    64455,    64533,    64611,    64688,    64766,    64843,    64922,
+    65000,    65077,    65155,    65233,    65310,    65388,    65465,    65543,    65621,    65698,
+    65776,    65853,    65931,    66008,    66086,    66163,    66241,    66318,    66396,    66473,
+    66550,    66628,    66705,    66782,    66860,    66937,    67014,    67092,    67169,    67246,
+    67323,    67400,    67478,    67555,    67632,    67709,    67786,    67863,    67940,    68017,
+    68094,    68171,    68248,    68325,    68402,    68479,    68556,    68633,    68710,    68787,
+    68863,    68940,    69017,    69094,    69171,    69247,    69324,    69401,    69477,    69554,
+    69631,    69707,    69784,    69860,    69937,    70013,    70090,    70166,    70243,    70319,
+    70396,    70472,    70548,    70625,    70701,    70777,    70854,    70930,    71006,    71082,
+    71159,    71235,    71311,    71387,    71463,    71539,    71615,    71692,    71768,    71844,
+    71920,    71996,    72072,    72147,    72223,    72299,    72375,    72451,    72527,    72603,
+    72678,    72754,    72830,    72906,    72981,    73057,    73133,    73208,    73284,    73360,
+    73435,    73511,    73586,    73662,    73738,    73813,    73889,    73964,    74040,    74115,
+    74190,    74266,    74341,    74417,    74492,    74567,    74643,    74718,    74793,    74869,
+    74944,    75019,    75095,    75170,    75245,    75320,    75395,    75471,    75546,    75621,
+    75696,    75771,    75847,    75922,    75997,    76072,    76147,    76223,    76298,    76373,
+};
+#endif
+
+#ifdef TYPE_J_LUT
+const int16_t Thermocouple_Type_J::lut_offset = -210;
+const uint16_t Thermocouple_Type_J::lut_size = 1410;
+const int32_t Thermocouple_Type_J::lut[1410] = {
+    -8095,    -8076,    -8057,    -8037,    -8016,    -7996,    -7976,    -7955,    -7934,    -7912,
+    -7890,    -7868,    -7846,    -7824,    -7801,    -7778,    -7755,    -7731,    -7707,    -7683,
+    -7659,    -7634,    -7610,    -7585,    -7559,    -7534,    -7508,    -7482,    -7456,    -7429,
+    -7403,    -7376,    -7348,    -7321,    -7293,    -7265,    -7237,    -7209,    -7181,    -7152,
+    -7123,    -7094,    -7064,    -7035,    -7005,    -6975,    -6944,    -6914,    -6883,    -6853,
+    -6821,    -6790,    -6759,    -6727,    -6695,    -6663,    -6631,    -6598,    -6566,    -6533,
+    -6500,    -6467,    -6433,    -6400,    -6366,    -6332,    -6298,    -6263,    -6229,    -6194,
+    -6159,    -6124,    -6089,    -6054,    -6018,    -5982,    -5946,    -5910,    -5874,    -5838,
+    -5801,    -5764,    -5727,    -5690,    -5653,    -5616,    -5578,    -5541,    -5503,    -5465,
+    -5426,    -5388,    -5350,    -5311,    -5272,    -5233,    -5194,    -5155,    -5116,    -5076,
+    -5037,    -4997,    -4957,    -4917,    -4877,    -4836,    -4796,    -4755,    -4714,    -4674,
+    -4633,    -4591,    -4550,    -4509,    -4467,    -4425,    -4384,    -4342,    -4300,    -4257,
+    -4215,    -4173,    -4130,    -4088,    -4045,    -4002,    -3959,    -3916,    -3872,    -3829,
+    -3786,    -3742,    -3698,    -3654,    -3610,    -3566,    -3522,    -3478,    -3434,    -3389,
+    -3344,    -3300,    -3255,    -3210,    -3165,    -3120,    -3075,    -3029,    -2984,    -2938,
+    -2893,    -2847,    -2801,    -2755,    -2709,    -2663,    -2617,    -2571,    -2524,    -2478,
+    -2431,    -2385,    -2338,    -2291,    -2244,    -2197,    -2150,    -2103,    -2055,    -2008,
+    -1961,    -1913,    -1865,    -1818,    -1770,    -1722,    -1674,    -1626,    -1578,    -1530,
+    -1482,    -1433,    -1385,    -1336,    -1288,    -1239,    -1190,    -1142,    -1093,    -1044,
+    -995,     -946,     -896,     -847,     -798,     -749,     -699,     -650,     -600,     -550,
+    -501,     -451,     -401,     -351,     -301,     -251,     -201,     -151,     -101,      -50,
+    50,      101,      151,      202,      253,      303,      354,      405,      456,      507,
+    558,      609,      660,      711,      762,      814,      865,      916,      968,     1018,
+    1071,     1122,     1174,     1226,     1277,     1329,     1381,     1433,     1485,     1537,
+    1589,     1641,     1693,     1745,     1797,     1849,     1902,     1954,     2005,     2059,
+    2111,     2164,     2216,     2269,     2322,     2374,     2427,     2480,     2532,     2585,
+    2638,     2691,     2744,     2797,     2850,     2903,     2956,     3009,     3062,     3116,
+    3169,     3222,     3275,     3329,     3382,     3436,     3489,     3543,     3596,     3650,
+    3703,     3757,     3810,     3864,     3918,     3971,     4025,     4078,     4133,     4187,
+    4240,     4294,     4348,     4402,     4456,     4510,     4564,     4618,     4672,     4726,
+    4781,     4835,     4889,     4943,     4997,     5052,     5106,     5160,     5215,     5269,
+    5323,     5378,     5432,     5487,     5541,     5595,     5650,     5705,     5759,     5814,
+    5868,     5923,     5977,     6032,     6087,     6141,     6196,     6251,     6306,     6360,
+    6415,     6470,     6525,     6579,     6634,     6689,     6744,     6799,     6854,     6909,
+    6964,     7019,     7074,     7129,     7184,     7239,     7294,     7349,     7404,     7459,
+    7514,     7569,     7624,     7679,     7734,     7789,     7844,     7900,     7955,     8010,
+    8064,     8119,     8175,     8231,     8286,     8341,     8396,     8452,     8507,     8562,
+    8618,     8673,     8728,     8783,     8839,     8894,     8949,     9005,     9060,     9115,
+    9171,     9226,     9282,     9337,     9392,     9448,     9503,     9559,     9614,     9669,
+    9725,     9780,     9836,     9891,     9947,    10002,    10057,    10113,    10168,    10224,
+    10279,    10335,    10390,    10446,    10501,    10557,    10612,    10668,    10723,    10779,
+    10834,    10890,    10945,    11001,    11056,    11112,    11167,    11223,    11278,    11334,
+    11389,    11445,    11501,    11556,    11612,    11667,    11723,    11778,    11834,    11889,
+    11945,    12000,    12056,    12111,    12167,    12222,    12278,    12334,    12389,    12445,
+    12500,    12556,    12611,    12667,    12722,    12778,    12833,    12889,    12944,    13000,
+    13056,    13111,    13167,    13222,    13278,    13333,    13389,    13444,    13500,    13555,
+    13611,    13666,    13722,    13777,    13833,    13888,    13944,    13999,    14055,    14110,
+    14166,    14221,    14277,    14332,    14388,    14443,    14499,    14554,    14609,    14665,
+    14720,    14776,    14831,    14887,    14942,    14998,    15053,    15109,    15164,    15219,
+    15275,    15330,    15386,    15441,    15496,    15552,    15607,    15663,    15718,    15773,
+    15829,    15884,    15940,    15995,    16050,    16106,    16161,    16216,    16271,    16327,
+    16383,    16438,    16493,    16549,    16604,    16659,    16715,    16770,    16825,    16881,
+    16936,    16991,    17046,    17102,    17157,    17212,    17268,    17323,    17378,    17434,
+    17489,    17544,    17599,    17655,    17710,    17765,    17820,    17876,    17931,    17986,
+    18041,    18097,    18152,    18207,    18262,    18318,    18373,    18428,    18483,    18538,
+    18594,    18649,    18704,    18759,    18814,    18870,    18925,    18980,    19035,    19090,
+    19146,    19201,    19256,    19311,    19366,    19422,    19477,    19532,    19587,    19642,
+    19697,    19753,    19808,    19863,    19918,    19973,    20028,    20083,    20139,    20194,
+    20249,    20304,    20359,    20414,    20469,    20525,    20580,    20635,    20690,    20745,
+    20800,    20855,    20911,    20966,    21021,    21076,    21131,    21186,    21241,    21297,
+    21352,    21407,    21462,    21517,    21572,    21627,    21683,    21738,    21793,    21848,
+    21903,    21958,    22014,    22069,    22124,    22179,    22234,    22289,    22345,    22400,
+    22455,    22510,    22565,    22620,    22676,    22731,    22786,    22841,    22896,    22952,
+    23007,    23062,    23117,    23172,    23228,    23283,    23338,    23393,    23449,    23504,
+    23559,    23614,    23670,    23725,    23780,    23835,    23891,    23946,    24001,    24057,
+    24112,    24167,    24223,    24278,    24333,    24389,    24444,    24499,    24555,    24610,
+    24665,    24721,    24776,    24832,    24887,    24943,    24998,    25053,    25109,    25164,
+    25220,    25275,    25331,    25386,    25442,    25497,    25553,    25608,    25664,    25720,
+    25775,    25831,    25886,    25942,    25998,    26053,    26109,    26165,    26220,    26276,
+    26332,    26387,    26443,    26499,    26555,    26610,    26666,    26722,    26778,    26834,
+    26889,    26945,    27001,    27057,    27113,    27169,    27225,    27281,    27337,    27393,
+    27449,    27505,    27561,    27617,    27673,    27729,    27785,    27841,    27897,    27953,
+    28010,    28066,    28122,    28178,    28234,    28291,    28347,    28403,    28460,    28516,
+    28572,    28629,    28685,    28741,    28798,    28854,    28911,    28967,    29024,    29080,
+    29137,    29194,    29250,    29307,    29363,    29420,    29477,    29534,    29590,    29647,
+    29704,    29761,    29818,    29874,    29931,    29988,    30045,    30102,    30159,    30216,
+    30273,    30330,    30387,    30444,    30502,    30559,    30616,    30673,    30730,    30788,
+    30845,    30902,    30960,    31017,    31074,    31132,    31189,    31247,    31304,    31362,
+    31419,    31477,    31535,    31592,    31650,    31708,    31766,    31823,    31881,    31939,
+    31997,    32055,    32113,    32171,    32229,    32287,    32345,    32403,    32461,    32519,
+    32577,    32636,    32694,    32752,    32810,    32869,    32927,    32985,    33044,    33102,
+    33161,    33219,    33278,    33337,    33395,    33454,    33513,    33571,    33630,    33689,
+    33748,    33807,    33866,    33925,    33984,    34043,    34102,    34161,    34220,    34279,
+    34338,    34397,    34457,    34516,    34575,    34635,    34694,    34754,    34813,    34873,
+    34932,    34992,    35051,    35111,    35171,    35230,    35290,    35350,    35410,    35470,
+    35530,    35590,    35650,    35710,    35770,    35830,    35890,    35950,    36010,    36071,
+    36131,    36191,    36252,    36312,    36373,    36433,    36494,    36554,    36615,    36675,
+    36736,    36797,    36858,    36918,    36979,    37040,    37101,    37162,    37223,    37284,
+    37345,    37406,    37467,    37528,    37590,    37651,    37712,    37773,    37835,    37896,
+    37958,    38019,    38081,    38142,    38204,    38265,    38327,    38389,    38450,    38512,
+    38574,    38636,    38698,    38760,    38822,    38884,    38946,    39008,    39070,    39132,
+    39194,    39256,    39318,    39381,    39443,    39505,    39568,    39630,    39693,    39755,
+    39818,    39880,    39943,    40005,    40068,    40131,    40193,    40256,    40319,    40382,
+    40445,    40508,    40570,    40633,    40696,    40759,    40822,    40886,    40949,    41012,
+    41075,    41138,    41201,    41265,    41328,    41391,    41455,    41518,    41581,    41645,
+    41708,    41772,    41835,    41899,    41962,    42026,    42090,    42153,    42217,    42281,
+    42344,    42408,    42472,    42536,    42599,    42663,    42727,    42791,    42855,    42919,
+    42983,    43047,    43111,    43175,    43239,    43303,    43367,    43431,    43495,    43559,
+    43624,    43688,    43752,    43817,    43881,    43945,    44010,    44074,    44139,    44203,
+    44267,    44332,    44396,    44461,    44525,    44590,    44655,    44719,    44784,    44848,
+    44913,    44977,    45042,    45107,    45171,    45236,    45301,    45365,    45430,    45494,
+    45559,    45624,    45688,    45753,    45818,    45882,    45947,    46011,    46076,    46141,
+    46205,    46270,    46334,    46399,    46464,    46528,    46593,    46657,    46722,    46786,
+    46851,    46915,    46980,    47044,    47109,    47173,    47238,    47302,    47367,    47431,
+    47495,    47560,    47624,    47688,    47753,    47817,    47881,    47946,    48010,    48074,
+    48138,    48202,    48267,    48331,    48395,    48459,    48523,    48587,    48651,    48715,
+    48779,    48843,    48907,    48971,    49034,    49098,    49162,    49226,    49290,    49353,
+    49417,    49481,    49544,    49608,    49672,    49735,    49799,    49862,    49926,    49989,
+    50052,    50116,    50179,    50243,    50306,    50369,    50432,    50495,    50559,    50622,
+    50685,    50748,    50811,    50874,    50937,    51000,    51063,    51126,    51188,    51251,
+    51314,    51377,    51439,    51502,    51565,    51627,    51690,    51752,    51815,    51877,
+    51940,    52002,    52064,    52127,    52189,    52251,    52314,    52376,    52438,    52500,
+    52562,    52624,    52686,    52748,    52810,    52872,    52934,    52996,    53057,    53119,
+    53181,    53243,    53304,    53366,    53427,    53489,    53550,    53612,    53673,    53735,
+    53796,    53857,    53919,    53980,    54041,    54102,    54164,    54225,    54286,    54347,
+    54408,    54469,    54530,    54591,    54652,    54713,    54773,    54834,    54895,    54956,
+    55016,    55077,    55138,    55198,    55259,    55319,    55380,    55440,    55501,    55561,
+    55622,    55682,    55742,    55803,    55863,    55923,    55983,    56043,    56104,    56164,
+    56224,    56284,    56344,    56404,    56464,    56524,    56584,    56643,    56703,    56763,
+    56823,    56883,    56942,    57002,    57062,    57121,    57181,    57240,    57300,    57360,
+    57419,    57479,    57538,    57597,    57657,    57716,    57776,    57835,    57894,    57953,
+    58013,    58072,    58131,    58190,    58249,    58309,    58368,    58427,    58486,    58545,
+    58604,    58663,    58722,    58781,    58840,    58899,    58957,    59016,    59075,    59134,
+    59193,    59252,    59310,    59369,    59428,    59487,    59545,    59604,    59663,    59721,
+    59780,    59838,    59897,    59956,    60014,    60073,    60131,    60190,    60248,    60307,
+    60365,    60423,    60482,    60540,    60599,    60657,    60715,    60774,    60832,    60890,
+    60949,    61007,    61065,    61123,    61182,    61240,    61298,    61356,    61415,    61473,
+    61531,    61589,    61647,    61705,    61763,    61822,    61880,    61938,    61996,    62054,
+    62112,    62170,    62228,    62286,    62344,    62402,    62460,    62518,    62576,    62634,
+    62692,    62750,    62808,    62866,    62924,    62982,    63040,    63098,    63156,    63214,
+    63271,    63329,    63387,    63445,    63503,    63561,    63619,    63677,    63734,    63792,
+    63850,    63908,    63966,    64024,    64081,    64138,    64197,    64254,    64313,    64370,
+    64428,    64486,    64544,    64602,    64659,    64717,    64775,    64833,    64890,    64947,
+    65006,    65063,    65120,    65179,    65236,    65295,    65352,    65410,    65468,    65525,
+    65583,    65641,    65699,    65756,    65814,    65872,    65929,    65987,    66045,    66102,
+    66160,    66218,    66275,    66333,    66391,    66448,    66506,    66564,    66621,    66679,
+    66737,    66794,    66852,    66910,    66967,    67025,    67082,    67140,    67198,    67255,
+    67313,    67370,    67428,    67486,    67543,    67601,    67658,    67716,    67773,    67831,
+    67888,    67946,    68003,    68061,    68119,    68176,    68234,    68291,    68348,    68406,
+    68463,    68521,    68578,    68636,    68693,    68751,    68808,    68865,    68923,    68980,
+    69037,    69095,    69152,    69209,    69267,    69324,    69381,    69439,    69496,    69553,
+};
+#endif
+
+#ifdef TYPE_K_LUT
+const int16_t Thermocouple_Type_K::lut_offset = -270;
+const uint16_t Thermocouple_Type_K::lut_size = 1642;
+const int32_t Thermocouple_Type_K::lut[1642] = {
+    -6458,    -6457,    -6456,    -6455,    -6453,    -6452,    -6450,    -6448,    -6446,    -6444,
+    -6441,    -6438,    -6435,    -6432,    -6429,    -6425,    -6421,    -6417,    -6413,    -6408,
+    -6404,    -6399,    -6393,    -6388,    -6382,    -6377,    -6370,    -6364,    -6358,    -6351,
+    -6344,    -6337,    -6329,    -6322,    -6314,    -6306,    -6297,    -6289,    -6280,    -6271,
+    -6262,    -6252,    -6243,    -6233,    -6223,    -6213,    -6202,    -6192,    -6181,    -6170,
+    -6158,    -6147,    -6135,    -6123,    -6111,    -6099,    -6087,    -6074,    -6061,    -6048,
+    -6035,    -6021,    -6007,    -5994,    -5980,    -5965,    -5951,    -5936,    -5922,    -5907,
+    -5891,    -5876,    -5861,    -5845,    -5829,    -5813,    -5797,    -5780,    -5763,    -5747,
+    -5730,    -5713,    -5695,    -5678,    -5660,    -5642,    -5624,    -5606,    -5588,    -5569,
+    -5550,    -5531,    -5512,    -5493,    -5474,    -5454,    -5435,    -5415,    -5395,    -5374,
+    -5354,    -5333,    -5313,    -5292,    -5271,    -5250,    -5228,    -5207,    -5185,    -5163,
+    -5141,    -5119,    -5097,    -5074,    -5052,    -5029,    -5006,    -4983,    -4960,    -4936,
+    -4913,    -4889,    -4865,    -4841,    -4817,    -4793,    -4768,    -4744,    -4719,    -4694,
+    -4669,    -4644,    -4618,    -4593,    -4567,    -4542,    -4516,    -4490,    -4463,    -4437,
+    -4411,    -4384,    -4357,    -4330,    -4303,    -4276,    -4249,    -4221,    -4194,    -4166,
+    -4138,    -4110,    -4082,    -4054,    -4025,    -3997,    -3968,    -3939,    -3911,    -3882,
+    -3852,    -3823,    -3794,    -3764,    -3734,    -3705,    -3675,    -3645,    -3614,    -3584,
+    -3554,    -3523,    -3492,    -3462,    -3431,    -3400,    -3368,    -3337,    -3306,    -3274,
+    -3243,    -3211,    -3179,    -3147,    -3115,    -3083,    -3050,    -3018,    -2986,    -2953,
+    -2920,    -2887,    -2854,    -2821,    -2788,    -2755,    -2721,    -2688,    -2654,    -2620,
+    -2587,    -2553,    -2519,    -2485,    -2450,    -2416,    -2382,    -2347,    -2312,    -2278,
+    -2243,    -2208,    -2173,    -2138,    -2103,    -2067,    -2032,    -1996,    -1961,    -1925,
+    -1889,    -1854,    -1818,    -1782,    -1745,    -1709,    -1673,    -1637,    -1600,    -1564,
+    -1527,    -1490,    -1453,    -1417,    -1380,    -1343,    -1305,    -1268,    -1231,    -1194,
+    -1156,    -1119,    -1081,    -1043,    -1006,     -968,     -930,     -892,     -854,     -816,
+    -778,     -739,     -701,     -663,     -624,     -586,     -547,     -508,     -470,     -431,
+    -392,     -353,     -314,     -275,     -236,     -197,     -157,     -118,      -79,      -39,
+    39,       79,      119,      158,      198,      238,      277,      317,      357,      397,
+    437,      477,      517,      557,      597,      637,      677,      718,      758,      798,
+    838,      879,      919,      960,     1000,     1041,     1081,     1122,     1163,     1203,
+    1244,     1285,     1326,     1366,     1407,     1448,     1489,     1530,     1571,     1612,
+    1653,     1694,     1735,     1776,     1817,     1858,     1899,     1941,     1982,     2023,
+    2064,     2106,     2147,     2188,     2230,     2271,     2312,     2354,     2395,     2436,
+    2478,     2519,     2561,     2602,     2644,     2685,     2727,     2768,     2810,     2851,
+    2893,     2934,     2976,     3017,     3059,     3100,     3142,     3184,     3225,     3267,
+    3308,     3350,     3391,     3433,     3474,     3516,     3557,     3599,     3640,     3682,
+    3723,     3765,     3806,     3848,     3889,     3931,     3972,     4013,     4054,     4096,
+    4138,     4179,     4220,     4262,     4303,     4344,     4385,     4427,     4468,     4509,
+    4550,     4591,     4633,     4674,     4715,     4756,     4797,     4838,     4879,     4920,
+    4961,     5002,     5043,     5084,     5124,     5165,     5206,     5247,     5288,     5328,
+    5369,     5410,     5450,     5491,     5532,     5572,     5613,     5653,     5694,     5735,
+    5775,     5815,     5856,     5896,     5937,     5977,     6017,     6058,     6098,     6138,
+    6179,     6219,     6259,     6299,     6339,     6380,     6420,     6460,     6500,     6540,
+    6580,     6620,     6660,     6701,     6741,     6781,     6821,     6861,     6901,     6941,
+    6981,     7021,     7060,     7100,     7140,     7180,     7220,     7260,     7300,     7340,
+    7380,     7420,     7460,     7500,     7540,     7579,     7619,     7659,     7699,     7739,
+    7779,     7819,     7859,     7899,     7939,     7979,     8019,     8058,     8099,     8138,
+    8178,     8218,     8258,     8298,     8338,     8378,     8418,     8458,     8499,     8539,
+    8579,     8619,     8659,     8699,     8739,     8779,     8819,     8860,     8900,     8940,
+    8980,     9020,     9061,     9101,     9141,     9181,     9222,     9262,     9302,     9343,
+    9383,     9423,     9464,     9504,     9545,     9585,     9626,     9666,     9707,     9747,
+    9788,     9828,     9869,     9909,     9950,     9991,    10031,    10072,    10113,    10153,
+    10194,    10235,    10276,    10316,    10357,    10398,    10439,    10480,    10520,    10561,
+    10602,    10643,    10684,    10725,    10766,    10807,    10848,    10889,    10930,    10971,
+    11012,    11053,    11094,    11135,    11176,    11217,    11259,    11300,    11341,    11382,
+    11423,    11465,    11506,    11547,    11588,    11630,    11671,    11712,    11753,    11795,
+    11836,    11877,    11919,    11960,    12001,    12043,    12084,    12126,    12167,    12209,
+    12250,    12291,    12333,    12374,    12416,    12457,    12499,    12540,    12582,    12624,
+    12665,    12707,    12748,    12790,    12831,    12873,    12915,    12956,    12998,    13040,
+    13081,    13123,    13165,    13206,    13248,    13290,    13331,    13373,    13415,    13457,
+    13498,    13540,    13582,    13624,    13665,    13707,    13749,    13791,    13833,    13874,
+    13916,    13958,    14000,    14042,    14084,    14126,    14167,    14209,    14251,    14293,
+    14335,    14377,    14419,    14461,    14503,    14545,    14587,    14629,    14671,    14713,
+    14755,    14797,    14839,    14881,    14923,    14965,    15007,    15049,    15091,    15133,
+    15175,    15217,    15259,    15301,    15343,    15385,    15427,    15469,    15511,    15554,
+    15596,    15638,    15680,    15722,    15764,    15806,    15849,    15891,    15933,    15975,
+    16017,    16059,    16102,    16143,    16186,    16228,    16270,    16312,    16355,    16397,
+    16439,    16482,    16524,    16566,    16608,    16651,    16693,    16735,    16778,    16820,
+    16862,    16904,    16947,    16989,    17031,    17074,    17116,    17158,    17201,    17243,
+    17285,    17328,    17370,    17413,    17455,    17497,    17540,    17582,    17624,    17667,
+    17709,    17752,    17794,    17837,    17879,    17921,    17964,    18006,    18049,    18091,
+    18134,    18176,    18218,    18261,    18303,    18346,    18388,    18431,    18473,    18516,
+    18558,    18601,    18643,    18686,    18728,    18771,    18813,    18856,    18898,    18941,
+    18983,    19026,    19068,    19111,    19154,    19196,    19239,    19281,    19324,    19366,
+    19409,    19451,    19494,    19537,    19579,    19622,    19664,    19707,    19750,    19792,
+    19835,    19877,    19920,    19962,    20005,    20048,    20090,    20133,    20175,    20218,
+    20261,    20303,    20346,    20389,    20431,    20474,    20516,    20559,    20602,    20644,
+    20687,    20730,    20772,    20815,    20857,    20900,    20943,    20985,    21028,    21071,
+    21113,    21156,    21199,    21241,    21284,    21326,    21369,    21412,    21454,    21497,
+    21540,    21582,    21625,    21668,    21710,    21753,    21796,    21838,    21881,    21924,
+    21966,    22009,    22052,    22094,    22137,    22179,    22222,    22265,    22307,    22350,
+    22393,    22435,    22478,    22521,    22563,    22606,    22649,    22691,    22734,    22776,
+    22819,    22862,    22904,    22947,    22990,    23032,    23075,    23117,    23160,    23203,
+    23245,    23288,    23331,    23373,    23416,    23458,    23501,    23544,    23586,    23629,
+    23671,    23714,    23757,    23799,    23842,    23884,    23927,    23970,    24012,    24055,
+    24097,    24140,    24182,    24225,    24267,    24310,    24353,    24395,    24438,    24480,
+    24523,    24565,    24608,    24650,    24693,    24735,    24778,    24820,    24863,    24905,
+    24948,    24990,    25033,    25075,    25118,    25160,    25203,    25245,    25288,    25330,
+    25373,    25415,    25458,    25500,    25543,    25585,    25627,    25670,    25712,    25755,
+    25797,    25840,    25882,    25924,    25967,    26009,    26052,    26094,    26136,    26179,
+    26221,    26263,    26306,    26348,    26390,    26433,    26475,    26517,    26560,    26602,
+    26644,    26687,    26729,    26771,    26814,    26856,    26898,    26940,    26983,    27025,
+    27067,    27109,    27152,    27194,    27236,    27278,    27320,    27363,    27405,    27447,
+    27489,    27531,    27574,    27616,    27658,    27700,    27742,    27784,    27826,    27869,
+    27911,    27953,    27995,    28037,    28079,    28121,    28163,    28205,    28247,    28289,
+    28332,    28374,    28416,    28458,    28500,    28542,    28584,    28626,    28668,    28710,
+    28752,    28794,    28835,    28877,    28919,    28961,    29003,    29045,    29087,    29129,
+    29171,    29213,    29255,    29297,    29338,    29380,    29422,    29464,    29506,    29548,
+    29589,    29631,    29673,    29715,    29757,    29798,    29840,    29882,    29924,    29965,
+    30007,    30049,    30090,    30132,    30174,    30216,    30257,    30299,    30341,    30382,
+    30424,    30466,    30507,    30549,    30590,    30632,    30674,    30715,    30757,    30798,
+    30840,    30881,    30923,    30964,    31006,    31047,    31089,    31130,    31172,    31213,
+    31255,    31296,    31338,    31379,    31421,    31462,    31504,    31545,    31586,    31628,
+    31669,    31710,    31752,    31793,    31834,    31876,    31917,    31958,    32000,    32040,
+    32082,    32124,    32165,    32206,    32247,    32289,    32330,    32371,    32412,    32453,
+    32494,    32536,    32577,    32618,    32659,    32700,    32741,    32783,    32824,    32865,
+    32906,    32947,    32988,    33029,    33070,    33111,    33152,    33193,    33234,    33275,
+    33316,    33357,    33398,    33439,    33480,    33521,    33562,    33603,    33644,    33685,
+    33726,    33767,    33808,    33848,    33889,    33930,    33971,    34012,    34053,    34093,
+    34134,    34175,    34216,    34257,    34297,    34338,    34379,    34420,    34460,    34501,
+    34542,    34582,    34623,    34664,    34704,    34745,    34786,    34826,    34867,    34908,
+    34948,    34989,    35029,    35070,    35110,    35151,    35192,    35232,    35273,    35313,
+    35354,    35394,    35435,    35475,    35516,    35556,    35596,    35637,    35677,    35718,
+    35758,    35798,    35839,    35879,    35920,    35960,    36000,    36041,    36081,    36121,
+    36162,    36202,    36242,    36282,    36323,    36363,    36403,    36443,    36484,    36524,
+    36564,    36604,    36644,    36685,    36725,    36765,    36805,    36845,    36885,    36925,
+    36965,    37006,    37046,    37086,    37126,    37166,    37206,    37246,    37286,    37326,
+    37366,    37406,    37446,    37486,    37526,    37566,    37606,    37646,    37686,    37725,
+    37765,    37805,    37845,    37885,    37925,    37965,    38005,    38044,    38084,    38124,
+    38164,    38204,    38243,    38283,    38323,    38363,    38402,    38442,    38482,    38522,
+    38561,    38601,    38641,    38680,    38720,    38760,    38799,    38839,    38878,    38918,
+    38958,    38997,    39037,    39076,    39116,    39155,    39195,    39235,    39274,    39314,
+    39353,    39393,    39432,    39471,    39511,    39550,    39590,    39629,    39669,    39708,
+    39747,    39787,    39826,    39866,    39905,    39944,    39984,    40023,    40062,    40101,
+    40141,    40180,    40219,    40259,    40298,    40337,    40376,    40415,    40455,    40494,
+    40533,    40572,    40611,    40651,    40690,    40729,    40768,    40807,    40846,    40885,
+    40924,    40963,    41002,    41042,    41081,    41120,    41159,    41198,    41237,    41276,
+    41315,    41354,    41393,    41431,    41470,    41509,    41548,    41587,    41626,    41665,
+    41704,    41743,    41781,    41820,    41859,    41898,    41937,    41976,    42014,    42053,
+    42092,    42131,    42169,    42208,    42247,    42286,    42324,    42363,    42402,    42440,
+    42479,    42518,    42556,    42595,    42633,    42672,    42711,    42749,    42788,    42826,
+    42865,    42903,    42942,    42980,    43019,    43057,    43096,    43134,    43173,    43211,
+    43250,    43288,    43327,    43365,    43403,    43442,    43480,    43518,    43557,    43595,
+    43633,    43672,    43710,    43748,    43787,    43825,    43863,    43901,    43940,    43978,
+    44016,    44054,    44092,    44130,    44169,    44207,    44245,    44283,    44321,    44359,
+    44397,    44435,    44473,    44512,    44550,    44588,    44626,    44664,    44702,    44740,
+    44778,    44816,    44853,    44891,    44929,    44967,    45005,    45043,    45081,    45119,
+    45157,    45194,    45232,    45270,    45308,    45346,    45383,    45421,    45459,    45497,
+    45534,    45572,    45610,    45647,    45685,    45723,    45760,    45798,    45836,    45873,
+    45911,    45948,    45986,    46024,    46061,    46099,    46136,    46174,    46211,    46249,
+    46286,    46324,    46361,    46398,    46436,    46473,    46511,    46548,    46585,    46623,
+    46660,    46697,    46735,    46772,    46809,    46847,    46884,    46921,    46958,    46995,
+    47033,    47070,    47107,    47144,    47181,    47218,    47256,    47293,    47330,    47367,
+    47404,    47441,    47478,    47515,    47552,    47589,    47626,    47663,    47700,    47737,
+    47774,    47811,    47848,    47884,    47921,    47958,    47995,    48032,    48069,    48105,
+    48142,    48179,    48216,    48252,    48289,    48326,    48363,    48399,    48436,    48473,
+    48509,    48546,    48582,    48619,    48656,    48692,    48729,    48765,    48802,    48838,
+    48875,    48911,    48948,    48984,    49021,    49057,    49093,    49130,    49166,    49202,
+    49239,    49275,    49311,    49348,    49384,    49420,    49456,    49493,    49529,    49565,
+    49601,    49637,    49674,    49710,    49746,    49782,    49818,    49854,    49890,    49926,
+    49962,    49998,    50034,    50070,    50106,    50142,    50178,    50214,    50250,    50286,
+    50322,    50358,    50393,    50429,    50465,    50501,    50537,    50572,    50608,    50644,
+    50680,    50715,    50751,    50787,    50822,    50858,    50894,    50929,    50965,    51000,
+    51036,    51071,    51107,    51142,    51178,    51213,    51249,    51284,    51320,    51355,
+    51391,    51426,    51461,    51497,    51532,    51567,    51603,    51638,    51673,    51708,
+    51744,    51779,    51814,    51849,    51885,    51920,    51955,    51990,    52025,    52060,
+    52095,    52130,    52165,    52200,    52235,    52270,    52305,    52340,    52375,    52410,
+    52445,    52480,    52515,    52550,    52585,    52620,    52654,    52689,    52724,    52759,
+    52794,    52828,    52863,    52898,    52932,    52967,    53002,    53037,    53071,    53106,
+    53140,    53175,    53210,    53244,    53279,    53313,    53348,    53382,    53417,    53451,
+    53486,    53520,    53555,    53589,    53623,    53658,    53692,    53727,    53761,    53795,
+    53830,    53864,    53898,    53932,    53967,    54001,    54035,    54069,    54104,    54138,
+    54172,    54206,    54240,    54274,    54308,    54343,    54377,    54411,    54445,    54479,
+    54513,    54547,    54581,    54615,    54649,    54683,    54717,    54751,    54785,    54819,
+    54852,    54886,
+};
+#endif
+
+#ifdef TYPE_N_LUT
+const int16_t Thermocouple_Type_N::lut_offset = -270;
+const uint16_t Thermocouple_Type_N::lut_size = 1570;
+const int32_t Thermocouple_Type_N::lut[1570] = {
+    -4345,    -4345,    -4344,    -4344,    -4343,    -4342,    -4341,    -4340,    -4339,    -4337,
+    -4336,    -4334,    -4332,    -4330,    -4328,    -4326,    -4324,    -4321,    -4319,    -4316,
+    -4313,    -4310,    -4307,    -4304,    -4300,    -4297,    -4293,    -4289,    -4285,    -4281,
+    -4277,    -4273,    -4268,    -4263,    -4258,    -4254,    -4248,    -4243,    -4238,    -4232,
+    -4226,    -4221,    -4215,    -4209,    -4202,    -4196,    -4189,    -4183,    -4176,    -4169,
+    -4162,    -4154,    -4147,    -4140,    -4132,    -4124,    -4116,    -4108,    -4100,    -4091,
+    -4083,    -4074,    -4066,    -4057,    -4048,    -4038,    -4029,    -4019,    -4010,    -4000,
+    -3990,    -3980,    -3970,    -3960,    -3950,    -3939,    -3928,    -3918,    -3907,    -3896,
+    -3884,    -3873,    -3862,    -3850,    -3838,    -3827,    -3815,    -3803,    -3790,    -3778,
+    -3766,    -3753,    -3740,    -3728,    -3715,    -3702,    -3688,    -3675,    -3662,    -3648,
+    -3634,    -3621,    -3607,    -3593,    -3578,    -3564,    -3550,    -3535,    -3521,    -3506,
+    -3491,    -3476,    -3461,    -3446,    -3431,    -3415,    -3400,    -3384,    -3368,    -3352,
+    -3336,    -3320,    -3304,    -3288,    -3271,    -3255,    -3238,    -3221,    -3205,    -3188,
+    -3171,    -3153,    -3136,    -3119,    -3101,    -3084,    -3066,    -3048,    -3030,    -3012,
+    -2994,    -2976,    -2958,    -2939,    -2921,    -2902,    -2883,    -2865,    -2846,    -2827,
+    -2808,    -2789,    -2769,    -2750,    -2730,    -2711,    -2691,    -2672,    -2652,    -2632,
+    -2612,    -2592,    -2571,    -2551,    -2531,    -2510,    -2490,    -2469,    -2448,    -2428,
+    -2407,    -2386,    -2365,    -2344,    -2322,    -2301,    -2280,    -2258,    -2237,    -2215,
+    -2193,    -2172,    -2150,    -2128,    -2106,    -2084,    -2062,    -2039,    -2017,    -1995,
+    -1972,    -1950,    -1927,    -1905,    -1882,    -1859,    -1836,    -1813,    -1790,    -1767,
+    -1744,    -1721,    -1698,    -1674,    -1651,    -1627,    -1604,    -1580,    -1557,    -1533,
+    -1509,    -1485,    -1462,    -1438,    -1414,    -1390,    -1366,    -1341,    -1317,    -1293,
+    -1269,    -1244,    -1220,    -1195,    -1171,    -1146,    -1122,    -1097,    -1072,    -1048,
+    -1022,     -998,     -973,     -948,     -923,     -898,     -873,     -848,     -823,     -798,
+    -772,     -747,     -722,     -696,     -671,     -646,     -620,     -595,     -569,     -544,
+    -518,     -492,     -467,     -441,     -415,     -390,     -364,     -338,     -312,     -286,
+    -260,     -234,     -209,     -183,     -157,     -131,     -104,      -78,      -52,      -26,
+    26,       52,       78,      104,      130,      156,      182,      208,      235,      261,
+    287,      313,      340,      366,      393,      419,      446,      472,      499,      525,
+    552,      578,      605,      632,      659,      685,      712,      739,      766,      793,
+    820,      847,      874,      901,      928,      955,      983,     1010,     1037,     1065,
+    1092,     1119,     1147,     1174,     1202,     1229,     1257,     1284,     1312,     1340,
+    1368,     1395,     1423,     1451,     1479,     1507,     1535,     1563,     1591,     1619,
+    1647,     1675,     1703,     1732,     1760,     1788,     1817,     1845,     1873,     1902,
+    1930,     1959,     1988,     2016,     2045,     2074,     2102,     2131,     2160,     2189,
+    2218,     2247,     2276,     2305,     2334,     2363,     2392,     2421,     2450,     2480,
+    2509,     2538,     2568,     2597,     2626,     2656,     2685,     2715,     2744,     2774,
+    2804,     2833,     2863,     2893,     2923,     2953,     2983,     3012,     3042,     3072,
+    3102,     3133,     3163,     3193,     3223,     3253,     3283,     3314,     3344,     3374,
+    3405,     3435,     3466,     3496,     3527,     3557,     3588,     3619,     3649,     3680,
+    3711,     3742,     3772,     3803,     3834,     3865,     3896,     3927,     3958,     3989,
+    4019,     4051,     4083,     4114,     4145,     4176,     4208,     4239,     4270,     4302,
+    4333,     4365,     4396,     4428,     4459,     4491,     4523,     4554,     4586,     4618,
+    4650,     4681,     4713,     4745,     4777,     4809,     4841,     4873,     4905,     4937,
+    4969,     5001,     5033,     5066,     5098,     5130,     5162,     5195,     5227,     5259,
+    5292,     5324,     5357,     5389,     5422,     5454,     5487,     5520,     5552,     5585,
+    5618,     5650,     5683,     5716,     5749,     5782,     5815,     5847,     5880,     5913,
+    5946,     5979,     6013,     6046,     6079,     6112,     6145,     6178,     6211,     6245,
+    6278,     6311,     6345,     6378,     6411,     6445,     6478,     6512,     6545,     6579,
+    6612,     6646,     6680,     6713,     6747,     6781,     6814,     6848,     6882,     6916,
+    6949,     6983,     7017,     7051,     7085,     7119,     7153,     7187,     7221,     7255,
+    7289,     7323,     7357,     7392,     7426,     7460,     7494,     7528,     7563,     7597,
+    7631,     7666,     7700,     7734,     7769,     7803,     7838,     7872,     7907,     7941,
+    7976,     8010,     8045,     8080,     8114,     8148,     8183,     8218,     8253,     8288,
+    8323,     8358,     8392,     8427,     8462,     8497,     8532,     8567,     8602,     8637,
+    8672,     8707,     8742,     8777,     8812,     8847,     8882,     8918,     8953,     8988,
+    9023,     9058,     9094,     9129,     9164,     9200,     9235,     9270,     9306,     9341,
+    9377,     9412,     9448,     9483,     9519,     9554,     9590,     9625,     9661,     9696,
+    9732,     9768,     9803,     9839,     9875,     9910,     9946,     9982,    10018,    10054,
+    10089,    10125,    10161,    10197,    10233,    10269,    10305,    10341,    10377,    10413,
+    10449,    10485,    10521,    10557,    10593,    10629,    10665,    10701,    10737,    10774,
+    10810,    10846,    10882,    10918,    10955,    10991,    11027,    11064,    11100,    11136,
+    11173,    11209,    11245,    11282,    11318,    11355,    11391,    11428,    11464,    11501,
+    11537,    11574,    11610,    11647,    11683,    11720,    11757,    11793,    11830,    11867,
+    11903,    11940,    11977,    12013,    12050,    12087,    12124,    12160,    12197,    12234,
+    12271,    12308,    12345,    12382,    12418,    12455,    12492,    12529,    12566,    12603,
+    12640,    12677,    12714,    12751,    12788,    12825,    12862,    12899,    12937,    12974,
+    13011,    13048,    13085,    13122,    13159,    13197,    13234,    13271,    13308,    13346,
+    13383,    13420,    13457,    13495,    13532,    13569,    13607,    13644,    13682,    13719,
+    13756,    13794,    13831,    13869,    13906,    13944,    13981,    14019,    14056,    14094,
+    14131,    14169,    14206,    14244,    14281,    14319,    14356,    14394,    14432,    14469,
+    14507,    14545,    14582,    14620,    14658,    14695,    14733,    14771,    14809,    14846,
+    14884,    14922,    14960,    14998,    15035,    15073,    15111,    15149,    15187,    15225,
+    15262,    15300,    15338,    15376,    15414,    15452,    15490,    15528,    15566,    15604,
+    15642,    15680,    15718,    15756,    15794,    15832,    15870,    15908,    15946,    15984,
+    16021,    16059,    16099,    16137,    16175,    16213,    16251,    16289,    16327,    16366,
+    16404,    16442,    16480,    16518,    16557,    16595,    16633,    16671,    16710,    16748,
+    16786,    16824,    16863,    16901,    16939,    16978,    17016,    17054,    17093,    17131,
+    17169,    17208,    17246,    17285,    17323,    17361,    17400,    17438,    17477,    17515,
+    17554,    17592,    17630,    17669,    17707,    17746,    17784,    17823,    17861,    17900,
+    17938,    17977,    18016,    18054,    18093,    18131,    18170,    18208,    18247,    18286,
+    18324,    18363,    18401,    18440,    18479,    18517,    18556,    18595,    18633,    18672,
+    18711,    18749,    18788,    18827,    18865,    18904,    18943,    18982,    19020,    19059,
+    19098,    19136,    19175,    19214,    19253,    19292,    19330,    19369,    19408,    19447,
+    19485,    19524,    19563,    19602,    19641,    19680,    19718,    19757,    19796,    19835,
+    19874,    19913,    19952,    19990,    20029,    20068,    20107,    20146,    20185,    20224,
+    20263,    20302,    20341,    20379,    20418,    20457,    20496,    20535,    20574,    20613,
+    20652,    20691,    20730,    20769,    20808,    20847,    20886,    20925,    20964,    21003,
+    21042,    21081,    21120,    21159,    21198,    21237,    21276,    21315,    21354,    21393,
+    21432,    21471,    21510,    21549,    21588,    21628,    21667,    21706,    21745,    21784,
+    21823,    21862,    21901,    21940,    21979,    22018,    22058,    22097,    22136,    22175,
+    22214,    22253,    22292,    22331,    22370,    22410,    22449,    22488,    22527,    22566,
+    22605,    22644,    22684,    22723,    22762,    22801,    22840,    22879,    22919,    22958,
+    22997,    23036,    23075,    23115,    23154,    23193,    23232,    23271,    23311,    23350,
+    23389,    23428,    23467,    23507,    23546,    23585,    23624,    23663,    23703,    23742,
+    23781,    23820,    23860,    23899,    23938,    23977,    24016,    24056,    24095,    24134,
+    24173,    24213,    24252,    24291,    24330,    24370,    24409,    24448,    24487,    24527,
+    24566,    24605,    24644,    24684,    24723,    24762,    24801,    24841,    24880,    24919,
+    24959,    24998,    25037,    25076,    25116,    25155,    25194,    25233,    25273,    25312,
+    25351,    25391,    25430,    25469,    25508,    25548,    25587,    25626,    25666,    25705,
+    25744,    25783,    25823,    25862,    25901,    25941,    25980,    26019,    26058,    26098,
+    26137,    26176,    26216,    26255,    26294,    26333,    26373,    26412,    26451,    26491,
+    26530,    26569,    26608,    26648,    26687,    26726,    26766,    26805,    26844,    26883,
+    26923,    26962,    27001,    27041,    27080,    27119,    27158,    27198,    27237,    27276,
+    27316,    27355,    27394,    27433,    27473,    27512,    27551,    27591,    27630,    27669,
+    27708,    27748,    27787,    27826,    27866,    27905,    27944,    27983,    28023,    28062,
+    28101,    28140,    28180,    28219,    28258,    28297,    28337,    28376,    28415,    28455,
+    28494,    28533,    28572,    28612,    28651,    28690,    28729,    28769,    28808,    28847,
+    28886,    28926,    28965,    29004,    29043,    29083,    29122,    29161,    29200,    29239,
+    29279,    29318,    29357,    29396,    29436,    29475,    29514,    29553,    29592,    29632,
+    29671,    29710,    29749,    29789,    29828,    29867,    29906,    29945,    29985,    30024,
+    30063,    30102,    30141,    30181,    30220,    30259,    30298,    30337,    30376,    30416,
+    30455,    30494,    30533,    30572,    30611,    30651,    30690,    30729,    30768,    30807,
+    30846,    30886,    30925,    30964,    31003,    31042,    31081,    31120,    31160,    31199,
+    31238,    31277,    31316,    31355,    31394,    31433,    31473,    31512,    31551,    31590,
+    31629,    31668,    31707,    31746,    31785,    31824,    31863,    31903,    31942,    31981,
+    32020,    32058,    32098,    32137,    32176,    32215,    32253,    32293,    32332,    32371,
+    32409,    32448,    32488,    32527,    32566,    32604,    32644,    32683,    32722,    32761,
+    32800,    32839,    32878,    32917,    32956,    32995,    33034,    33073,    33112,    33151,
+    33190,    33229,    33268,    33307,    33346,    33385,    33424,    33463,    33502,    33541,
+    33580,    33619,    33658,    33697,    33736,    33774,    33813,    33852,    33891,    33930,
+    33969,    34008,    34047,    34086,    34124,    34163,    34202,    34241,    34280,    34319,
+    34358,    34396,    34435,    34474,    34513,    34552,    34591,    34629,    34668,    34707,
+    34746,    34785,    34823,    34862,    34901,    34940,    34979,    35017,    35056,    35095,
+    35134,    35172,    35211,    35250,    35289,    35327,    35366,    35405,    35444,    35482,
+    35521,    35560,    35598,    35637,    35676,    35714,    35753,    35792,    35831,    35869,
+    35908,    35946,    35985,    36024,    36062,    36101,    36140,    36178,    36217,    36256,
+    36294,    36333,    36371,    36410,    36449,    36487,    36526,    36564,    36603,    36641,
+    36680,    36718,    36757,    36796,    36834,    36873,    36911,    36950,    36988,    37027,
+    37065,    37104,    37142,    37181,    37219,    37258,    37296,    37334,    37373,    37411,
+    37450,    37488,    37527,    37565,    37603,    37642,    37680,    37719,    37757,    37795,
+    37834,    37872,    37911,    37949,    37987,    38026,    38064,    38102,    38141,    38179,
+    38217,    38256,    38294,    38332,    38370,    38409,    38447,    38485,    38524,    38562,
+    38600,    38638,    38677,    38715,    38753,    38791,    38829,    38868,    38906,    38944,
+    38982,    39020,    39059,    39097,    39135,    39173,    39211,    39249,    39287,    39326,
+    39364,    39402,    39440,    39478,    39516,    39554,    39592,    39630,    39668,    39706,
+    39744,    39783,    39821,    39859,    39897,    39935,    39973,    40011,    40049,    40087,
+    40125,    40163,    40201,    40238,    40276,    40314,    40352,    40390,    40428,    40466,
+    40504,    40542,    40580,    40618,    40655,    40693,    40731,    40769,    40807,    40845,
+    40883,    40920,    40958,    40996,    41034,    41072,    41109,    41147,    41185,    41223,
+    41260,    41298,    41336,    41374,    41411,    41449,    41487,    41525,    41562,    41600,
+    41638,    41675,    41713,    41751,    41788,    41826,    41864,    41901,    41939,    41976,
+    42014,    42052,    42089,    42127,    42164,    42202,    42239,    42277,    42314,    42352,
+    42390,    42427,    42465,    42502,    42540,    42577,    42614,    42652,    42689,    42727,
+    42764,    42802,    42839,    42877,    42914,    42951,    42989,    43026,    43064,    43101,
+    43138,    43176,    43213,    43250,    43288,    43325,    43362,    43399,    43437,    43474,
+    43511,    43549,    43586,    43623,    43660,    43698,    43735,    43772,    43809,    43846,
+    43884,    43921,    43958,    43995,    44032,    44069,    44106,    44144,    44181,    44218,
+    44255,    44292,    44329,    44366,    44403,    44440,    44477,    44514,    44551,    44588,
+    44625,    44662,    44699,    44736,    44773,    44810,    44847,    44884,    44921,    44958,
+    44995,    45032,    45069,    45105,    45142,    45179,    45216,    45253,    45290,    45326,
+    45363,    45400,    45437,    45474,    45510,    45547,    45584,    45621,    45657,    45694,
+    45731,    45767,    45804,    45841,    45877,    45914,    45951,    45987,    46024,    46060,
+    46097,    46133,    46170,    46207,    46243,    46280,    46316,    46353,    46389,    46425,
+    46462,    46498,    46535,    46571,    46608,    46644,    46680,    46717,    46753,    46789,
+    46826,    46862,    46898,    46935,    46971,    47007,    47043,    47079,    47116,    47152,
+    47188,    47224,    47260,    47296,    47333,    47369,    47405,    47441,    47477,    47513,
+};
+#endif
+
+#ifdef TYPE_R_LUT
+const int16_t Thermocouple_Type_R::lut_offset = -50;
+const uint16_t Thermocouple_Type_R::lut_size = 1818;
+const int32_t Thermocouple_Type_R::lut[1818] = {
+    -226,     -223,     -219,     -215,     -211,     -208,     -204,     -200,     -196,     -192,
+    -188,     -184,     -180,     -175,     -171,     -167,     -163,     -158,     -154,     -150,
+    -145,     -141,     -137,     -132,     -128,     -123,     -119,     -114,     -109,     -105,
+    -100,      -95,      -91,      -86,      -81,      -76,      -71,      -66,      -61,      -56,
+    -51,      -46,      -41,      -36,      -31,      -26,      -21,      -16,      -11,       -5,
+    5,       11,       16,       21,       27,       32,       38,       43,       49,       54,
+    60,       65,       71,       77,       82,       88,       94,      100,      105,      111,
+    117,      123,      129,      135,      141,      147,      153,      159,      165,      171,
+    177,      183,      189,      195,      201,      207,      214,      220,      226,      232,
+    239,      245,      251,      258,      264,      271,      277,      284,      290,      296,
+    303,      310,      316,      323,      329,      336,      343,      349,      356,      363,
+    369,      376,      383,      390,      397,      403,      410,      417,      424,      431,
+    438,      445,      452,      459,      466,      473,      480,      487,      494,      501,
+    508,      516,      523,      530,      537,      544,      552,      559,      566,      573,
+    581,      588,      595,      603,      610,      618,      625,      632,      640,      647,
+    655,      662,      670,      677,      685,      693,      700,      708,      715,      723,
+    731,      738,      746,      754,      761,      769,      777,      785,      792,      800,
+    808,      816,      824,      832,      839,      847,      855,      863,      871,      879,
+    887,      895,      903,      911,      919,      927,      935,      943,      951,      959,
+    967,      976,      984,      992,     1000,     1008,     1016,     1025,     1033,     1041,
+    1049,     1058,     1066,     1074,     1082,     1091,     1099,     1107,     1116,     1124,
+    1132,     1141,     1149,     1158,     1166,     1175,     1183,     1191,     1200,     1208,
+    1217,     1225,     1234,     1242,     1251,     1260,     1268,     1277,     1285,     1294,
+    1303,     1311,     1320,     1329,     1337,     1346,     1355,     1363,     1372,     1381,
+    1389,     1398,     1407,     1416,     1425,     1433,     1442,     1451,     1460,     1469,
+    1477,     1486,     1495,     1504,     1513,     1522,     1531,     1540,     1549,     1558,
+    1567,     1575,     1584,     1593,     1602,     1611,     1620,     1629,     1639,     1648,
+    1657,     1666,     1675,     1684,     1693,     1702,     1711,     1720,     1729,     1739,
+    1748,     1757,     1766,     1775,     1784,     1794,     1803,     1812,     1821,     1831,
+    1840,     1849,     1858,     1868,     1877,     1886,     1895,     1905,     1914,     1923,
+    1933,     1942,     1951,     1961,     1970,     1980,     1989,     1998,     2008,     2017,
+    2027,     2036,     2045,     2055,     2064,     2074,     2083,     2093,     2102,     2112,
+    2121,     2131,     2140,     2150,     2159,     2169,     2179,     2188,     2198,     2207,
+    2217,     2226,     2236,     2246,     2255,     2265,     2275,     2284,     2294,     2304,
+    2313,     2323,     2333,     2342,     2352,     2362,     2371,     2381,     2391,     2401,
+    2410,     2420,     2430,     2440,     2449,     2459,     2469,     2479,     2488,     2498,
+    2508,     2518,     2528,     2538,     2547,     2557,     2567,     2577,     2587,     2597,
+    2607,     2617,     2626,     2636,     2646,     2656,     2666,     2676,     2686,     2696,
+    2706,     2716,     2726,     2736,     2746,     2756,     2766,     2776,     2786,     2796,
+    2806,     2816,     2826,     2836,     2846,     2856,     2866,     2876,     2886,     2896,
+    2906,     2916,     2926,     2937,     2947,     2957,     2967,     2977,     2987,     2997,
+    3007,     3018,     3028,     3038,     3048,     3058,     3068,     3079,     3089,     3099,
+    3109,     3119,     3130,     3140,     3150,     3160,     3171,     3181,     3191,     3201,
+    3212,     3222,     3232,     3242,     3253,     3263,     3273,     3284,     3294,     3304,
+    3315,     3325,     3335,     3346,     3356,     3366,     3377,     3387,     3397,     3408,
+    3418,     3428,     3439,     3449,     3460,     3470,     3480,     3491,     3501,     3512,
+    3522,     3533,     3543,     3553,     3564,     3574,     3585,     3595,     3606,     3616,
+    3627,     3637,     3648,     3658,     3669,     3679,     3690,     3700,     3711,     3721,
+    3732,     3742,     3753,     3764,     3774,     3785,     3795,     3806,     3816,     3827,
+    3838,     3848,     3859,     3869,     3880,     3891,     3901,     3912,     3922,     3933,
+    3944,     3954,     3965,     3976,     3986,     3997,     4008,     4018,     4029,     4040,
+    4050,     4061,     4072,     4083,     4093,     4104,     4115,     4125,     4136,     4147,
+    4158,     4168,     4179,     4190,     4201,     4211,     4222,     4233,     4244,     4255,
+    4265,     4276,     4287,     4298,     4309,     4319,     4330,     4341,     4352,     4363,
+    4373,     4384,     4395,     4406,     4417,     4428,     4439,     4449,     4460,     4471,
+    4482,     4493,     4504,     4515,     4526,     4537,     4548,     4558,     4569,     4580,
+    4591,     4602,     4613,     4624,     4635,     4646,     4657,     4668,     4679,     4690,
+    4701,     4712,     4723,     4734,     4745,     4756,     4767,     4778,     4789,     4800,
+    4811,     4822,     4833,     4844,     4855,     4866,     4877,     4888,     4899,     4910,
+    4922,     4933,     4944,     4955,     4966,     4977,     4988,     4999,     5010,     5021,
+    5033,     5044,     5055,     5066,     5077,     5088,     5099,     5111,     5122,     5133,
+    5144,     5155,     5166,     5178,     5189,     5200,     5211,     5222,     5234,     5245,
+    5256,     5267,     5279,     5290,     5301,     5312,     5323,     5335,     5346,     5357,
+    5369,     5380,     5391,     5402,     5414,     5425,     5436,     5448,     5459,     5470,
+    5481,     5493,     5504,     5515,     5527,     5538,     5549,     5561,     5572,     5583,
+    5595,     5606,     5618,     5629,     5640,     5652,     5663,     5674,     5686,     5697,
+    5709,     5720,     5731,     5743,     5754,     5766,     5777,     5789,     5800,     5812,
+    5823,     5834,     5846,     5857,     5869,     5880,     5892,     5903,     5915,     5926,
+    5938,     5949,     5961,     5972,     5984,     5995,     6007,     6018,     6030,     6041,
+    6053,     6065,     6076,     6088,     6099,     6111,     6122,     6134,     6146,     6157,
+    6169,     6180,     6192,     6204,     6215,     6227,     6238,     6250,     6262,     6273,
+    6285,     6297,     6308,     6320,     6332,     6343,     6355,     6367,     6378,     6390,
+    6402,     6413,     6425,     6437,     6448,     6460,     6472,     6484,     6495,     6507,
+    6519,     6531,     6542,     6554,     6566,     6578,     6589,     6601,     6613,     6625,
+    6636,     6648,     6660,     6672,     6684,     6695,     6707,     6719,     6731,     6743,
+    6755,     6766,     6778,     6790,     6802,     6814,     6826,     6838,     6849,     6861,
+    6873,     6885,     6897,     6909,     6921,     6933,     6945,     6956,     6968,     6980,
+    6992,     7004,     7016,     7028,     7040,     7052,     7064,     7076,     7088,     7100,
+    7112,     7124,     7136,     7148,     7160,     7172,     7184,     7196,     7208,     7220,
+    7232,     7244,     7256,     7268,     7280,     7292,     7304,     7316,     7328,     7340,
+    7352,     7364,     7376,     7389,     7401,     7413,     7425,     7437,     7449,     7461,
+    7473,     7485,     7498,     7510,     7522,     7534,     7546,     7558,     7570,     7583,
+    7595,     7607,     7619,     7631,     7644,     7656,     7668,     7680,     7692,     7705,
+    7717,     7729,     7741,     7753,     7766,     7778,     7790,     7802,     7815,     7827,
+    7839,     7851,     7864,     7876,     7888,     7901,     7913,     7925,     7938,     7950,
+    7962,     7974,     7987,     7999,     8010,     8023,     8036,     8048,     8061,     8073,
+    8086,     8098,     8109,     8122,     8135,     8147,     8160,     8172,     8185,     8197,
+    8209,     8222,     8234,     8247,     8259,     8272,     8284,     8296,     8309,     8321,
+    8334,     8346,     8359,     8371,     8384,     8396,     8409,     8421,     8434,     8446,
+    8459,     8471,     8484,     8496,     8509,     8521,     8534,     8546,     8559,     8571,
+    8584,     8597,     8609,     8622,     8634,     8647,     8659,     8672,     8685,     8697,
+    8710,     8722,     8735,     8748,     8760,     8773,     8785,     8798,     8811,     8823,
+    8836,     8849,     8861,     8874,     8887,     8899,     8912,     8925,     8937,     8950,
+    8963,     8975,     8988,     9001,     9014,     9026,     9039,     9052,     9065,     9077,
+    9090,     9103,     9115,     9128,     9141,     9154,     9167,     9179,     9192,     9205,
+    9218,     9230,     9243,     9256,     9269,     9282,     9294,     9307,     9320,     9333,
+    9346,     9359,     9371,     9384,     9397,     9410,     9423,     9436,     9449,     9461,
+    9474,     9487,     9500,     9513,     9526,     9539,     9552,     9565,     9578,     9590,
+    9603,     9616,     9629,     9642,     9655,     9668,     9681,     9694,     9707,     9720,
+    9733,     9746,     9759,     9772,     9785,     9798,     9811,     9824,     9837,     9850,
+    9863,     9876,     9889,     9902,     9915,     9928,     9941,     9954,     9967,     9980,
+    9993,    10006,    10019,    10032,    10046,    10059,    10072,    10085,    10098,    10111,
+    10124,    10137,    10150,    10163,    10177,    10190,    10203,    10216,    10229,    10242,
+    10255,    10268,    10282,    10295,    10308,    10321,    10334,    10347,    10361,    10374,
+    10387,    10400,    10413,    10427,    10440,    10453,    10466,    10480,    10493,    10506,
+    10519,    10532,    10546,    10559,    10572,    10585,    10599,    10612,    10625,    10638,
+    10652,    10665,    10678,    10692,    10705,    10718,    10731,    10745,    10758,    10771,
+    10785,    10798,    10811,    10825,    10838,    10851,    10865,    10878,    10891,    10905,
+    10918,    10932,    10945,    10958,    10972,    10985,    10998,    11012,    11025,    11039,
+    11052,    11065,    11079,    11092,    11106,    11119,    11132,    11146,    11159,    11173,
+    11186,    11200,    11213,    11227,    11240,    11253,    11267,    11280,    11294,    11307,
+    11321,    11334,    11348,    11361,    11375,    11388,    11402,    11415,    11429,    11442,
+    11456,    11469,    11483,    11496,    11510,    11524,    11537,    11551,    11564,    11578,
+    11591,    11605,    11618,    11632,    11646,    11659,    11673,    11686,    11700,    11714,
+    11727,    11741,    11754,    11768,    11782,    11795,    11809,    11822,    11836,    11850,
+    11863,    11877,    11891,    11904,    11918,    11931,    11945,    11959,    11972,    11986,
+    12000,    12013,    12027,    12041,    12054,    12068,    12082,    12096,    12109,    12123,
+    12137,    12150,    12164,    12178,    12191,    12205,    12219,    12233,    12246,    12260,
+    12274,    12288,    12301,    12315,    12329,    12342,    12356,    12370,    12384,    12397,
+    12411,    12425,    12439,    12453,    12466,    12480,    12494,    12508,    12521,    12535,
+    12549,    12563,    12577,    12590,    12604,    12618,    12632,    12646,    12659,    12673,
+    12687,    12701,    12715,    12729,    12742,    12756,    12770,    12784,    12798,    12812,
+    12825,    12839,    12853,    12867,    12881,    12895,    12909,    12922,    12936,    12950,
+    12964,    12978,    12992,    13006,    13019,    13033,    13047,    13061,    13075,    13089,
+    13103,    13117,    13131,    13145,    13158,    13172,    13186,    13200,    13214,    13228,
+    13242,    13256,    13270,    13284,    13298,    13311,    13325,    13339,    13353,    13367,
+    13381,    13395,    13409,    13423,    13437,    13451,    13465,    13479,    13493,    13507,
+    13521,    13535,    13549,    13563,    13577,    13590,    13604,    13618,    13632,    13646,
+    13660,    13674,    13688,    13702,    13716,    13730,    13744,    13758,    13772,    13786,
+    13800,    13814,    13828,    13842,    13856,    13870,    13884,    13898,    13912,    13926,
+    13940,    13954,    13968,    13982,    13996,    14010,    14024,    14038,    14052,    14066,
+    14081,    14095,    14109,    14123,    14137,    14151,    14165,    14179,    14193,    14207,
+    14221,    14235,    14249,    14263,    14277,    14291,    14305,    14319,    14333,    14347,
+    14361,    14375,    14390,    14404,    14418,    14432,    14446,    14460,    14474,    14488,
+    14502,    14516,    14530,    14544,    14558,    14572,    14586,    14601,    14615,    14629,
+    14643,    14657,    14671,    14685,    14699,    14713,    14727,    14741,    14755,    14770,
+    14784,    14798,    14812,    14826,    14840,    14854,    14868,    14882,    14896,    14911,
+    14925,    14939,    14953,    14967,    14981,    14995,    15009,    15023,    15037,    15052,
+    15066,    15080,    15094,    15108,    15122,    15136,    15150,    15164,    15179,    15193,
+    15207,    15221,    15235,    15249,    15263,    15277,    15291,    15306,    15320,    15334,
+    15348,    15362,    15376,    15390,    15404,    15419,    15433,    15447,    15461,    15475,
+    15489,    15503,    15517,    15531,    15546,    15560,    15574,    15588,    15602,    15616,
+    15630,    15645,    15659,    15673,    15687,    15701,    15715,    15729,    15743,    15758,
+    15772,    15786,    15800,    15814,    15828,    15842,    15856,    15871,    15885,    15899,
+    15913,    15927,    15941,    15955,    15969,    15984,    15998,    16012,    16026,    16040,
+    16053,    16068,    16082,    16097,    16111,    16125,    16139,    16152,    16167,    16181,
+    16196,    16210,    16224,    16238,    16251,    16265,    16280,    16294,    16309,    16323,
+    16337,    16351,    16364,    16379,    16393,    16407,    16422,    16436,    16450,    16464,
+    16478,    16492,    16506,    16520,    16534,    16549,    16563,    16577,    16591,    16605,
+    16619,    16633,    16647,    16662,    16676,    16690,    16704,    16718,    16732,    16746,
+    16760,    16774,    16789,    16803,    16817,    16831,    16845,    16859,    16873,    16887,
+    16901,    16915,    16930,    16944,    16958,    16972,    16986,    17000,    17014,    17028,
+    17042,    17056,    17071,    17085,    17099,    17113,    17127,    17141,    17155,    17169,
+    17183,    17197,    17211,    17225,    17240,    17254,    17268,    17282,    17296,    17310,
+    17324,    17338,    17352,    17366,    17380,    17394,    17408,    17423,    17437,    17451,
+    17465,    17479,    17493,    17507,    17521,    17535,    17549,    17563,    17577,    17591,
+    17605,    17619,    17633,    17647,    17661,    17676,    17690,    17704,    17718,    17732,
+    17746,    17760,    17774,    17788,    17802,    17816,    17830,    17844,    17858,    17872,
+    17886,    17900,    17914,    17928,    17942,    17956,    17970,    17984,    17998,    18012,
+    18026,    18040,    18054,    18068,    18082,    18096,    18110,    18124,    18138,    18152,
+    18166,    18180,    18194,    18208,    18222,    18236,    18250,    18264,    18278,    18292,
+    18306,    18320,    18334,    18348,    18362,    18376,    18390,    18404,    18417,    18431,
+    18445,    18459,    18473,    18487,    18501,    18515,    18529,    18543,    18557,    18571,
+    18585,    18599,    18613,    18627,    18640,    18654,    18668,    18682,    18696,    18710,
+    18724,    18738,    18752,    18766,    18779,    18793,    18807,    18821,    18835,    18849,
+    18863,    18877,    18891,    18904,    18918,    18932,    18946,    18960,    18974,    18988,
+    19002,    19015,    19029,    19043,    19057,    19071,    19085,    19098,    19112,    19126,
+    19140,    19154,    19168,    19181,    19195,    19209,    19223,    19237,    19250,    19264,
+    19278,    19292,    19306,    19319,    19333,    19347,    19361,    19375,    19388,    19402,
+    19416,    19430,    19444,    19457,    19471,    19485,    19499,    19512,    19526,    19540,
+    19554,    19567,    19581,    19595,    19609,    19622,    19636,    19650,    19663,    19677,
+    19691,    19705,    19718,    19732,    19746,    19759,    19773,    19787,    19800,    19814,
+    19828,    19841,    19855,    19869,    19882,    19896,    19910,    19923,    19937,    19951,
+    19964,    19978,    19992,    20005,    20019,    20032,    20046,    20060,    20073,    20087,
+    20100,    20114,    20127,    20141,    20154,    20168,    20181,    20195,    20208,    20222,
+    20235,    20249,    20262,    20275,    20289,    20302,    20316,    20329,    20342,    20356,
+    20369,    20382,    20396,    20409,    20422,    20436,    20449,    20462,    20475,    20488,
+    20502,    20515,    20528,    20541,    20554,    20567,    20581,    20594,    20607,    20620,
+    20633,    20646,    20659,    20672,    20685,    20698,    20711,    20724,    20736,    20749,
+    20762,    20775,    20788,    20801,    20813,    20826,    20839,    20852,    20864,    20877,
+    20890,    20902,    20915,    20928,    20940,    20953,    20965,    20978,    20990,    21003,
+    21015,    21027,    21040,    21052,    21065,    21077,    21089,    21101,
+};
+#endif
+
+#ifdef TYPE_S_LUT
+const int16_t Thermocouple_Type_S::lut_offset = -50;
+const uint16_t Thermocouple_Type_S::lut_size = 1818;
+const int32_t Thermocouple_Type_S::lut[1818] = {
+    -236,     -232,     -228,     -224,     -219,     -215,     -211,     -207,     -203,     -199,
+    -194,     -190,     -186,     -181,     -177,     -173,     -168,     -164,     -159,     -155,
+    -150,     -146,     -141,     -136,     -132,     -127,     -122,     -117,     -113,     -108,
+    -103,      -98,      -93,      -88,      -83,      -78,      -73,      -68,      -63,      -58,
+    -53,      -48,      -42,      -37,      -32,      -27,      -21,      -16,      -11,       -5,
+    5,       11,       16,       22,       27,       33,       38,       44,       50,       55,
+    61,       67,       72,       78,       84,       90,       95,      101,      107,      113,
+    119,      125,      131,      137,      143,      149,      155,      161,      167,      173,
+    179,      185,      191,      197,      204,      210,      216,      222,      229,      235,
+    241,      248,      254,      260,      267,      273,      280,      286,      292,      299,
+    305,      312,      319,      325,      332,      338,      345,      352,      358,      365,
+    372,      378,      385,      392,      399,      405,      412,      419,      426,      433,
+    440,      446,      453,      460,      467,      474,      481,      488,      495,      502,
+    509,      516,      523,      530,      538,      545,      552,      559,      566,      573,
+    580,      588,      595,      602,      609,      617,      624,      631,      639,      646,
+    653,      661,      668,      675,      683,      690,      698,      705,      713,      720,
+    727,      735,      743,      750,      758,      765,      773,      780,      788,      795,
+    803,      811,      818,      826,      834,      841,      849,      857,      865,      872,
+    880,      888,      896,      903,      911,      919,      927,      935,      942,      950,
+    958,      966,      974,      982,      990,      998,     1006,     1012,     1020,     1029,
+    1037,     1045,     1053,     1061,     1069,     1077,     1085,     1094,     1102,     1110,
+    1118,     1126,     1134,     1142,     1150,     1158,     1167,     1175,     1183,     1191,
+    1199,     1207,     1216,     1224,     1232,     1240,     1249,     1257,     1265,     1273,
+    1282,     1290,     1298,     1307,     1315,     1323,     1332,     1340,     1348,     1357,
+    1365,     1373,     1382,     1390,     1399,     1407,     1415,     1424,     1432,     1441,
+    1449,     1458,     1466,     1475,     1483,     1492,     1500,     1509,     1517,     1526,
+    1534,     1543,     1551,     1560,     1569,     1577,     1586,     1594,     1603,     1612,
+    1620,     1629,     1638,     1646,     1655,     1663,     1672,     1681,     1690,     1698,
+    1707,     1716,     1724,     1733,     1742,     1751,     1759,     1768,     1777,     1786,
+    1794,     1803,     1812,     1821,     1829,     1838,     1847,     1856,     1865,     1874,
+    1882,     1891,     1900,     1909,     1918,     1927,     1936,     1944,     1953,     1962,
+    1971,     1980,     1989,     1998,     2007,     2016,     2025,     2033,     2043,     2052,
+    2061,     2070,     2078,     2087,     2096,     2105,     2114,     2123,     2132,     2141,
+    2151,     2160,     2169,     2178,     2187,     2196,     2205,     2214,     2223,     2232,
+    2241,     2250,     2259,     2268,     2277,     2287,     2296,     2305,     2314,     2323,
+    2332,     2341,     2350,     2360,     2369,     2378,     2387,     2396,     2405,     2415,
+    2424,     2433,     2442,     2451,     2461,     2470,     2479,     2488,     2497,     2507,
+    2516,     2525,     2534,     2544,     2553,     2562,     2571,     2581,     2590,     2599,
+    2609,     2618,     2627,     2636,     2646,     2655,     2664,     2674,     2683,     2692,
+    2702,     2711,     2720,     2730,     2739,     2748,     2758,     2767,     2776,     2786,
+    2795,     2805,     2814,     2823,     2833,     2842,     2851,     2861,     2870,     2880,
+    2889,     2899,     2908,     2917,     2927,     2936,     2946,     2955,     2965,     2974,
+    2983,     2993,     3002,     3012,     3021,     3031,     3040,     3050,     3059,     3069,
+    3078,     3088,     3097,     3107,     3116,     3126,     3135,     3145,     3154,     3164,
+    3173,     3183,     3192,     3202,     3212,     3221,     3231,     3240,     3250,     3259,
+    3269,     3279,     3288,     3298,     3307,     3317,     3326,     3336,     3346,     3355,
+    3365,     3374,     3384,     3394,     3403,     3413,     3423,     3432,     3442,     3451,
+    3461,     3471,     3480,     3490,     3500,     3509,     3519,     3529,     3538,     3548,
+    3558,     3567,     3577,     3587,     3596,     3606,     3616,     3626,     3635,     3645,
+    3655,     3664,     3674,     3684,     3694,     3703,     3713,     3723,     3732,     3742,
+    3752,     3762,     3771,     3781,     3791,     3801,     3810,     3820,     3830,     3840,
+    3850,     3859,     3869,     3879,     3889,     3898,     3908,     3918,     3928,     3938,
+    3947,     3957,     3967,     3977,     3987,     3997,     4006,     4016,     4026,     4035,
+    4046,     4056,     4065,     4075,     4085,     4094,     4105,     4115,     4125,     4134,
+    4144,     4154,     4164,     4174,     4184,     4194,     4204,     4213,     4223,     4233,
+    4243,     4253,     4263,     4273,     4283,     4293,     4303,     4313,     4323,     4332,
+    4342,     4352,     4362,     4372,     4382,     4392,     4402,     4412,     4422,     4432,
+    4442,     4452,     4462,     4472,     4482,     4492,     4502,     4512,     4522,     4532,
+    4542,     4552,     4562,     4572,     4582,     4592,     4602,     4612,     4622,     4632,
+    4642,     4652,     4662,     4672,     4682,     4692,     4702,     4712,     4722,     4732,
+    4742,     4752,     4762,     4772,     4782,     4793,     4803,     4813,     4823,     4833,
+    4843,     4853,     4863,     4873,     4883,     4893,     4904,     4914,     4924,     4934,
+    4944,     4954,     4964,     4974,     4984,     4995,     5005,     5015,     5025,     5035,
+    5045,     5055,     5066,     5076,     5086,     5096,     5106,     5116,     5127,     5137,
+    5147,     5157,     5167,     5178,     5188,     5198,     5208,     5218,     5228,     5239,
+    5249,     5259,     5269,     5280,     5290,     5300,     5310,     5320,     5331,     5341,
+    5351,     5361,     5372,     5382,     5392,     5402,     5413,     5423,     5433,     5443,
+    5454,     5464,     5474,     5485,     5495,     5505,     5515,     5526,     5536,     5546,
+    5557,     5567,     5577,     5588,     5598,     5608,     5618,     5629,     5639,     5649,
+    5660,     5670,     5680,     5691,     5701,     5712,     5722,     5732,     5743,     5753,
+    5763,     5774,     5784,     5794,     5805,     5815,     5826,     5836,     5846,     5857,
+    5867,     5878,     5888,     5898,     5909,     5919,     5930,     5940,     5950,     5961,
+    5971,     5982,     5992,     6003,     6013,     6024,     6034,     6044,     6055,     6065,
+    6076,     6086,     6097,     6107,     6118,     6128,     6139,     6149,     6160,     6170,
+    6181,     6191,     6202,     6212,     6223,     6233,     6244,     6254,     6265,     6275,
+    6286,     6296,     6307,     6317,     6328,     6338,     6349,     6360,     6370,     6381,
+    6391,     6402,     6412,     6423,     6434,     6444,     6455,     6465,     6476,     6486,
+    6497,     6508,     6518,     6529,     6539,     6550,     6561,     6571,     6582,     6593,
+    6603,     6614,     6624,     6635,     6646,     6656,     6667,     6678,     6688,     6699,
+    6710,     6720,     6731,     6742,     6752,     6763,     6774,     6784,     6795,     6806,
+    6817,     6827,     6838,     6849,     6859,     6870,     6881,     6892,     6902,     6913,
+    6924,     6934,     6945,     6956,     6967,     6977,     6988,     6999,     7010,     7020,
+    7031,     7042,     7053,     7064,     7074,     7085,     7096,     7107,     7117,     7128,
+    7139,     7150,     7161,     7172,     7182,     7193,     7204,     7215,     7226,     7236,
+    7247,     7258,     7269,     7280,     7291,     7302,     7312,     7323,     7334,     7345,
+    7356,     7367,     7378,     7388,     7399,     7410,     7421,     7432,     7443,     7454,
+    7465,     7476,     7487,     7497,     7508,     7519,     7530,     7541,     7552,     7563,
+    7574,     7585,     7596,     7607,     7618,     7629,     7640,     7651,     7662,     7673,
+    7684,     7695,     7706,     7717,     7728,     7739,     7750,     7761,     7772,     7783,
+    7794,     7805,     7816,     7827,     7838,     7849,     7860,     7871,     7882,     7893,
+    7904,     7915,     7926,     7937,     7948,     7959,     7970,     7981,     7992,     8003,
+    8013,     8026,     8037,     8048,     8058,     8070,     8080,     8092,     8103,     8114,
+    8125,     8137,     8148,     8159,     8170,     8180,     8192,     8203,     8214,     8226,
+    8237,     8248,     8259,     8270,     8281,     8293,     8304,     8315,     8326,     8337,
+    8348,     8360,     8371,     8382,     8393,     8404,     8416,     8427,     8438,     8449,
+    8460,     8472,     8483,     8494,     8505,     8517,     8528,     8539,     8550,     8562,
+    8573,     8584,     8595,     8607,     8618,     8629,     8640,     8652,     8663,     8674,
+    8685,     8697,     8708,     8719,     8731,     8742,     8753,     8765,     8776,     8787,
+    8798,     8810,     8821,     8832,     8844,     8855,     8866,     8878,     8889,     8900,
+    8912,     8923,     8935,     8946,     8957,     8969,     8980,     8991,     9003,     9014,
+    9025,     9037,     9048,     9060,     9071,     9082,     9094,     9105,     9117,     9128,
+    9139,     9151,     9162,     9174,     9185,     9197,     9208,     9219,     9231,     9242,
+    9254,     9265,     9277,     9288,     9300,     9311,     9323,     9334,     9345,     9357,
+    9368,     9380,     9391,     9403,     9414,     9426,     9437,     9449,     9460,     9472,
+    9483,     9495,     9506,     9518,     9529,     9541,     9552,     9564,     9576,     9587,
+    9599,     9610,     9622,     9633,     9645,     9656,     9668,     9680,     9691,     9703,
+    9714,     9726,     9737,     9749,     9761,     9772,     9784,     9795,     9807,     9819,
+    9830,     9842,     9853,     9865,     9877,     9888,     9900,     9911,     9923,     9935,
+    9946,     9958,     9970,     9981,     9993,    10005,    10016,    10028,    10040,    10051,
+    10063,    10075,    10086,    10098,    10110,    10121,    10133,    10145,    10156,    10168,
+    10180,    10191,    10203,    10215,    10227,    10238,    10250,    10262,    10273,    10285,
+    10297,    10309,    10320,    10332,    10344,    10356,    10367,    10379,    10391,    10403,
+    10414,    10426,    10438,    10450,    10461,    10473,    10485,    10497,    10509,    10520,
+    10532,    10544,    10556,    10567,    10579,    10591,    10603,    10615,    10626,    10638,
+    10650,    10662,    10674,    10686,    10697,    10709,    10721,    10733,    10745,    10757,
+    10768,    10780,    10792,    10804,    10816,    10828,    10839,    10851,    10863,    10875,
+    10887,    10899,    10911,    10922,    10934,    10946,    10958,    10970,    10982,    10994,
+    11006,    11017,    11029,    11041,    11053,    11065,    11077,    11089,    11101,    11113,
+    11125,    11136,    11148,    11160,    11172,    11184,    11196,    11208,    11220,    11232,
+    11244,    11256,    11268,    11280,    11291,    11303,    11315,    11327,    11339,    11351,
+    11363,    11375,    11387,    11399,    11411,    11423,    11435,    11447,    11459,    11471,
+    11483,    11495,    11507,    11519,    11531,    11542,    11554,    11566,    11578,    11590,
+    11602,    11614,    11626,    11638,    11650,    11662,    11674,    11686,    11698,    11710,
+    11722,    11734,    11746,    11758,    11770,    11782,    11794,    11806,    11818,    11830,
+    11842,    11854,    11866,    11878,    11890,    11902,    11914,    11926,    11939,    11951,
+    11963,    11975,    11987,    11999,    12011,    12023,    12035,    12047,    12059,    12071,
+    12083,    12095,    12107,    12119,    12131,    12143,    12155,    12167,    12179,    12191,
+    12203,    12216,    12228,    12240,    12252,    12264,    12276,    12288,    12300,    12312,
+    12324,    12336,    12348,    12360,    12372,    12384,    12397,    12409,    12421,    12433,
+    12445,    12457,    12469,    12481,    12493,    12505,    12517,    12529,    12542,    12554,
+    12566,    12578,    12590,    12602,    12614,    12626,    12638,    12650,    12662,    12675,
+    12687,    12699,    12711,    12723,    12735,    12747,    12759,    12771,    12783,    12796,
+    12808,    12820,    12832,    12844,    12856,    12868,    12880,    12892,    12905,    12917,
+    12929,    12941,    12953,    12965,    12977,    12989,    13001,    13014,    13026,    13038,
+    13050,    13062,    13074,    13086,    13098,    13111,    13123,    13135,    13147,    13159,
+    13171,    13183,    13195,    13208,    13220,    13232,    13244,    13256,    13268,    13280,
+    13292,    13305,    13317,    13329,    13341,    13353,    13365,    13377,    13390,    13402,
+    13414,    13426,    13438,    13450,    13462,    13474,    13487,    13499,    13511,    13523,
+    13535,    13547,    13559,    13572,    13584,    13596,    13608,    13620,    13632,    13644,
+    13657,    13669,    13681,    13693,    13705,    13717,    13729,    13742,    13754,    13766,
+    13778,    13790,    13802,    13814,    13826,    13839,    13851,    13863,    13875,    13887,
+    13899,    13911,    13924,    13936,    13948,    13960,    13972,    13984,    13996,    14009,
+    14021,    14033,    14045,    14057,    14069,    14081,    14094,    14106,    14118,    14130,
+    14142,    14154,    14166,    14178,    14191,    14203,    14215,    14227,    14239,    14251,
+    14263,    14276,    14288,    14300,    14312,    14324,    14336,    14348,    14360,    14373,
+    14385,    14397,    14409,    14421,    14433,    14445,    14457,    14470,    14482,    14494,
+    14506,    14518,    14530,    14542,    14554,    14567,    14579,    14591,    14603,    14615,
+    14627,    14639,    14651,    14664,    14676,    14688,    14700,    14712,    14724,    14736,
+    14748,    14760,    14773,    14785,    14797,    14809,    14821,    14833,    14845,    14857,
+    14869,    14881,    14894,    14906,    14918,    14930,    14942,    14954,    14966,    14978,
+    14990,    15002,    15015,    15027,    15039,    15051,    15063,    15075,    15087,    15099,
+    15111,    15123,    15135,    15148,    15160,    15172,    15184,    15196,    15208,    15220,
+    15232,    15244,    15256,    15268,    15280,    15292,    15304,    15317,    15329,    15341,
+    15353,    15365,    15377,    15389,    15401,    15413,    15425,    15437,    15449,    15461,
+    15473,    15485,    15497,    15509,    15521,    15534,    15546,    15558,    15570,    15582,
+    15594,    15606,    15618,    15630,    15642,    15654,    15666,    15678,    15690,    15702,
+    15714,    15726,    15738,    15750,    15762,    15774,    15786,    15798,    15810,    15822,
+    15834,    15846,    15858,    15870,    15882,    15894,    15906,    15918,    15930,    15942,
+    15954,    15966,    15978,    15990,    16001,    16014,    16026,    16038,    16050,    16062,
+    16074,    16085,    16097,    16110,    16122,    16134,    16146,    16158,    16170,    16181,
+    16193,    16204,    16216,    16229,    16241,    16253,    16265,    16277,    16289,    16300,
+    16312,    16325,    16337,    16349,    16361,    16373,    16385,    16396,    16408,    16420,
+    16432,    16444,    16456,    16468,    16480,    16492,    16504,    16516,    16527,    16539,
+    16551,    16563,    16575,    16587,    16599,    16611,    16623,    16634,    16646,    16658,
+    16670,    16682,    16694,    16706,    16718,    16729,    16741,    16753,    16765,    16777,
+    16789,    16801,    16812,    16824,    16836,    16848,    16860,    16872,    16883,    16895,
+    16907,    16919,    16931,    16943,    16954,    16966,    16978,    16990,    17002,    17013,
+    17025,    17037,    17049,    17061,    17072,    17084,    17096,    17108,    17120,    17131,
+    17143,    17155,    17167,    17178,    17190,    17202,    17214,    17225,    17237,    17249,
+    17261,    17272,    17284,    17296,    17308,    17319,    17331,    17343,    17355,    17366,
+    17378,    17390,    17401,    17413,    17425,    17437,    17448,    17460,    17472,    17483,
+    17495,    17507,    17518,    17530,    17542,    17553,    17565,    17577,    17588,    17600,
+    17612,    17623,    17635,    17647,    17658,    17670,    17682,    17693,    17705,    17717,
+    17728,    17740,    17751,    17763,    17775,    17786,    17798,    17809,    17821,    17832,
+    17844,    17855,    17867,    17878,    17890,    17901,    17913,    17924,    17936,    17947,
+    17959,    17970,    17982,    17993,    18004,    18016,    18027,    18039,    18050,    18061,
+    18073,    18084,    18095,    18107,    18118,    18129,    18140,    18152,    18163,    18174,
+    18185,    18196,    18208,    18219,    18230,    18241,    18252,    18263,    18274,    18285,
+    18297,    18308,    18319,    18330,    18341,    18352,    18362,    18373,    18384,    18395,
+    18406,    18417,    18428,    18439,    18449,    18460,    18471,    18482,    18493,    18503,
+    18514,    18525,    18535,    18546,    18557,    18567,    18578,    18588,    18599,    18609,
+    18620,    18630,    18641,    18651,    18661,    18672,    18682,    18693,
+};
+#endif
+
+#ifdef TYPE_T_LUT
+const int16_t Thermocouple_Type_T::lut_offset = -270;
+const uint16_t Thermocouple_Type_T::lut_size = 670;
+const int32_t Thermocouple_Type_T::lut[670] = {
+    -6258,    -6256,    -6255,    -6253,    -6251,    -6248,    -6245,    -6242,    -6239,    -6236,
+    -6232,    -6228,    -6223,    -6219,    -6214,    -6209,    -6204,    -6198,    -6193,    -6187,
+    -6180,    -6174,    -6167,    -6160,    -6153,    -6146,    -6138,    -6130,    -6122,    -6114,
+    -6105,    -6096,    -6087,    -6078,    -6068,    -6059,    -6049,    -6038,    -6028,    -6017,
+    -6007,    -5996,    -5985,    -5973,    -5962,    -5950,    -5938,    -5926,    -5914,    -5901,
+    -5888,    -5876,    -5863,    -5850,    -5836,    -5823,    -5809,    -5795,    -5782,    -5767,
+    -5753,    -5739,    -5724,    -5710,    -5695,    -5680,    -5665,    -5650,    -5634,    -5619,
+    -5603,    -5587,    -5571,    -5555,    -5539,    -5523,    -5506,    -5489,    -5473,    -5456,
+    -5439,    -5421,    -5404,    -5387,    -5369,    -5351,    -5334,    -5316,    -5297,    -5279,
+    -5261,    -5242,    -5224,    -5205,    -5186,    -5167,    -5148,    -5128,    -5109,    -5089,
+    -5070,    -5050,    -5030,    -5010,    -4989,    -4969,    -4949,    -4928,    -4907,    -4886,
+    -4865,    -4844,    -4823,    -4802,    -4780,    -4759,    -4737,    -4715,    -4693,    -4671,
+    -4648,    -4626,    -4604,    -4581,    -4558,    -4535,    -4512,    -4489,    -4466,    -4443,
+    -4419,    -4395,    -4372,    -4348,    -4324,    -4300,    -4275,    -4251,    -4226,    -4202,
+    -4177,    -4152,    -4127,    -4102,    -4077,    -4051,    -4026,    -4000,    -3975,    -3949,
+    -3923,    -3897,    -3871,    -3844,    -3818,    -3791,    -3765,    -3738,    -3711,    -3684,
+    -3657,    -3629,    -3602,    -3574,    -3547,    -3519,    -3491,    -3463,    -3435,    -3407,
+    -3379,    -3350,    -3322,    -3293,    -3264,    -3235,    -3206,    -3177,    -3148,    -3118,
+    -3089,    -3059,    -3030,    -3000,    -2970,    -2940,    -2910,    -2879,    -2849,    -2818,
+    -2788,    -2757,    -2726,    -2695,    -2664,    -2633,    -2602,    -2571,    -2539,    -2507,
+    -2476,    -2444,    -2412,    -2380,    -2348,    -2316,    -2283,    -2251,    -2218,    -2186,
+    -2153,    -2120,    -2087,    -2054,    -2021,    -1987,    -1954,    -1920,    -1887,    -1853,
+    -1819,    -1785,    -1751,    -1717,    -1683,    -1648,    -1614,    -1579,    -1545,    -1510,
+    -1475,    -1440,    -1405,    -1370,    -1335,    -1299,    -1264,    -1228,    -1192,    -1157,
+    -1121,    -1085,    -1049,    -1012,     -976,     -940,     -904,     -867,     -830,     -794,
+    -757,     -720,     -683,     -646,     -608,     -571,     -534,     -496,     -459,     -421,
+    -383,     -345,     -307,     -269,     -231,     -193,     -154,     -116,      -77,      -39,
+    39,       78,      117,      156,      195,      234,      273,      312,      352,      391,
+    431,      470,      510,      549,      589,      629,      669,      709,      749,      790,
+    830,      870,      911,      951,      992,     1033,     1074,     1114,     1155,     1196,
+    1238,     1279,     1320,     1362,     1403,     1445,     1486,     1528,     1570,     1612,
+    1654,     1696,     1738,     1780,     1823,     1865,     1908,     1950,     1993,     2036,
+    2079,     2122,     2165,     2208,     2251,     2294,     2338,     2381,     2425,     2468,
+    2512,     2556,     2600,     2643,     2687,     2732,     2776,     2820,     2864,     2909,
+    2953,     2998,     3043,     3087,     3132,     3177,     3222,     3267,     3312,     3358,
+    3403,     3448,     3494,     3539,     3585,     3631,     3677,     3722,     3768,     3814,
+    3860,     3907,     3953,     3999,     4046,     4091,     4138,     4185,     4232,     4279,
+    4325,     4372,     4419,     4466,     4513,     4561,     4608,     4655,     4702,     4750,
+    4798,     4845,     4893,     4941,     4988,     5036,     5084,     5132,     5180,     5228,
+    5277,     5325,     5373,     5422,     5470,     5519,     5567,     5616,     5665,     5714,
+    5763,     5812,     5861,     5910,     5959,     6008,     6057,     6107,     6156,     6206,
+    6255,     6305,     6355,     6404,     6454,     6504,     6554,     6604,     6654,     6704,
+    6754,     6805,     6855,     6905,     6956,     7006,     7057,     7107,     7158,     7209,
+    7260,     7310,     7361,     7412,     7463,     7515,     7566,     7617,     7668,     7720,
+    7771,     7823,     7874,     7926,     7977,     8029,     8080,     8132,     8185,     8237,
+    8289,     8341,     8393,     8445,     8497,     8550,     8602,     8654,     8707,     8759,
+    8812,     8865,     8917,     8970,     9023,     9076,     9129,     9182,     9235,     9288,
+    9341,     9395,     9448,     9501,     9555,     9608,     9662,     9715,     9769,     9822,
+    9876,     9930,     9984,    10038,    10092,    10146,    10200,    10254,    10308,    10362,
+    10417,    10471,    10525,    10580,    10634,    10689,    10743,    10798,    10853,    10907,
+    10962,    11017,    11072,    11127,    11182,    11237,    11292,    11347,    11403,    11458,
+    11513,    11569,    11624,    11680,    11735,    11791,    11846,    11902,    11958,    12013,
+    12069,    12125,    12181,    12237,    12293,    12349,    12405,    12461,    12518,    12574,
+    12630,    12687,    12743,    12799,    12856,    12912,    12969,    13026,    13082,    13139,
+    13196,    13253,    13310,    13366,    13423,    13480,    13537,    13595,    13652,    13709,
+    13766,    13823,    13881,    13938,    13995,    14053,    14110,    14168,    14226,    14283,
+    14341,    14399,    14456,    14514,    14572,    14630,    14688,    14746,    14804,    14862,
+    14920,    14978,    15036,    15095,    15153,    15211,    15270,    15328,    15386,    15445,
+    15503,    15562,    15621,    15679,    15738,    15797,    15856,    15914,    15973,    16032,
+    16091,    16149,    16209,    16268,    16327,    16387,    16446,    16505,    16564,    16624,
+    16683,    16742,    16802,    16861,    16921,    16980,    17040,    17100,    17159,    17219,
+    17279,    17339,    17399,    17458,    17518,    17578,    17638,    17698,    17759,    17819,
+    17879,    17939,    17999,    18060,    18120,    18180,    18241,    18301,    18362,    18422,
+    18483,    18543,    18604,    18665,    18725,    18786,    18847,    18908,    18969,    19030,
+    19091,    19152,    19213,    19274,    19335,    19396,    19457,    19518,    19579,    19641,
+    19702,    19763,    19825,    19886,    19947,    20009,    20070,    20132,    20193,    20255,
+    20317,    20378,    20440,    20502,    20563,    20625,    20687,    20748,    20810,    20872,
+};
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/Thermocouple_lut_core_cpp.txt	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,1 @@
+#include "thermocouple.h"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/lut_script.py	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,300 @@
+def isFloat(string):
+    try:
+        float(string)
+        return True
+    except ValueError:
+        return False
+
+with open("thermocouple.cpp","w") as out:
+    with open("Thermocouple_core_cpp.txt","r") as inp:
+        out.write(inp.read())
+        out.write("\n\n\n")
+        pass
+
+with open("thermocouple.h","w") as out:
+    with open("Thermocouple_core_h.txt", "r") as inp:
+        out.write(inp.read())
+        out.write("\n\n\n")
+    pass
+
+with open("thermocouple_lut.cpp","w") as out:
+    with open("Thermocouple_lut_core_cpp.txt","r") as inp:
+        out.write(inp.read())
+        out.write("\n\n\n")
+        pass
+
+with open('tc.txt', 'r') as myfile:
+    initstr=myfile.read().replace('\n', ' ')
+
+
+#print(initstr.split());
+splitted = initstr.split();
+
+while splitted:
+    i=0
+
+    for word in splitted:
+        if(word == 'type'):
+            break
+        i=i+1
+    del splitted[:i+1]
+    if not splitted:
+        break
+    tctype = splitted[0][0].lower()
+
+    class_name = "Thermocouple_Type_" + tctype.capitalize()
+    lut_def_name = "TYPE_" + tctype.capitalize() + "_LUT"
+    print(lut_def_name)
+
+    i=0
+    state=0
+    lut = []
+    for word in splitted:
+        if(word=="************************************"):
+            break
+        if(word=="mV"):
+            state = 1
+            continue
+        if(state == 1 and isFloat(word)):
+            lut.append(word)
+        else:
+            state=0
+        i=i+1
+    print(lut)
+    del splitted[:i]
+    i=0
+
+    globaloffset = lut[0]
+
+    if(float(lut[0]) == float(lut[2])-10):
+        del lut[:3]
+    else:
+        del lut[0]
+
+    j=0
+    print lut
+    lutfloat=[]
+    for val in lut:
+        b=1
+        if(i%11==0):
+            #print "11 " + val
+            b=0
+        if(i%12==0):
+            #print "12 "+ val
+            i=0
+            b=0
+        i=i+1
+        j=j+1
+        if(b):
+            lutfloat.append(float(val))
+
+
+    #print "unsorted"
+    #print lutfloat
+    lutfloat.sort()
+    #print "sorted"
+    #print lutfloat
+    i=0
+    with open("thermocouple_lut.cpp", "a") as out:
+        out.write("#ifdef "+lut_def_name+"\n")
+        out.write("const int16_t " + class_name + "::lut_offset = " + str(globaloffset)+";\n")
+        out.write("const uint16_t " + class_name + "::lut_size = " + str(len(lutfloat))+";\n")
+        out.write("const int32_t "+class_name+"::lut["+str(len(lutfloat))+"] = {\n")
+        for val in lutfloat:
+            out.write(str(int(val*1000)).rjust(8)+ ", ")
+            i=i+1
+            if(i==10):
+                out.write("\n")
+                i=0
+        out.write("};\n")
+        out.write("#endif\n\n")
+    i=0
+
+    ranger = []
+    values = []
+    exp=[]
+    ranger_index = -1 #HACK HACK HACK
+
+    while(splitted[0] != '************************************'):
+        for word in splitted:
+            if(word=='range:'):
+                ranger.append([])
+                values.append([])
+                ranger_index=ranger_index+1
+                break
+            if(word=='exponential:'):
+                exp.append(splitted[i+3])
+                exp.append(splitted[i+6])
+                exp.append(splitted[i+9])
+                i=i+10
+                print exp
+                break
+            i=i+1
+        if(word=='exponential:'):
+            print("exponential")
+            del splitted[:i + 1]
+            i=0
+            break
+        del splitted[:i+1]
+        print splitted
+        i=0
+
+        ranger[ranger_index].append(splitted[0])
+        ranger[ranger_index].append(splitted[1])
+        nr_of_coef = int(splitted[2])+1
+        del splitted[:3]
+        for i in range(nr_of_coef):
+            values[ranger_index].append(splitted[i])
+        del splitted[:nr_of_coef]
+        print ranger
+        print values
+        i=0
+
+    with open("Thermocouple.h", "a") as out:
+        poly_size = str(len(ranger))
+
+        out.write("class " + class_name + " : public Thermocouple\n{")
+        out.write("\npublic:\n\t~" + class_name +"();")
+        out.write("\n\tstatic const thermocouple_poly_subrange inv_poly[" + poly_size + "];\n")
+        out.write("\tstatic const int inv_poly_size;\n\tfloat convert_inv(float temp);\n\n")
+
+    with open("Thermocouple.cpp", "a") as out:
+
+        out.write("const int " + class_name + "::inv_poly_size = " + str(len(ranger)) + ";\n")
+        out.write("const Thermocouple::thermocouple_poly_subrange " + class_name + "::inv_poly[" + poly_size + "] =\n{\n")
+        for ran in ranger:
+            poly = []
+            power = []
+            for val in values[i]:
+                a = val.split("E")
+                poly.append(a[0])
+                power.append(int(a[1]))
+            print(poly)
+            print(power)
+            out.write("\t{")
+            for r in ran:
+                out.write(r.rjust(11))
+            out.write("// characteristic curve for temp range between " + ran[0] + " and " + ran[1] + "\n\t{")
+            for p in poly:
+                out.write(str(p).rjust(11) + ",")
+            out.write("},\n")
+            out.write("\t{")
+            for p in power:
+                #    print(p)
+                out.write(str(p).rjust(11) + ",")
+            out.write("},\n\t")
+            out.write(str(len(poly)))
+            out.write(" }")
+
+            poly = []
+            power = []
+            i = i + 1
+            if i != len(ranger):
+                out.write(",")
+            out.write("\n")
+        out.write("};\n")
+
+        out.write(
+            "\nfloat " + class_name + "::convert_inv(float temp)\n{\n\treturn Thermocouple::convert(temp, inv_poly, inv_poly_size);\n}\n")
+        out.write(
+            "\nfloat " + class_name + "::lookup_inv(float temp)\n{""\n#ifdef " + lut_def_name + "\n\tif((temp+lut_offset)>lut_size)\n\t\treturn lut[lut_size-1];\n\telse\n\t\treturn lut[(uint16_t)temp+lut_offset];\n#else\n\t/* NOT IMPLEMENTED */\n\treturn 0;\n#endif\n}\n")
+
+        i=0
+
+    for word in splitted:
+        if(word == 'Voltage' and splitted[i-1] != "Temperature"):
+            break
+        i=i+1
+
+    del splitted[:i+1]
+    i=0
+    #print(splitted)
+    ranger = []
+    values = []
+    for word in splitted:
+
+        if(word == 'Range:'):
+            break
+        ranger.append([word])
+        #print(i)
+        i = i + 1
+
+    del splitted[:i+1]
+    for j in range(i):
+        ranger[j].append(splitted[j])
+        values.append([])
+    del splitted[:i]
+    #print(values)
+
+    i=0
+    for word in splitted:
+        if(word == "Error"):
+            break
+        values[i%len(ranger)].append(word)
+        i=i+1
+
+
+    poly=[]
+    power = []
+    i=0
+
+    with open("Thermocouple.h","a") as out:
+        poly_size = str(len(ranger))
+
+        out.write("\tstatic const thermocouple_poly_subrange poly["+poly_size+"];\n")
+        out.write("\tstatic const int poly_size;\n\tfloat convert(float voltage);\n")
+        out.write("#ifdef "+lut_def_name+"\n")
+        out.write("\tstatic const int32_t lut[];\n\tstatic const int16_t lut_offset;\n\tstatic const uint16_t lut_size;\n\tfloat lookup(float voltage);\n\tfloat lookup_inv(float temp);\n#endif\n};\n\n\n")
+
+
+    with open("Thermocouple.cpp","a") as out:
+
+        out.write("const int "+ class_name + "::poly_size = "+str(len(ranger))+";\n")
+        out.write("const Thermocouple::thermocouple_poly_subrange "+ class_name+ "::poly["+poly_size+"] =\n{\n")
+        for ran in ranger:
+            for val in values[i]:
+                a=val.split("E")
+                poly.append(a[0])
+                power.append(int(a[1]))
+            print(poly)
+            print(power)
+            out.write("\t{")
+            for r in ran:
+                out.write(r.rjust(11) +", ")
+            out.write("// characteristic curve for mV range between " + ran[0] +" and "+ ran[1]+ "\n\t{")
+            for p in poly:
+                out.write(str(p).rjust(11) + ",")
+            out.write("},\n")
+            out.write("\t{")
+            for p in power:
+            #    print(p)
+               out.write(str(p).rjust(11) + ",")
+            out.write("},\n\t")
+            out.write(str(len(poly)))
+            out.write(" }")
+
+            poly = []
+            power = []
+            i=i+1
+            if i!=len(ranger):
+                out.write(",")
+            out.write("\n")
+        out.write("};\n")
+        out.write("\n" + class_name + "::~"+class_name+"()\n{\n\n}\n")
+        out.write("\nfloat "+ class_name +"::convert(float voltage)\n{\n\treturn Thermocouple::convert(voltage, poly, poly_size);\n}\n")
+        out.write("\nfloat "+class_name+"::lookup(float voltage)\n{""\n#ifdef "+lut_def_name+"\n\treturn Thermocouple::lookup(lut, voltage, lut_size, lut_offset);\n#else\n\t/* NOT IMPLEMENTED */\n\treturn 0;\n#endif\n}\n")
+
+with open("Thermocouple.h", "a") as out:
+    out.write("\n#endif\n")
+
+
+
+
+
+#print(ranger)
+#print(values)
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/Thermocouple/tc.txt	Mon Nov 07 16:27:12 2016 +0200
@@ -0,0 +1,2315 @@
+ ITS-90 Table for type B thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+   0  0.000  0.000  0.000 -0.001 -0.001 -0.001 -0.001 -0.001 -0.002 -0.002 -0.002
+  10 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002 -0.003 -0.003 -0.003
+  20 -0.003 -0.003 -0.003 -0.003 -0.003 -0.002 -0.002 -0.002 -0.002 -0.002 -0.002
+  30 -0.002 -0.002 -0.002 -0.002 -0.002 -0.001 -0.001 -0.001 -0.001 -0.001  0.000
+  40  0.000  0.000  0.000  0.000  0.000  0.001  0.001  0.001  0.002  0.002  0.002
+
+  50  0.002  0.003  0.003  0.003  0.004  0.004  0.004  0.005  0.005  0.006  0.006
+  60  0.006  0.007  0.007  0.008  0.008  0.009  0.009  0.010  0.010  0.011  0.011
+  70  0.011  0.012  0.012  0.013  0.014  0.014  0.015  0.015  0.016  0.017  0.017
+  80  0.017  0.018  0.019  0.020  0.020  0.021  0.022  0.022  0.023  0.024  0.025
+  90  0.025  0.026  0.026  0.027  0.028  0.029  0.030  0.031  0.031  0.032  0.033
+
+ 100  0.033  0.034  0.035  0.036  0.037  0.038  0.039  0.040  0.041  0.042  0.043
+ 110  0.043  0.044  0.045  0.046  0.047  0.048  0.049  0.050  0.051  0.052  0.053
+ 120  0.053  0.055  0.056  0.057  0.058  0.059  0.060  0.062  0.063  0.064  0.065
+ 130  0.065  0.066  0.068  0.069  0.070  0.072  0.073  0.074  0.075  0.077  0.078
+ 140  0.078  0.079  0.081  0.082  0.084  0.085  0.086  0.088  0.089  0.091  0.092
+
+ 150  0.092  0.094  0.095  0.096  0.098  0.099  0.101  0.102  0.104  0.106  0.107
+ 160  0.107  0.109  0.110  0.112  0.113  0.115  0.117  0.118  0.120  0.122  0.123
+ 170  0.123  0.125  0.127  0.128  0.130  0.132  0.134  0.135  0.137  0.139  0.141
+ 180  0.141  0.142  0.144  0.146  0.148  0.150  0.151  0.153  0.155  0.157  0.159
+ 190  0.159  0.161  0.163  0.165  0.166  0.168  0.170  0.172  0.174  0.176  0.178
+
+ 200  0.178  0.180  0.182  0.184  0.186  0.188  0.190  0.192  0.195  0.197  0.199
+ 210  0.199  0.201  0.203  0.205  0.207  0.209  0.212  0.214  0.216  0.218  0.220
+ 220  0.220  0.222  0.225  0.227  0.229  0.231  0.234  0.236  0.238  0.241  0.243
+ 230  0.243  0.245  0.248  0.250  0.252  0.255  0.257  0.259  0.262  0.264  0.267
+ 240  0.267  0.269  0.271  0.274  0.276  0.279  0.281  0.284  0.286  0.289  0.291
+
+ 250  0.291  0.294  0.296  0.299  0.301  0.304  0.307  0.309  0.312  0.314  0.317
+ 260  0.317  0.320  0.322  0.325  0.328  0.330  0.333  0.336  0.338  0.341  0.344
+ 270  0.344  0.347  0.349  0.352  0.355  0.358  0.360  0.363  0.366  0.369  0.372
+ 280  0.372  0.375  0.377  0.380  0.383  0.386  0.389  0.392  0.395  0.398  0.401
+ 290  0.401  0.404  0.407  0.410  0.413  0.416  0.419  0.422  0.425  0.428  0.431
+
+ 300  0.431  0.434  0.437  0.440  0.443  0.446  0.449  0.452  0.455  0.458  0.462
+ 310  0.462  0.465  0.468  0.471  0.474  0.478  0.481  0.484  0.487  0.490  0.494
+ 320  0.494  0.497  0.500  0.503  0.507  0.510  0.513  0.517  0.520  0.523  0.527
+ 330  0.527  0.530  0.533  0.537  0.540  0.544  0.547  0.550  0.554  0.557  0.561
+ 340  0.561  0.564  0.568  0.571  0.575  0.578  0.582  0.585  0.589  0.592  0.596
+
+ 350  0.596  0.599  0.603  0.607  0.610  0.614  0.617  0.621  0.625  0.628  0.632
+ 360  0.632  0.636  0.639  0.643  0.647  0.650  0.654  0.658  0.662  0.665  0.669
+ 370  0.669  0.673  0.677  0.680  0.684  0.688  0.692  0.696  0.700  0.703  0.707
+ 380  0.707  0.711  0.715  0.719  0.723  0.727  0.731  0.735  0.738  0.742  0.746
+ 390  0.746  0.750  0.754  0.758  0.762  0.766  0.770  0.774  0.778  0.782  0.787
+
+ 400  0.787  0.791  0.795  0.799  0.803  0.807  0.811  0.815  0.819  0.824  0.828
+ 410  0.828  0.832  0.836  0.840  0.844  0.849  0.853  0.857  0.861  0.866  0.870
+ 420  0.870  0.874  0.878  0.883  0.887  0.891  0.896  0.900  0.904  0.909  0.913
+ 430  0.913  0.917  0.922  0.926  0.930  0.935  0.939  0.944  0.948  0.953  0.957
+ 440  0.957  0.961  0.966  0.970  0.975  0.979  0.984  0.988  0.993  0.997  1.002
+
+ 450  1.002  1.007  1.011  1.016  1.020  1.025  1.030  1.034  1.039  1.043  1.048
+ 460  1.048  1.053  1.057  1.062  1.067  1.071  1.076  1.081  1.086  1.090  1.095
+ 470  1.095  1.100  1.105  1.109  1.114  1.119  1.124  1.129  1.133  1.138  1.143
+ 480  1.143  1.148  1.153  1.158  1.163  1.167  1.172  1.177  1.182  1.187  1.192
+ 490  1.192  1.197  1.202  1.207  1.212  1.217  1.222  1.227  1.232  1.237  1.242
+
+ 500  1.242  1.247  1.252  1.257  1.262  1.267  1.272  1.277  1.282  1.288  1.293
+ 510  1.293  1.298  1.303  1.308  1.313  1.318  1.324  1.329  1.334  1.339  1.344
+ 520  1.344  1.350  1.355  1.360  1.365  1.371  1.376  1.381  1.387  1.392  1.397
+ 530  1.397  1.402  1.408  1.413  1.418  1.424  1.429  1.435  1.440  1.445  1.451
+ 540  1.451  1.456  1.462  1.467  1.472  1.478  1.483  1.489  1.494  1.500  1.505
+
+ 550  1.505  1.511  1.516  1.522  1.527  1.533  1.539  1.544  1.550  1.555  1.561
+ 560  1.561  1.566  1.572  1.578  1.583  1.589  1.595  1.600  1.606  1.612  1.617
+ 570  1.617  1.623  1.629  1.634  1.640  1.646  1.652  1.657  1.663  1.669  1.675
+ 580  1.675  1.680  1.686  1.692  1.698  1.704  1.709  1.715  1.721  1.727  1.733
+ 590  1.733  1.739  1.745  1.750  1.756  1.762  1.768  1.774  1.780  1.786  1.792
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+  ITS-90 Table for type B thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+ 600  1.792  1.798  1.804  1.810  1.816  1.822  1.828  1.834  1.840  1.846  1.852
+ 610  1.852  1.858  1.864  1.870  1.876  1.882  1.888  1.894  1.901  1.907  1.913
+ 620  1.913  1.919  1.925  1.931  1.937  1.944  1.950  1.956  1.962  1.968  1.975
+ 630  1.975  1.981  1.987  1.993  1.999  2.006  2.012  2.018  2.025  2.031  2.037
+ 640  2.037  2.043  2.050  2.056  2.062  2.069  2.075  2.082  2.088  2.094  2.101
+
+ 650  2.101  2.107  2.113  2.120  2.126  2.133  2.139  2.146  2.152  2.158  2.165
+ 660  2.165  2.171  2.178  2.184  2.191  2.197  2.204  2.210  2.217  2.224  2.230
+ 670  2.230  2.237  2.243  2.250  2.256  2.263  2.270  2.276  2.283  2.289  2.296
+ 680  2.296  2.303  2.309  2.316  2.323  2.329  2.336  2.343  2.350  2.356  2.363
+ 690  2.363  2.370  2.376  2.383  2.390  2.397  2.403  2.410  2.417  2.424  2.431
+
+ 700  2.431  2.437  2.444  2.451  2.458  2.465  2.472  2.479  2.485  2.492  2.499
+ 710  2.499  2.506  2.513  2.520  2.527  2.534  2.541  2.548  2.555  2.562  2.569
+ 720  2.569  2.576  2.583  2.590  2.597  2.604  2.611  2.618  2.625  2.632  2.639
+ 730  2.639  2.646  2.653  2.660  2.667  2.674  2.681  2.688  2.696  2.703  2.710
+ 740  2.710  2.717  2.724  2.731  2.738  2.746  2.753  2.760  2.767  2.775  2.782
+
+ 750  2.782  2.789  2.796  2.803  2.811  2.818  2.825  2.833  2.840  2.847  2.854
+ 760  2.854  2.862  2.869  2.876  2.884  2.891  2.898  2.906  2.913  2.921  2.928
+ 770  2.928  2.935  2.943  2.950  2.958  2.965  2.973  2.980  2.987  2.995  3.002
+ 780  3.002  3.010  3.017  3.025  3.032  3.040  3.047  3.055  3.062  3.070  3.078
+ 790  3.078  3.085  3.093  3.100  3.108  3.116  3.123  3.131  3.138  3.146  3.154
+
+ 800  3.154  3.161  3.169  3.177  3.184  3.192  3.200  3.207  3.215  3.223  3.230
+ 810  3.230  3.238  3.246  3.254  3.261  3.269  3.277  3.285  3.292  3.300  3.308
+ 820  3.308  3.316  3.324  3.331  3.339  3.347  3.355  3.363  3.371  3.379  3.386
+ 830  3.386  3.394  3.402  3.410  3.418  3.426  3.434  3.442  3.450  3.458  3.466
+ 840  3.466  3.474  3.482  3.490  3.498  3.506  3.514  3.522  3.530  3.538  3.546
+
+ 850  3.546  3.554  3.562  3.570  3.578  3.586  3.594  3.602  3.610  3.618  3.626
+ 860  3.626  3.634  3.643  3.651  3.659  3.667  3.675  3.683  3.692  3.700  3.708
+ 870  3.708  3.716  3.724  3.732  3.741  3.749  3.757  3.765  3.774  3.782  3.790
+ 880  3.790  3.798  3.807  3.815  3.823  3.832  3.840  3.848  3.857  3.865  3.873
+ 890  3.873  3.882  3.890  3.898  3.907  3.915  3.923  3.932  3.940  3.949  3.957
+
+ 900  3.957  3.965  3.974  3.982  3.991  3.999  4.008  4.016  4.024  4.033  4.041
+ 910  4.041  4.050  4.058  4.067  4.075  4.084  4.093  4.101  4.110  4.118  4.127
+ 920  4.127  4.135  4.144  4.152  4.161  4.170  4.178  4.187  4.195  4.204  4.213
+ 930  4.213  4.221  4.230  4.239  4.247  4.256  4.265  4.273  4.282  4.291  4.299
+ 940  4.299  4.308  4.317  4.326  4.334  4.343  4.352  4.360  4.369  4.378  4.387
+
+ 950  4.387  4.396  4.404  4.413  4.422  4.431  4.440  4.448  4.457  4.466  4.475
+ 960  4.475  4.484  4.493  4.501  4.510  4.519  4.528  4.537  4.546  4.555  4.564
+ 970  4.564  4.573  4.582  4.591  4.599  4.608  4.617  4.626  4.635  4.644  4.653
+ 980  4.653  4.662  4.671  4.680  4.689  4.698  4.707  4.716  4.725  4.734  4.743
+ 990  4.743  4.753  4.762  4.771  4.780  4.789  4.798  4.807  4.816  4.825  4.834
+
+1000  4.834  4.843  4.853  4.862  4.871  4.880  4.889  4.898  4.908  4.917  4.926
+1010  4.926  4.935  4.944  4.954  4.963  4.972  4.981  4.990  5.000  5.009  5.018
+1020  5.018  5.027  5.037  5.046  5.055  5.065  5.074  5.083  5.092  5.102  5.111
+1030  5.111  5.120  5.130  5.139  5.148  5.158  5.167  5.176  5.186  5.195  5.205
+1040  5.205  5.214  5.223  5.233  5.242  5.252  5.261  5.270  5.280  5.289  5.299
+
+1050  5.299  5.308  5.318  5.327  5.337  5.346  5.356  5.365  5.375  5.384  5.394
+1060  5.394  5.403  5.413  5.422  5.432  5.441  5.451  5.460  5.470  5.480  5.489
+1070  5.489  5.499  5.508  5.518  5.528  5.537  5.547  5.556  5.566  5.576  5.585
+1080  5.585  5.595  5.605  5.614  5.624  5.634  5.643  5.653  5.663  5.672  5.682
+1090  5.682  5.692  5.702  5.711  5.721  5.731  5.740  5.750  5.760  5.770  5.780
+
+1100  5.780  5.789  5.799  5.809  5.819  5.828  5.838  5.848  5.858  5.868  5.878
+1110  5.878  5.887  5.897  5.907  5.917  5.927  5.937  5.947  5.956  5.966  5.976
+1120  5.976  5.986  5.996  6.006  6.016  6.026  6.036  6.046  6.055  6.065  6.075
+1130  6.075  6.085  6.095  6.105  6.115  6.125  6.135  6.145  6.155  6.165  6.175
+1140  6.175  6.185  6.195  6.205  6.215  6.225  6.235  6.245  6.256  6.266  6.276
+
+1150  6.276  6.286  6.296  6.306  6.316  6.326  6.336  6.346  6.356  6.367  6.377
+1160  6.377  6.387  6.397  6.407  6.417  6.427  6.438  6.448  6.458  6.468  6.478
+1170  6.478  6.488  6.499  6.509  6.519  6.529  6.539  6.550  6.560  6.570  6.580
+1180  6.580  6.591  6.601  6.611  6.621  6.632  6.642  6.652  6.663  6.673  6.683
+1190  6.683  6.693  6.704  6.714  6.724  6.735  6.745  6.755  6.766  6.776  6.786
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+  ITS-90 Table for type B thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+1200  6.786  6.797  6.807  6.818  6.828  6.838  6.849  6.859  6.869  6.880  6.890
+1210  6.890  6.901  6.911  6.922  6.932  6.942  6.953  6.963  6.974  6.984  6.995
+1220  6.995  7.005  7.016  7.026  7.037  7.047  7.058  7.068  7.079  7.089  7.100
+1230  7.100  7.110  7.121  7.131  7.142  7.152  7.163  7.173  7.184  7.194  7.205
+1240  7.205  7.216  7.226  7.237  7.247  7.258  7.269  7.279  7.290  7.300  7.311
+
+1250  7.311  7.322  7.332  7.343  7.353  7.364  7.375  7.385  7.396  7.407  7.417
+1260  7.417  7.428  7.439  7.449  7.460  7.471  7.482  7.492  7.503  7.514  7.524
+1270  7.524  7.535  7.546  7.557  7.567  7.578  7.589  7.600  7.610  7.621  7.632
+1280  7.632  7.643  7.653  7.664  7.675  7.686  7.697  7.707  7.718  7.729  7.740
+1290  7.740  7.751  7.761  7.772  7.783  7.794  7.805  7.816  7.827  7.837  7.848
+
+1300  7.848  7.859  7.870  7.881  7.892  7.903  7.914  7.924  7.935  7.946  7.957
+1310  7.957  7.968  7.979  7.990  8.001  8.012  8.023  8.034  8.045  8.056  8.066
+1320  8.066  8.077  8.088  8.099  8.110  8.121  8.132  8.143  8.154  8.165  8.176
+1330  8.176  8.187  8.198  8.209  8.220  8.231  8.242  8.253  8.264  8.275  8.286
+1340  8.286  8.298  8.309  8.320  8.331  8.342  8.353  8.364  8.375  8.386  8.397
+
+1350  8.397  8.408  8.419  8.430  8.441  8.453  8.464  8.475  8.486  8.497  8.508
+1360  8.508  8.519  8.530  8.542  8.553  8.564  8.575  8.586  8.597  8.608  8.620
+1370  8.620  8.631  8.642  8.653  8.664  8.675  8.687  8.698  8.709  8.720  8.731
+1380  8.731  8.743  8.754  8.765  8.776  8.787  8.799  8.810  8.821  8.832  8.844
+1390  8.844  8.855  8.866  8.877  8.889  8.900  8.911  8.922  8.934  8.945  8.956
+
+1400  8.956  8.967  8.979  8.990  9.001  9.013  9.024  9.035  9.047  9.058  9.069
+1410  9.069  9.080  9.092  9.103  9.114  9.126  9.137  9.148  9.160  9.171  9.182
+1420  9.182  9.194  9.205  9.216  9.228  9.239  9.251  9.262  9.273  9.285  9.296
+1430  9.296  9.307  9.319  9.330  9.342  9.353  9.364  9.376  9.387  9.398  9.410
+1440  9.410  9.421  9.433  9.444  9.456  9.467  9.478  9.490  9.501  9.513  9.524
+
+1450  9.524  9.536  9.547  9.558  9.570  9.581  9.593  9.604  9.616  9.627  9.639
+1460  9.639  9.650  9.662  9.673  9.684  9.696  9.707  9.719  9.730  9.742  9.753
+1470  9.753  9.765  9.776  9.788  9.799  9.811  9.822  9.834  9.845  9.857  9.868
+1480  9.868  9.880  9.891  9.903  9.914  9.926  9.937  9.949  9.961  9.972  9.984
+1490  9.984  9.995 10.007 10.018 10.030 10.041 10.053 10.064 10.076 10.088 10.099
+
+1500 10.099 10.111 10.122 10.134 10.145 10.157 10.168 10.180 10.192 10.203 10.215
+1510 10.215 10.226 10.238 10.249 10.261 10.273 10.284 10.296 10.307 10.319 10.331
+1520 10.331 10.342 10.354 10.365 10.377 10.389 10.400 10.412 10.423 10.435 10.447
+1530 10.447 10.458 10.470 10.482 10.493 10.505 10.516 10.528 10.540 10.551 10.563
+1540 10.563 10.575 10.586 10.598 10.609 10.621 10.633 10.644 10.656 10.668 10.679
+
+1550 10.679 10.691 10.703 10.714 10.726 10.738 10.749 10.761 10.773 10.784 10.796
+1560 10.796 10.808 10.819 10.831 10.843 10.854 10.866 10.877 10.889 10.901 10.913
+1570 10.913 10.924 10.936 10.948 10.959 10.971 10.983 10.994 11.006 11.018 11.029
+1580 11.029 11.041 11.053 11.064 11.076 11.088 11.099 11.111 11.123 11.134 11.146
+1590 11.146 11.158 11.169 11.181 11.193 11.205 11.216 11.228 11.240 11.251 11.263
+
+1600 11.263 11.275 11.286 11.298 11.310 11.321 11.333 11.345 11.357 11.368 11.380
+1610 11.380 11.392 11.403 11.415 11.427 11.438 11.450 11.462 11.474 11.485 11.497
+1620 11.497 11.509 11.520 11.532 11.544 11.555 11.567 11.579 11.591 11.602 11.614
+1630 11.614 11.626 11.637 11.649 11.661 11.673 11.684 11.696 11.708 11.719 11.731
+1640 11.731 11.743 11.754 11.766 11.778 11.790 11.801 11.813 11.825 11.836 11.848
+
+1650 11.848 11.860 11.871 11.883 11.895 11.907 11.918 11.930 11.942 11.953 11.965
+1660 11.965 11.977 11.988 12.000 12.012 12.024 12.035 12.047 12.059 12.070 12.082
+1670 12.082 12.094 12.105 12.117 12.129 12.141 12.152 12.164 12.176 12.187 12.199
+1680 12.199 12.211 12.222 12.234 12.246 12.257 12.269 12.281 12.292 12.304 12.316
+1690 12.316 12.327 12.339 12.351 12.363 12.374 12.386 12.398 12.409 12.421 12.433
+
+1700 12.433 12.444 12.456 12.468 12.479 12.491 12.503 12.514 12.526 12.538 12.549
+1710 12.549 12.561 12.572 12.584 12.596 12.607 12.619 12.631 12.642 12.654 12.666
+1720 12.666 12.677 12.689 12.701 12.712 12.724 12.736 12.747 12.759 12.770 12.782
+1730 12.782 12.794 12.805 12.817 12.829 12.840 12.852 12.863 12.875 12.887 12.898
+1740 12.898 12.910 12.921 12.933 12.945 12.956 12.968 12.980 12.991 13.003 13.014
+
+1750 13.014 13.026 13.037 13.049 13.061 13.072 13.084 13.095 13.107 13.119 13.130
+1760 13.130 13.142 13.153 13.165 13.176 13.188 13.200 13.211 13.223 13.234 13.246
+1770 13.246 13.257 13.269 13.280 13.292 13.304 13.315 13.327 13.338 13.350 13.361
+1780 13.361 13.373 13.384 13.396 13.407 13.419 13.430 13.442 13.453 13.465 13.476
+1790 13.476 13.488 13.499 13.511 13.522 13.534 13.545 13.557 13.568 13.580 13.591
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+  ITS-90 Table for type B thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+1800 13.591 13.603 13.614 13.626 13.637 13.649 13.660 13.672 13.683 13.694 13.706
+1810 13.706 13.717 13.729 13.740 13.752 13.763 13.775 13.786 13.797 13.809 13.820
+1820 13.820
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+
+
+************************************
+* This section contains coefficients for type B thermocouples for
+* the two subranges of temperature listed below.  The coefficients
+* are in units of °C and mV and are listed in the order of constant
+* term up to the highest order.  The equation is of the form
+* E = sum(i=0 to n) c_i t^i.
+*
+*     Temperature Range (°C)
+*        0.000 to 630.615
+*        630.615 to 1820.000
+************************************
+name: reference function on ITS-90
+type: B
+temperature units: °C
+emf units: mV
+range:     0.000,    630.615,  6
+ 0.000000000000E+00
+-0.246508183460E-03
+ 0.590404211710E-05
+-0.132579316360E-08
+ 0.156682919010E-11
+-0.169445292400E-14
+ 0.629903470940E-18
+range:   630.615,   1820.000,  8
+-0.389381686210E+01
+ 0.285717474700E-01
+-0.848851047850E-04
+ 0.157852801640E-06
+-0.168353448640E-09
+ 0.111097940130E-12
+-0.445154310330E-16
+ 0.989756408210E-20
+-0.937913302890E-24
+
+
+
+************************************
+* This section contains coefficients of approximate inverse
+* functions for type B thermocouples for the subranges of
+* temperature and voltage listed below. The range of errors of
+* the approximate inverse function for each subrange is also given.
+* The coefficients are in units of °C and mV and are listed in
+* the order of constant term up to the highest order.
+* The equation is of the form t_90 = d_0 + d_1*E + d_2*E^2 + ...
+*     + d_n*E^n,
+* where E is in mV and t_90 is in °C.
+*
+*    Temperature        Voltage            Error
+*      range              range            range
+*      (°C)               (mV)             (° C)
+*    250. to 700.       0.291 to 2.431    -0.02 to 0.03
+*    700. to 1800.      2.431 to 13.820   -0.01 to 0.02
+********************************************************
+Inverse coefficients for type B:
+
+Temperature   250.           700.
+  Range:      700.          1820.
+
+  Voltage    0.291          2.431
+  Range:     2.431         13.820
+
+         9.8423321E+01  2.1315071E+02
+         6.9971500E+02  2.8510504E+02
+        -8.4765304E+02 -5.2742887E+01
+         1.0052644E+03  9.9160804E+00
+        -8.3345952E+02 -1.2965303E+00
+         4.5508542E+02  1.1195870E-01
+        -1.5523037E+02 -6.0625199E-03
+         2.9886750E+01  1.8661696E-04
+        -2.4742860E+00 -2.4878585E-06
+
+  Error      -0.02          -0.01
+  Range:      0.03           0.02
+
+
+
+ ITS-90 Table for type E thermocouple
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+                               Thermoelectric Voltage in mV
+
+-270 -9.835
+-260 -9.797 -9.802 -9.808 -9.813 -9.817 -9.821 -9.825 -9.828 -9.831 -9.833 -9.835
+-250 -9.718 -9.728 -9.737 -9.746 -9.754 -9.762 -9.770 -9.777 -9.784 -9.790 -9.797
+
+-240 -9.604 -9.617 -9.630 -9.642 -9.654 -9.666 -9.677 -9.688 -9.698 -9.709 -9.718
+-230 -9.455 -9.471 -9.487 -9.503 -9.519 -9.534 -9.548 -9.563 -9.577 -9.591 -9.604
+-220 -9.274 -9.293 -9.313 -9.331 -9.350 -9.368 -9.386 -9.404 -9.421 -9.438 -9.455
+-210 -9.063 -9.085 -9.107 -9.129 -9.151 -9.172 -9.193 -9.214 -9.234 -9.254 -9.274
+-200 -8.825 -8.850 -8.874 -8.899 -8.923 -8.947 -8.971 -8.994 -9.017 -9.040 -9.063
+
+-190 -8.561 -8.588 -8.616 -8.643 -8.669 -8.696 -8.722 -8.748 -8.774 -8.799 -8.825
+-180 -8.273 -8.303 -8.333 -8.362 -8.391 -8.420 -8.449 -8.477 -8.505 -8.533 -8.561
+-170 -7.963 -7.995 -8.027 -8.059 -8.090 -8.121 -8.152 -8.183 -8.213 -8.243 -8.273
+-160 -7.632 -7.666 -7.700 -7.733 -7.767 -7.800 -7.833 -7.866 -7.899 -7.931 -7.963
+-150 -7.279 -7.315 -7.351 -7.387 -7.423 -7.458 -7.493 -7.528 -7.563 -7.597 -7.632
+
+-140 -6.907 -6.945 -6.983 -7.021 -7.058 -7.096 -7.133 -7.170 -7.206 -7.243 -7.279
+-130 -6.516 -6.556 -6.596 -6.636 -6.675 -6.714 -6.753 -6.792 -6.831 -6.869 -6.907
+-120 -6.107 -6.149 -6.191 -6.232 -6.273 -6.314 -6.355 -6.396 -6.436 -6.476 -6.516
+-110 -5.681 -5.724 -5.767 -5.810 -5.853 -5.896 -5.939 -5.981 -6.023 -6.065 -6.107
+-100 -5.237 -5.282 -5.327 -5.372 -5.417 -5.461 -5.505 -5.549 -5.593 -5.637 -5.681
+
+ -90 -4.777 -4.824 -4.871 -4.917 -4.963 -5.009 -5.055 -5.101 -5.147 -5.192 -5.237
+ -80 -4.302 -4.350 -4.398 -4.446 -4.494 -4.542 -4.589 -4.636 -4.684 -4.731 -4.777
+ -70 -3.811 -3.861 -3.911 -3.960 -4.009 -4.058 -4.107 -4.156 -4.205 -4.254 -4.302
+ -60 -3.306 -3.357 -3.408 -3.459 -3.510 -3.561 -3.611 -3.661 -3.711 -3.761 -3.811
+ -50 -2.787 -2.840 -2.892 -2.944 -2.996 -3.048 -3.100 -3.152 -3.204 -3.255 -3.306
+
+ -40 -2.255 -2.309 -2.362 -2.416 -2.469 -2.523 -2.576 -2.629 -2.682 -2.735 -2.787
+ -30 -1.709 -1.765 -1.820 -1.874 -1.929 -1.984 -2.038 -2.093 -2.147 -2.201 -2.255
+ -20 -1.152 -1.208 -1.264 -1.320 -1.376 -1.432 -1.488 -1.543 -1.599 -1.654 -1.709
+ -10 -0.582 -0.639 -0.697 -0.754 -0.811 -0.868 -0.925 -0.982 -1.039 -1.095 -1.152
+   0  0.000 -0.059 -0.117 -0.176 -0.234 -0.292 -0.350 -0.408 -0.466 -0.524 -0.582
+
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+
+ ITS-90 Table for type E thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+   0  0.000  0.059  0.118  0.176  0.235  0.294  0.354  0.413  0.472  0.532  0.591
+  10  0.591  0.651  0.711  0.770  0.830  0.890  0.950  1.010  1.071  1.131  1.192
+  20  1.192  1.252  1.313  1.373  1.434  1.495  1.556  1.617  1.678  1.740  1.801
+  30  1.801  1.862  1.924  1.986  2.047  2.109  2.171  2.233  2.295  2.357  2.420
+  40  2.420  2.482  2.545  2.607  2.670  2.733  2.795  2.858  2.921  2.984  3.048
+
+  50  3.048  3.111  3.174  3.238  3.301  3.365  3.429  3.492  3.556  3.620  3.685
+  60  3.685  3.749  3.813  3.877  3.942  4.006  4.071  4.136  4.200  4.265  4.330
+  70  4.330  4.395  4.460  4.526  4.591  4.656  4.722  4.788  4.853  4.919  4.985
+  80  4.985  5.051  5.117  5.183  5.249  5.315  5.382  5.448  5.514  5.581  5.648
+  90  5.648  5.714  5.781  5.848  5.915  5.982  6.049  6.117  6.184  6.251  6.319
+
+ 100  6.319  6.386  6.454  6.522  6.590  6.658  6.725  6.794  6.862  6.930  6.998
+ 110  6.998  7.066  7.135  7.203  7.272  7.341  7.409  7.478  7.547  7.616  7.685
+ 120  7.685  7.754  7.823  7.892  7.962  8.031  8.101  8.170  8.240  8.309  8.379
+ 130  8.379  8.449  8.519  8.589  8.659  8.729  8.799  8.869  8.940  9.010  9.081
+ 140  9.081  9.151  9.222  9.292  9.363  9.434  9.505  9.576  9.647  9.718  9.789
+
+ 150  9.789  9.860  9.931 10.003 10.074 10.145 10.217 10.288 10.360 10.432 10.503
+ 160 10.503 10.575 10.647 10.719 10.791 10.863 10.935 11.007 11.080 11.152 11.224
+ 170 11.224 11.297 11.369 11.442 11.514 11.587 11.660 11.733 11.805 11.878 11.951
+ 180 11.951 12.024 12.097 12.170 12.243 12.317 12.390 12.463 12.537 12.610 12.684
+ 190 12.684 12.757 12.831 12.904 12.978 13.052 13.126 13.199 13.273 13.347 13.421
+
+ 200 13.421 13.495 13.569 13.644 13.718 13.792 13.866 13.941 14.015 14.090 14.164
+ 210 14.164 14.239 14.313 14.388 14.463 14.537 14.612 14.687 14.762 14.837 14.912
+ 220 14.912 14.987 15.062 15.137 15.212 15.287 15.362 15.438 15.513 15.588 15.664
+ 230 15.664 15.739 15.815 15.890 15.966 16.041 16.117 16.193 16.269 16.344 16.420
+ 240 16.420 16.496 16.572 16.648 16.724 16.800 16.876 16.952 17.028 17.104 17.181
+
+ 250 17.181 17.257 17.333 17.409 17.486 17.562 17.639 17.715 17.792 17.868 17.945
+ 260 17.945 18.021 18.098 18.175 18.252 18.328 18.405 18.482 18.559 18.636 18.713
+ 270 18.713 18.790 18.867 18.944 19.021 19.098 19.175 19.252 19.330 19.407 19.484
+ 280 19.484 19.561 19.639 19.716 19.794 19.871 19.948 20.026 20.103 20.181 20.259
+ 290 20.259 20.336 20.414 20.492 20.569 20.647 20.725 20.803 20.880 20.958 21.036
+
+ 300 21.036 21.114 21.192 21.270 21.348 21.426 21.504 21.582 21.660 21.739 21.817
+ 310 21.817 21.895 21.973 22.051 22.130 22.208 22.286 22.365 22.443 22.522 22.600
+ 320 22.600 22.678 22.757 22.835 22.914 22.993 23.071 23.150 23.228 23.307 23.386
+ 330 23.386 23.464 23.543 23.622 23.701 23.780 23.858 23.937 24.016 24.095 24.174
+ 340 24.174 24.253 24.332 24.411 24.490 24.569 24.648 24.727 24.806 24.885 24.964
+
+ 350 24.964 25.044 25.123 25.202 25.281 25.360 25.440 25.519 25.598 25.678 25.757
+ 360 25.757 25.836 25.916 25.995 26.075 26.154 26.233 26.313 26.392 26.472 26.552
+ 370 26.552 26.631 26.711 26.790 26.870 26.950 27.029 27.109 27.189 27.268 27.348
+ 380 27.348 27.428 27.507 27.587 27.667 27.747 27.827 27.907 27.986 28.066 28.146
+ 390 28.146 28.226 28.306 28.386 28.466 28.546 28.626 28.706 28.786 28.866 28.946
+
+ 400 28.946 29.026 29.106 29.186 29.266 29.346 29.427 29.507 29.587 29.667 29.747
+ 410 29.747 29.827 29.908 29.988 30.068 30.148 30.229 30.309 30.389 30.470 30.550
+ 420 30.550 30.630 30.711 30.791 30.871 30.952 31.032 31.112 31.193 31.273 31.354
+ 430 31.354 31.434 31.515 31.595 31.676 31.756 31.837 31.917 31.998 32.078 32.159
+ 440 32.159 32.239 32.320 32.400 32.481 32.562 32.642 32.723 32.803 32.884 32.965
+
+ 450 32.965 33.045 33.126 33.207 33.287 33.368 33.449 33.529 33.610 33.691 33.772
+ 460 33.772 33.852 33.933 34.014 34.095 34.175 34.256 34.337 34.418 34.498 34.579
+ 470 34.579 34.660 34.741 34.822 34.902 34.983 35.064 35.145 35.226 35.307 35.387
+ 480 35.387 35.468 35.549 35.630 35.711 35.792 35.873 35.954 36.034 36.115 36.196
+ 490 36.196 36.277 36.358 36.439 36.520 36.601 36.682 36.763 36.843 36.924 37.005
+
+ 500 37.005 37.086 37.167 37.248 37.329 37.410 37.491 37.572 37.653 37.734 37.815
+ 510 37.815 37.896 37.977 38.058 38.139 38.220 38.300 38.381 38.462 38.543 38.624
+ 520 38.624 38.705 38.786 38.867 38.948 39.029 39.110 39.191 39.272 39.353 39.434
+ 530 39.434 39.515 39.596 39.677 39.758 39.839 39.920 40.001 40.082 40.163 40.243
+ 540 40.243 40.324 40.405 40.486 40.567 40.648 40.729 40.810 40.891 40.972 41.053
+
+ 550 41.053 41.134 41.215 41.296 41.377 41.457 41.538 41.619 41.700 41.781 41.862
+ 560 41.862 41.943 42.024 42.105 42.185 42.266 42.347 42.428 42.509 42.590 42.671
+ 570 42.671 42.751 42.832 42.913 42.994 43.075 43.156 43.236 43.317 43.398 43.479
+ 580 43.479 43.560 43.640 43.721 43.802 43.883 43.963 44.044 44.125 44.206 44.286
+ 590 44.286 44.367 44.448 44.529 44.609 44.690 44.771 44.851 44.932 45.013 45.093
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+  ITS-90 Table for type E thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+ 600 45.093 45.174 45.255 45.335 45.416 45.497 45.577 45.658 45.738 45.819 45.900
+ 610 45.900 45.980 46.061 46.141 46.222 46.302 46.383 46.463 46.544 46.624 46.705
+ 620 46.705 46.785 46.866 46.946 47.027 47.107 47.188 47.268 47.349 47.429 47.509
+ 630 47.509 47.590 47.670 47.751 47.831 47.911 47.992 48.072 48.152 48.233 48.313
+ 640 48.313 48.393 48.474 48.554 48.634 48.715 48.795 48.875 48.955 49.035 49.116
+
+ 650 49.116 49.196 49.276 49.356 49.436 49.517 49.597 49.677 49.757 49.837 49.917
+ 660 49.917 49.997 50.077 50.157 50.238 50.318 50.398 50.478 50.558 50.638 50.718
+ 670 50.718 50.798 50.878 50.958 51.038 51.118 51.197 51.277 51.357 51.437 51.517
+ 680 51.517 51.597 51.677 51.757 51.837 51.916 51.996 52.076 52.156 52.236 52.315
+ 690 52.315 52.395 52.475 52.555 52.634 52.714 52.794 52.873 52.953 53.033 53.112
+
+ 700 53.112 53.192 53.272 53.351 53.431 53.510 53.590 53.670 53.749 53.829 53.908
+ 710 53.908 53.988 54.067 54.147 54.226 54.306 54.385 54.465 54.544 54.624 54.703
+ 720 54.703 54.782 54.862 54.941 55.021 55.100 55.179 55.259 55.338 55.417 55.497
+ 730 55.497 55.576 55.655 55.734 55.814 55.893 55.972 56.051 56.131 56.210 56.289
+ 740 56.289 56.368 56.447 56.526 56.606 56.685 56.764 56.843 56.922 57.001 57.080
+
+ 750 57.080 57.159 57.238 57.317 57.396 57.475 57.554 57.633 57.712 57.791 57.870
+ 760 57.870 57.949 58.028 58.107 58.186 58.265 58.343 58.422 58.501 58.580 58.659
+ 770 58.659 58.738 58.816 58.895 58.974 59.053 59.131 59.210 59.289 59.367 59.446
+ 780 59.446 59.525 59.604 59.682 59.761 59.839 59.918 59.997 60.075 60.154 60.232
+ 790 60.232 60.311 60.390 60.468 60.547 60.625 60.704 60.782 60.860 60.939 61.017
+
+ 800 61.017 61.096 61.174 61.253 61.331 61.409 61.488 61.566 61.644 61.723 61.801
+ 810 61.801 61.879 61.958 62.036 62.114 62.192 62.271 62.349 62.427 62.505 62.583
+ 820 62.583 62.662 62.740 62.818 62.896 62.974 63.052 63.130 63.208 63.286 63.364
+ 830 63.364 63.442 63.520 63.598 63.676 63.754 63.832 63.910 63.988 64.066 64.144
+ 840 64.144 64.222 64.300 64.377 64.455 64.533 64.611 64.689 64.766 64.844 64.922
+
+ 850 64.922 65.000 65.077 65.155 65.233 65.310 65.388 65.465 65.543 65.621 65.698
+ 860 65.698 65.776 65.853 65.931 66.008 66.086 66.163 66.241 66.318 66.396 66.473
+ 870 66.473 66.550 66.628 66.705 66.782 66.860 66.937 67.014 67.092 67.169 67.246
+ 880 67.246 67.323 67.400 67.478 67.555 67.632 67.709 67.786 67.863 67.940 68.017
+ 890 68.017 68.094 68.171 68.248 68.325 68.402 68.479 68.556 68.633 68.710 68.787
+
+ 900 68.787 68.863 68.940 69.017 69.094 69.171 69.247 69.324 69.401 69.477 69.554
+ 910 69.554 69.631 69.707 69.784 69.860 69.937 70.013 70.090 70.166 70.243 70.319
+ 920 70.319 70.396 70.472 70.548 70.625 70.701 70.777 70.854 70.930 71.006 71.082
+ 930 71.082 71.159 71.235 71.311 71.387 71.463 71.539 71.615 71.692 71.768 71.844
+ 940 71.844 71.920 71.996 72.072 72.147 72.223 72.299 72.375 72.451 72.527 72.603
+
+ 950 72.603 72.678 72.754 72.830 72.906 72.981 73.057 73.133 73.208 73.284 73.360
+ 960 73.360 73.435 73.511 73.586 73.662 73.738 73.813 73.889 73.964 74.040 74.115
+ 970 74.115 74.190 74.266 74.341 74.417 74.492 74.567 74.643 74.718 74.793 74.869
+ 980 74.869 74.944 75.019 75.095 75.170 75.245 75.320 75.395 75.471 75.546 75.621
+ 990 75.621 75.696 75.771 75.847 75.922 75.997 76.072 76.147 76.223 76.298 76.373
+
+1000 76.373
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+
+
+************************************
+* This section contains coefficients for type E thermocouples for
+* the two subranges of temperature listed below.  The coefficients
+* are in units of °C and mV and are listed in the order of constant
+* term up to the highest order.  The equation is of the form
+* E = sum(i=0 to n) c_i t^i.
+*
+*     Temperature Range (°C)
+*        -270.000 to 0.000
+*         0.000 to 1000.000
+************************************
+name: reference function on ITS-90
+type: E
+temperature units: °C
+emf units: mV
+range:  -270.000,      0.000, 13
+ 0.000000000000E+00
+ 0.586655087080E-01
+ 0.454109771240E-04
+-0.779980486860E-06
+-0.258001608430E-07
+-0.594525830570E-09
+-0.932140586670E-11
+-0.102876055340E-12
+-0.803701236210E-15
+-0.439794973910E-17
+-0.164147763550E-19
+-0.396736195160E-22
+-0.558273287210E-25
+-0.346578420130E-28
+range:     0.000,   1000.000, 10
+ 0.000000000000E+00
+ 0.586655087100E-01
+ 0.450322755820E-04
+ 0.289084072120E-07
+-0.330568966520E-09
+ 0.650244032700E-12
+-0.191974955040E-15
+-0.125366004970E-17
+ 0.214892175690E-20
+-0.143880417820E-23
+ 0.359608994810E-27
+
+
+
+************************************
+* This section contains coefficients of approximate inverse
+* functions for type E thermocouples for the subranges of
+* temperature and voltage listed below. The range of errors of
+* the approximate inverse function for each subrange is also given.
+* The coefficients are in units of °C and mV and are listed in
+* the order of constant term up to the highest order.
+* The equation is of the form t_90 = d_0 + d_1*E + d_2*E^2 + ...
+*     + d_n*E^n,
+* where E is in mV and t_90 is in °C.
+*
+*    Temperature        Voltage            Error
+*      Range              range            range
+*      (°C)               (mV)             (° C)
+*    -200. to 0.       -8.825 to 0.000    -0.01 to 0.03
+*     0. to 1000.       0.000 to 76.373   -0.02 to 0.02
+********************************************************
+Inverse coefficients for type E:
+
+Temperature  -200.             0.
+  Range:        0.          1000.
+
+  Voltage   -8.825          0.000
+  Range:     0.000         76.373
+
+         0.0000000E+00  0.0000000E+00
+         1.6977288E+01  1.7057035E+01
+        -4.3514970E-01 -2.3301759E-01
+        -1.5859697E-01  6.5435585E-03
+        -9.2502871E-02 -7.3562749E-05
+        -2.6084314E-02 -1.7896001E-06
+        -4.1360199E-03  8.4036165E-08
+        -3.4034030E-04 -1.3735879E-09
+        -1.1564890E-05  1.0629823E-11
+         0.0000000E+00 -3.2447087E-14
+
+  Error      -0.01          -0.02
+  Range:      0.03           0.02
+
+
+
+ ITS-90 Table for type J thermocouple
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+                               Thermoelectric Voltage in mV
+
+-210 -8.095
+-200 -7.890 -7.912 -7.934 -7.955 -7.976 -7.996 -8.017 -8.037 -8.057 -8.076 -8.095
+
+-190 -7.659 -7.683 -7.707 -7.731 -7.755 -7.778 -7.801 -7.824 -7.846 -7.868 -7.890
+-180 -7.403 -7.429 -7.456 -7.482 -7.508 -7.534 -7.559 -7.585 -7.610 -7.634 -7.659
+-170 -7.123 -7.152 -7.181 -7.209 -7.237 -7.265 -7.293 -7.321 -7.348 -7.376 -7.403
+-160 -6.821 -6.853 -6.883 -6.914 -6.944 -6.975 -7.005 -7.035 -7.064 -7.094 -7.123
+-150 -6.500 -6.533 -6.566 -6.598 -6.631 -6.663 -6.695 -6.727 -6.759 -6.790 -6.821
+
+-140 -6.159 -6.194 -6.229 -6.263 -6.298 -6.332 -6.366 -6.400 -6.433 -6.467 -6.500
+-130 -5.801 -5.838 -5.874 -5.910 -5.946 -5.982 -6.018 -6.054 -6.089 -6.124 -6.159
+-120 -5.426 -5.465 -5.503 -5.541 -5.578 -5.616 -5.653 -5.690 -5.727 -5.764 -5.801
+-110 -5.037 -5.076 -5.116 -5.155 -5.194 -5.233 -5.272 -5.311 -5.350 -5.388 -5.426
+-100 -4.633 -4.674 -4.714 -4.755 -4.796 -4.836 -4.877 -4.917 -4.957 -4.997 -5.037
+
+ -90 -4.215 -4.257 -4.300 -4.342 -4.384 -4.425 -4.467 -4.509 -4.550 -4.591 -4.633
+ -80 -3.786 -3.829 -3.872 -3.916 -3.959 -4.002 -4.045 -4.088 -4.130 -4.173 -4.215
+ -70 -3.344 -3.389 -3.434 -3.478 -3.522 -3.566 -3.610 -3.654 -3.698 -3.742 -3.786
+ -60 -2.893 -2.938 -2.984 -3.029 -3.075 -3.120 -3.165 -3.210 -3.255 -3.300 -3.344
+ -50 -2.431 -2.478 -2.524 -2.571 -2.617 -2.663 -2.709 -2.755 -2.801 -2.847 -2.893
+
+ -40 -1.961 -2.008 -2.055 -2.103 -2.150 -2.197 -2.244 -2.291 -2.338 -2.385 -2.431
+ -30 -1.482 -1.530 -1.578 -1.626 -1.674 -1.722 -1.770 -1.818 -1.865 -1.913 -1.961
+ -20 -0.995 -1.044 -1.093 -1.142 -1.190 -1.239 -1.288 -1.336 -1.385 -1.433 -1.482
+ -10 -0.501 -0.550 -0.600 -0.650 -0.699 -0.749 -0.798 -0.847 -0.896 -0.946 -0.995
+   0  0.000 -0.050 -0.101 -0.151 -0.201 -0.251 -0.301 -0.351 -0.401 -0.451 -0.501
+
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+
+ ITS-90 Table for type J thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+   0  0.000  0.050  0.101  0.151  0.202  0.253  0.303  0.354  0.405  0.456  0.507
+  10  0.507  0.558  0.609  0.660  0.711  0.762  0.814  0.865  0.916  0.968  1.019
+  20  1.019  1.071  1.122  1.174  1.226  1.277  1.329  1.381  1.433  1.485  1.537
+  30  1.537  1.589  1.641  1.693  1.745  1.797  1.849  1.902  1.954  2.006  2.059
+  40  2.059  2.111  2.164  2.216  2.269  2.322  2.374  2.427  2.480  2.532  2.585
+
+  50  2.585  2.638  2.691  2.744  2.797  2.850  2.903  2.956  3.009  3.062  3.116
+  60  3.116  3.169  3.222  3.275  3.329  3.382  3.436  3.489  3.543  3.596  3.650
+  70  3.650  3.703  3.757  3.810  3.864  3.918  3.971  4.025  4.079  4.133  4.187
+  80  4.187  4.240  4.294  4.348  4.402  4.456  4.510  4.564  4.618  4.672  4.726
+  90  4.726  4.781  4.835  4.889  4.943  4.997  5.052  5.106  5.160  5.215  5.269
+
+ 100  5.269  5.323  5.378  5.432  5.487  5.541  5.595  5.650  5.705  5.759  5.814
+ 110  5.814  5.868  5.923  5.977  6.032  6.087  6.141  6.196  6.251  6.306  6.360
+ 120  6.360  6.415  6.470  6.525  6.579  6.634  6.689  6.744  6.799  6.854  6.909
+ 130  6.909  6.964  7.019  7.074  7.129  7.184  7.239  7.294  7.349  7.404  7.459
+ 140  7.459  7.514  7.569  7.624  7.679  7.734  7.789  7.844  7.900  7.955  8.010
+
+ 150  8.010  8.065  8.120  8.175  8.231  8.286  8.341  8.396  8.452  8.507  8.562
+ 160  8.562  8.618  8.673  8.728  8.783  8.839  8.894  8.949  9.005  9.060  9.115
+ 170  9.115  9.171  9.226  9.282  9.337  9.392  9.448  9.503  9.559  9.614  9.669
+ 180  9.669  9.725  9.780  9.836  9.891  9.947 10.002 10.057 10.113 10.168 10.224
+ 190 10.224 10.279 10.335 10.390 10.446 10.501 10.557 10.612 10.668 10.723 10.779
+
+ 200 10.779 10.834 10.890 10.945 11.001 11.056 11.112 11.167 11.223 11.278 11.334
+ 210 11.334 11.389 11.445 11.501 11.556 11.612 11.667 11.723 11.778 11.834 11.889
+ 220 11.889 11.945 12.000 12.056 12.111 12.167 12.222 12.278 12.334 12.389 12.445
+ 230 12.445 12.500 12.556 12.611 12.667 12.722 12.778 12.833 12.889 12.944 13.000
+ 240 13.000 13.056 13.111 13.167 13.222 13.278 13.333 13.389 13.444 13.500 13.555
+
+ 250 13.555 13.611 13.666 13.722 13.777 13.833 13.888 13.944 13.999 14.055 14.110
+ 260 14.110 14.166 14.221 14.277 14.332 14.388 14.443 14.499 14.554 14.609 14.665
+ 270 14.665 14.720 14.776 14.831 14.887 14.942 14.998 15.053 15.109 15.164 15.219
+ 280 15.219 15.275 15.330 15.386 15.441 15.496 15.552 15.607 15.663 15.718 15.773
+ 290 15.773 15.829 15.884 15.940 15.995 16.050 16.106 16.161 16.216 16.272 16.327
+
+ 300 16.327 16.383 16.438 16.493 16.549 16.604 16.659 16.715 16.770 16.825 16.881
+ 310 16.881 16.936 16.991 17.046 17.102 17.157 17.212 17.268 17.323 17.378 17.434
+ 320 17.434 17.489 17.544 17.599 17.655 17.710 17.765 17.820 17.876 17.931 17.986
+ 330 17.986 18.041 18.097 18.152 18.207 18.262 18.318 18.373 18.428 18.483 18.538
+ 340 18.538 18.594 18.649 18.704 18.759 18.814 18.870 18.925 18.980 19.035 19.090
+
+ 350 19.090 19.146 19.201 19.256 19.311 19.366 19.422 19.477 19.532 19.587 19.642
+ 360 19.642 19.697 19.753 19.808 19.863 19.918 19.973 20.028 20.083 20.139 20.194
+ 370 20.194 20.249 20.304 20.359 20.414 20.469 20.525 20.580 20.635 20.690 20.745
+ 380 20.745 20.800 20.855 20.911 20.966 21.021 21.076 21.131 21.186 21.241 21.297
+ 390 21.297 21.352 21.407 21.462 21.517 21.572 21.627 21.683 21.738 21.793 21.848
+
+ 400 21.848 21.903 21.958 22.014 22.069 22.124 22.179 22.234 22.289 22.345 22.400
+ 410 22.400 22.455 22.510 22.565 22.620 22.676 22.731 22.786 22.841 22.896 22.952
+ 420 22.952 23.007 23.062 23.117 23.172 23.228 23.283 23.338 23.393 23.449 23.504
+ 430 23.504 23.559 23.614 23.670 23.725 23.780 23.835 23.891 23.946 24.001 24.057
+ 440 24.057 24.112 24.167 24.223 24.278 24.333 24.389 24.444 24.499 24.555 24.610
+
+ 450 24.610 24.665 24.721 24.776 24.832 24.887 24.943 24.998 25.053 25.109 25.164
+ 460 25.164 25.220 25.275 25.331 25.386 25.442 25.497 25.553 25.608 25.664 25.720
+ 470 25.720 25.775 25.831 25.886 25.942 25.998 26.053 26.109 26.165 26.220 26.276
+ 480 26.276 26.332 26.387 26.443 26.499 26.555 26.610 26.666 26.722 26.778 26.834
+ 490 26.834 26.889 26.945 27.001 27.057 27.113 27.169 27.225 27.281 27.337 27.393
+
+ 500 27.393 27.449 27.505 27.561 27.617 27.673 27.729 27.785 27.841 27.897 27.953
+ 510 27.953 28.010 28.066 28.122 28.178 28.234 28.291 28.347 28.403 28.460 28.516
+ 520 28.516 28.572 28.629 28.685 28.741 28.798 28.854 28.911 28.967 29.024 29.080
+ 530 29.080 29.137 29.194 29.250 29.307 29.363 29.420 29.477 29.534 29.590 29.647
+ 540 29.647 29.704 29.761 29.818 29.874 29.931 29.988 30.045 30.102 30.159 30.216
+
+ 550 30.216 30.273 30.330 30.387 30.444 30.502 30.559 30.616 30.673 30.730 30.788
+ 560 30.788 30.845 30.902 30.960 31.017 31.074 31.132 31.189 31.247 31.304 31.362
+ 570 31.362 31.419 31.477 31.535 31.592 31.650 31.708 31.766 31.823 31.881 31.939
+ 580 31.939 31.997 32.055 32.113 32.171 32.229 32.287 32.345 32.403 32.461 32.519
+ 590 32.519 32.577 32.636 32.694 32.752 32.810 32.869 32.927 32.985 33.044 33.102
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+  ITS-90 Table for type J thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+ 600 33.102 33.161 33.219 33.278 33.337 33.395 33.454 33.513 33.571 33.630 33.689
+ 610 33.689 33.748 33.807 33.866 33.925 33.984 34.043 34.102 34.161 34.220 34.279
+ 620 34.279 34.338 34.397 34.457 34.516 34.575 34.635 34.694 34.754 34.813 34.873
+ 630 34.873 34.932 34.992 35.051 35.111 35.171 35.230 35.290 35.350 35.410 35.470
+ 640 35.470 35.530 35.590 35.650 35.710 35.770 35.830 35.890 35.950 36.010 36.071
+
+ 650 36.071 36.131 36.191 36.252 36.312 36.373 36.433 36.494 36.554 36.615 36.675
+ 660 36.675 36.736 36.797 36.858 36.918 36.979 37.040 37.101 37.162 37.223 37.284
+ 670 37.284 37.345 37.406 37.467 37.528 37.590 37.651 37.712 37.773 37.835 37.896
+ 680 37.896 37.958 38.019 38.081 38.142 38.204 38.265 38.327 38.389 38.450 38.512
+ 690 38.512 38.574 38.636 38.698 38.760 38.822 38.884 38.946 39.008 39.070 39.132
+
+ 700 39.132 39.194 39.256 39.318 39.381 39.443 39.505 39.568 39.630 39.693 39.755
+ 710 39.755 39.818 39.880 39.943 40.005 40.068 40.131 40.193 40.256 40.319 40.382
+ 720 40.382 40.445 40.508 40.570 40.633 40.696 40.759 40.822 40.886 40.949 41.012
+ 730 41.012 41.075 41.138 41.201 41.265 41.328 41.391 41.455 41.518 41.581 41.645
+ 740 41.645 41.708 41.772 41.835 41.899 41.962 42.026 42.090 42.153 42.217 42.281
+
+ 750 42.281 42.344 42.408 42.472 42.536 42.599 42.663 42.727 42.791 42.855 42.919
+ 760 42.919 42.983 43.047 43.111 43.175 43.239 43.303 43.367 43.431 43.495 43.559
+ 770 43.559 43.624 43.688 43.752 43.817 43.881 43.945 44.010 44.074 44.139 44.203
+ 780 44.203 44.267 44.332 44.396 44.461 44.525 44.590 44.655 44.719 44.784 44.848
+ 790 44.848 44.913 44.977 45.042 45.107 45.171 45.236 45.301 45.365 45.430 45.494
+
+ 800 45.494 45.559 45.624 45.688 45.753 45.818 45.882 45.947 46.011 46.076 46.141
+ 810 46.141 46.205 46.270 46.334 46.399 46.464 46.528 46.593 46.657 46.722 46.786
+ 820 46.786 46.851 46.915 46.980 47.044 47.109 47.173 47.238 47.302 47.367 47.431
+ 830 47.431 47.495 47.560 47.624 47.688 47.753 47.817 47.881 47.946 48.010 48.074
+ 840 48.074 48.138 48.202 48.267 48.331 48.395 48.459 48.523 48.587 48.651 48.715
+
+ 850 48.715 48.779 48.843 48.907 48.971 49.034 49.098 49.162 49.226 49.290 49.353
+ 860 49.353 49.417 49.481 49.544 49.608 49.672 49.735 49.799 49.862 49.926 49.989
+ 870 49.989 50.052 50.116 50.179 50.243 50.306 50.369 50.432 50.495 50.559 50.622
+ 880 50.622 50.685 50.748 50.811 50.874 50.937 51.000 51.063 51.126 51.188 51.251
+ 890 51.251 51.314 51.377 51.439 51.502 51.565 51.627 51.690 51.752 51.815 51.877
+
+ 900 51.877 51.940 52.002 52.064 52.127 52.189 52.251 52.314 52.376 52.438 52.500
+ 910 52.500 52.562 52.624 52.686 52.748 52.810 52.872 52.934 52.996 53.057 53.119
+ 920 53.119 53.181 53.243 53.304 53.366 53.427 53.489 53.550 53.612 53.673 53.735
+ 930 53.735 53.796 53.857 53.919 53.980 54.041 54.102 54.164 54.225 54.286 54.347
+ 940 54.347 54.408 54.469 54.530 54.591 54.652 54.713 54.773 54.834 54.895 54.956
+
+ 950 54.956 55.016 55.077 55.138 55.198 55.259 55.319 55.380 55.440 55.501 55.561
+ 960 55.561 55.622 55.682 55.742 55.803 55.863 55.923 55.983 56.043 56.104 56.164
+ 970 56.164 56.224 56.284 56.344 56.404 56.464 56.524 56.584 56.643 56.703 56.763
+ 980 56.763 56.823 56.883 56.942 57.002 57.062 57.121 57.181 57.240 57.300 57.360
+ 990 57.360 57.419 57.479 57.538 57.597 57.657 57.716 57.776 57.835 57.894 57.953
+
+1000 57.953 58.013 58.072 58.131 58.190 58.249 58.309 58.368 58.427 58.486 58.545
+1010 58.545 58.604 58.663 58.722 58.781 58.840 58.899 58.957 59.016 59.075 59.134
+1020 59.134 59.193 59.252 59.310 59.369 59.428 59.487 59.545 59.604 59.663 59.721
+1030 59.721 59.780 59.838 59.897 59.956 60.014 60.073 60.131 60.190 60.248 60.307
+1040 60.307 60.365 60.423 60.482 60.540 60.599 60.657 60.715 60.774 60.832 60.890
+
+1050 60.890 60.949 61.007 61.065 61.123 61.182 61.240 61.298 61.356 61.415 61.473
+1060 61.473 61.531 61.589 61.647 61.705 61.763 61.822 61.880 61.938 61.996 62.054
+1070 62.054 62.112 62.170 62.228 62.286 62.344 62.402 62.460 62.518 62.576 62.634
+1080 62.634 62.692 62.750 62.808 62.866 62.924 62.982 63.040 63.098 63.156 63.214
+1090 63.214 63.271 63.329 63.387 63.445 63.503 63.561 63.619 63.677 63.734 63.792
+
+1100 63.792 63.850 63.908 63.966 64.024 64.081 64.139 64.197 64.255 64.313 64.370
+1110 64.370 64.428 64.486 64.544 64.602 64.659 64.717 64.775 64.833 64.890 64.948
+1120 64.948 65.006 65.064 65.121 65.179 65.237 65.295 65.352 65.410 65.468 65.525
+1130 65.525 65.583 65.641 65.699 65.756 65.814 65.872 65.929 65.987 66.045 66.102
+1140 66.102 66.160 66.218 66.275 66.333 66.391 66.448 66.506 66.564 66.621 66.679
+
+1150 66.679 66.737 66.794 66.852 66.910 66.967 67.025 67.082 67.140 67.198 67.255
+1160 67.255 67.313 67.370 67.428 67.486 67.543 67.601 67.658 67.716 67.773 67.831
+1170 67.831 67.888 67.946 68.003 68.061 68.119 68.176 68.234 68.291 68.348 68.406
+1180 68.406 68.463 68.521 68.578 68.636 68.693 68.751 68.808 68.865 68.923 68.980
+1190 68.980 69.037 69.095 69.152 69.209 69.267 69.324 69.381 69.439 69.496 69.553
+
+1200 69.553
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+
+
+************************************
+* This section contains coefficients for type J thermocouples for
+* the two subranges of temperature listed below.  The coefficients
+* are in units of °C and mV and are listed in the order of constant
+* term up to the highest order.  The equation is of the form
+* E = sum(i=0 to n) c_i t^i.
+*
+*     Temperature Range (°C)
+*        -210.000 to 760.000
+*         760.000 to 1200.000
+************************************
+name: reference function on ITS-90
+type: J
+temperature units: °C
+emf units: mV
+range:  -210.000,    760.000,  8
+ 0.000000000000E+00
+ 0.503811878150E-01
+ 0.304758369300E-04
+-0.856810657200E-07
+ 0.132281952950E-09
+-0.170529583370E-12
+ 0.209480906970E-15
+-0.125383953360E-18
+ 0.156317256970E-22
+range:   760.000,   1200.000,  5
+ 0.296456256810E+03
+-0.149761277860E+01
+ 0.317871039240E-02
+-0.318476867010E-05
+ 0.157208190040E-08
+-0.306913690560E-12
+
+
+
+************************************
+* This section contains coefficients of approximate inverse
+* functions for type J thermocouples for the subranges of
+* temperature and voltage listed below. The range of errors of
+* the approximate inverse function for each subrange is also given.
+* The coefficients are in units of °C and mV and are listed in
+* the order of constant term up to the highest order.
+* The equation is of the form t_90 = d_0 + d_1*E + d_2*E^2 + ...
+*     + d_n*E^n,
+* where E is in mV and t_90 is in °C.
+*
+*    Temperature        Voltage            Error
+*      range              range            range
+*      (°C)               (mV)             (° C)
+*    -210. to 0.      -8.095 to 0.000    -0.05 to 0.03
+*     0. to 760.       0.000 to 42.919   -0.04 to 0.04
+*     760. to 1200     42.919 to 69.553  -0.04 to 0.03
+********************************************************
+Inverse coefficients for type J:
+
+Temperature  -210.             0.           760.
+  Range:        0.           760.          1200.
+
+  Voltage   -8.095          0.000         42.919
+  Range:     0.000         42.919         69.553
+
+         0.0000000E+00  0.000000E+00 -3.11358187E+03
+         1.9528268E+01  1.978425E+01  3.00543684E+02
+        -1.2286185E+00 -2.001204E-01 -9.94773230E+00
+        -1.0752178E+00  1.036969E-02  1.70276630E-01
+        -5.9086933E-01 -2.549687E-04 -1.43033468E-03
+        -1.7256713E-01  3.585153E-06  4.73886084E-06
+        -2.8131513E-02 -5.344285E-08  0.00000000E+00
+        -2.3963370E-03  5.099890E-10  0.00000000E+00
+        -8.3823321E-05  0.000000E+00  0.00000000E+00
+
+  Error      -0.05          -0.04          -0.04
+  Range:      0.03           0.04           0.03
+
+
+
+ ITS-90 Table for type K thermocouple
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+                               Thermoelectric Voltage in mV
+
+-270 -6.458
+-260 -6.441 -6.444 -6.446 -6.448 -6.450 -6.452 -6.453 -6.455 -6.456 -6.457 -6.458
+-250 -6.404 -6.408 -6.413 -6.417 -6.421 -6.425 -6.429 -6.432 -6.435 -6.438 -6.441
+
+-240 -6.344 -6.351 -6.358 -6.364 -6.370 -6.377 -6.382 -6.388 -6.393 -6.399 -6.404
+-230 -6.262 -6.271 -6.280 -6.289 -6.297 -6.306 -6.314 -6.322 -6.329 -6.337 -6.344
+-220 -6.158 -6.170 -6.181 -6.192 -6.202 -6.213 -6.223 -6.233 -6.243 -6.252 -6.262
+-210 -6.035 -6.048 -6.061 -6.074 -6.087 -6.099 -6.111 -6.123 -6.135 -6.147 -6.158
+-200 -5.891 -5.907 -5.922 -5.936 -5.951 -5.965 -5.980 -5.994 -6.007 -6.021 -6.035
+
+-190 -5.730 -5.747 -5.763 -5.780 -5.797 -5.813 -5.829 -5.845 -5.861 -5.876 -5.891
+-180 -5.550 -5.569 -5.588 -5.606 -5.624 -5.642 -5.660 -5.678 -5.695 -5.713 -5.730
+-170 -5.354 -5.374 -5.395 -5.415 -5.435 -5.454 -5.474 -5.493 -5.512 -5.531 -5.550
+-160 -5.141 -5.163 -5.185 -5.207 -5.228 -5.250 -5.271 -5.292 -5.313 -5.333 -5.354
+-150 -4.913 -4.936 -4.960 -4.983 -5.006 -5.029 -5.052 -5.074 -5.097 -5.119 -5.141
+
+-140 -4.669 -4.694 -4.719 -4.744 -4.768 -4.793 -4.817 -4.841 -4.865 -4.889 -4.913
+-130 -4.411 -4.437 -4.463 -4.490 -4.516 -4.542 -4.567 -4.593 -4.618 -4.644 -4.669
+-120 -4.138 -4.166 -4.194 -4.221 -4.249 -4.276 -4.303 -4.330 -4.357 -4.384 -4.411
+-110 -3.852 -3.882 -3.911 -3.939 -3.968 -3.997 -4.025 -4.054 -4.082 -4.110 -4.138
+-100 -3.554 -3.584 -3.614 -3.645 -3.675 -3.705 -3.734 -3.764 -3.794 -3.823 -3.852
+
+ -90 -3.243 -3.274 -3.306 -3.337 -3.368 -3.400 -3.431 -3.462 -3.492 -3.523 -3.554
+ -80 -2.920 -2.953 -2.986 -3.018 -3.050 -3.083 -3.115 -3.147 -3.179 -3.211 -3.243
+ -70 -2.587 -2.620 -2.654 -2.688 -2.721 -2.755 -2.788 -2.821 -2.854 -2.887 -2.920
+ -60 -2.243 -2.278 -2.312 -2.347 -2.382 -2.416 -2.450 -2.485 -2.519 -2.553 -2.587
+ -50 -1.889 -1.925 -1.961 -1.996 -2.032 -2.067 -2.103 -2.138 -2.173 -2.208 -2.243
+
+ -40 -1.527 -1.564 -1.600 -1.637 -1.673 -1.709 -1.745 -1.782 -1.818 -1.854 -1.889
+ -30 -1.156 -1.194 -1.231 -1.268 -1.305 -1.343 -1.380 -1.417 -1.453 -1.490 -1.527
+ -20 -0.778 -0.816 -0.854 -0.892 -0.930 -0.968 -1.006 -1.043 -1.081 -1.119 -1.156
+ -10 -0.392 -0.431 -0.470 -0.508 -0.547 -0.586 -0.624 -0.663 -0.701 -0.739 -0.778
+   0  0.000 -0.039 -0.079 -0.118 -0.157 -0.197 -0.236 -0.275 -0.314 -0.353 -0.392
+
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+
+ ITS-90 Table for type K thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+					 Thermoelectric Voltage in mV
+
+   0  0.000  0.039  0.079  0.119  0.158  0.198  0.238  0.277  0.317  0.357  0.397
+  10  0.397  0.437  0.477  0.517  0.557  0.597  0.637  0.677  0.718  0.758  0.798
+  20  0.798  0.838  0.879  0.919  0.960  1.000  1.041  1.081  1.122  1.163  1.203
+  30  1.203  1.244  1.285  1.326  1.366  1.407  1.448  1.489  1.530  1.571  1.612
+  40  1.612  1.653  1.694  1.735  1.776  1.817  1.858  1.899  1.941  1.982  2.023
+
+  50  2.023  2.064  2.106  2.147  2.188  2.230  2.271  2.312  2.354  2.395  2.436
+  60  2.436  2.478  2.519  2.561  2.602  2.644  2.685  2.727  2.768  2.810  2.851
+  70  2.851  2.893  2.934  2.976  3.017  3.059  3.100  3.142  3.184  3.225  3.267
+  80  3.267  3.308  3.350  3.391  3.433  3.474  3.516  3.557  3.599  3.640  3.682
+  90  3.682  3.723  3.765  3.806  3.848  3.889  3.931  3.972  4.013  4.055  4.096
+
+ 100  4.096  4.138  4.179  4.220  4.262  4.303  4.344  4.385  4.427  4.468  4.509
+ 110  4.509  4.550  4.591  4.633  4.674  4.715  4.756  4.797  4.838  4.879  4.920
+ 120  4.920  4.961  5.002  5.043  5.084  5.124  5.165  5.206  5.247  5.288  5.328
+ 130  5.328  5.369  5.410  5.450  5.491  5.532  5.572  5.613  5.653  5.694  5.735
+ 140  5.735  5.775  5.815  5.856  5.896  5.937  5.977  6.017  6.058  6.098  6.138
+
+ 150  6.138  6.179  6.219  6.259  6.299  6.339  6.380  6.420  6.460  6.500  6.540
+ 160  6.540  6.580  6.620  6.660  6.701  6.741  6.781  6.821  6.861  6.901  6.941
+ 170  6.941  6.981  7.021  7.060  7.100  7.140  7.180  7.220  7.260  7.300  7.340
+ 180  7.340  7.380  7.420  7.460  7.500  7.540  7.579  7.619  7.659  7.699  7.739
+ 190  7.739  7.779  7.819  7.859  7.899  7.939  7.979  8.019  8.059  8.099  8.138
+
+ 200  8.138  8.178  8.218  8.258  8.298  8.338  8.378  8.418  8.458  8.499  8.539
+ 210  8.539  8.579  8.619  8.659  8.699  8.739  8.779  8.819  8.860  8.900  8.940
+ 220  8.940  8.980  9.020  9.061  9.101  9.141  9.181  9.222  9.262  9.302  9.343
+ 230  9.343  9.383  9.423  9.464  9.504  9.545  9.585  9.626  9.666  9.707  9.747
+ 240  9.747  9.788  9.828  9.869  9.909  9.950  9.991 10.031 10.072 10.113 10.153
+
+ 250 10.153 10.194 10.235 10.276 10.316 10.357 10.398 10.439 10.480 10.520 10.561
+ 260 10.561 10.602 10.643 10.684 10.725 10.766 10.807 10.848 10.889 10.930 10.971
+ 270 10.971 11.012 11.053 11.094 11.135 11.176 11.217 11.259 11.300 11.341 11.382
+ 280 11.382 11.423 11.465 11.506 11.547 11.588 11.630 11.671 11.712 11.753 11.795
+ 290 11.795 11.836 11.877 11.919 11.960 12.001 12.043 12.084 12.126 12.167 12.209
+
+ 300 12.209 12.250 12.291 12.333 12.374 12.416 12.457 12.499 12.540 12.582 12.624
+ 310 12.624 12.665 12.707 12.748 12.790 12.831 12.873 12.915 12.956 12.998 13.040
+ 320 13.040 13.081 13.123 13.165 13.206 13.248 13.290 13.331 13.373 13.415 13.457
+ 330 13.457 13.498 13.540 13.582 13.624 13.665 13.707 13.749 13.791 13.833 13.874
+ 340 13.874 13.916 13.958 14.000 14.042 14.084 14.126 14.167 14.209 14.251 14.293
+
+ 350 14.293 14.335 14.377 14.419 14.461 14.503 14.545 14.587 14.629 14.671 14.713
+ 360 14.713 14.755 14.797 14.839 14.881 14.923 14.965 15.007 15.049 15.091 15.133
+ 370 15.133 15.175 15.217 15.259 15.301 15.343 15.385 15.427 15.469 15.511 15.554
+ 380 15.554 15.596 15.638 15.680 15.722 15.764 15.806 15.849 15.891 15.933 15.975
+ 390 15.975 16.017 16.059 16.102 16.144 16.186 16.228 16.270 16.313 16.355 16.397
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+ ITS-90 Table for type K thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+					 Thermoelectric Voltage in mV
+
+ 400 16.397 16.439 16.482 16.524 16.566 16.608 16.651 16.693 16.735 16.778 16.820
+ 410 16.820 16.862 16.904 16.947 16.989 17.031 17.074 17.116 17.158 17.201 17.243
+ 420 17.243 17.285 17.328 17.370 17.413 17.455 17.497 17.540 17.582 17.624 17.667
+ 430 17.667 17.709 17.752 17.794 17.837 17.879 17.921 17.964 18.006 18.049 18.091
+ 440 18.091 18.134 18.176 18.218 18.261 18.303 18.346 18.388 18.431 18.473 18.516
+
+ 450 18.516 18.558 18.601 18.643 18.686 18.728 18.771 18.813 18.856 18.898 18.941
+ 460 18.941 18.983 19.026 19.068 19.111 19.154 19.196 19.239 19.281 19.324 19.366
+ 470 19.366 19.409 19.451 19.494 19.537 19.579 19.622 19.664 19.707 19.750 19.792
+ 480 19.792 19.835 19.877 19.920 19.962 20.005 20.048 20.090 20.133 20.175 20.218
+ 490 20.218 20.261 20.303 20.346 20.389 20.431 20.474 20.516 20.559 20.602 20.644
+
+ 500 20.644 20.687 20.730 20.772 20.815 20.857 20.900 20.943 20.985 21.028 21.071
+ 510 21.071 21.113 21.156 21.199 21.241 21.284 21.326 21.369 21.412 21.454 21.497
+ 520 21.497 21.540 21.582 21.625 21.668 21.710 21.753 21.796 21.838 21.881 21.924
+ 530 21.924 21.966 22.009 22.052 22.094 22.137 22.179 22.222 22.265 22.307 22.350
+ 540 22.350 22.393 22.435 22.478 22.521 22.563 22.606 22.649 22.691 22.734 22.776
+
+ 550 22.776 22.819 22.862 22.904 22.947 22.990 23.032 23.075 23.117 23.160 23.203
+ 560 23.203 23.245 23.288 23.331 23.373 23.416 23.458 23.501 23.544 23.586 23.629
+ 570 23.629 23.671 23.714 23.757 23.799 23.842 23.884 23.927 23.970 24.012 24.055
+ 580 24.055 24.097 24.140 24.182 24.225 24.267 24.310 24.353 24.395 24.438 24.480
+ 590 24.480 24.523 24.565 24.608 24.650 24.693 24.735 24.778 24.820 24.863 24.905
+
+ 600 24.905 24.948 24.990 25.033 25.075 25.118 25.160 25.203 25.245 25.288 25.330
+ 610 25.330 25.373 25.415 25.458 25.500 25.543 25.585 25.627 25.670 25.712 25.755
+ 620 25.755 25.797 25.840 25.882 25.924 25.967 26.009 26.052 26.094 26.136 26.179
+ 630 26.179 26.221 26.263 26.306 26.348 26.390 26.433 26.475 26.517 26.560 26.602
+ 640 26.602 26.644 26.687 26.729 26.771 26.814 26.856 26.898 26.940 26.983 27.025
+
+ 650 27.025 27.067 27.109 27.152 27.194 27.236 27.278 27.320 27.363 27.405 27.447
+ 660 27.447 27.489 27.531 27.574 27.616 27.658 27.700 27.742 27.784 27.826 27.869
+ 670 27.869 27.911 27.953 27.995 28.037 28.079 28.121 28.163 28.205 28.247 28.289
+ 680 28.289 28.332 28.374 28.416 28.458 28.500 28.542 28.584 28.626 28.668 28.710
+ 690 28.710 28.752 28.794 28.835 28.877 28.919 28.961 29.003 29.045 29.087 29.129
+
+ 700 29.129 29.171 29.213 29.255 29.297 29.338 29.380 29.422 29.464 29.506 29.548
+ 710 29.548 29.589 29.631 29.673 29.715 29.757 29.798 29.840 29.882 29.924 29.965
+ 720 29.965 30.007 30.049 30.090 30.132 30.174 30.216 30.257 30.299 30.341 30.382
+ 730 30.382 30.424 30.466 30.507 30.549 30.590 30.632 30.674 30.715 30.757 30.798
+ 740 30.798 30.840 30.881 30.923 30.964 31.006 31.047 31.089 31.130 31.172 31.213
+
+ 750 31.213 31.255 31.296 31.338 31.379 31.421 31.462 31.504 31.545 31.586 31.628
+ 760 31.628 31.669 31.710 31.752 31.793 31.834 31.876 31.917 31.958 32.000 32.041
+ 770 32.041 32.082 32.124 32.165 32.206 32.247 32.289 32.330 32.371 32.412 32.453
+ 780 32.453 32.495 32.536 32.577 32.618 32.659 32.700 32.742 32.783 32.824 32.865
+ 790 32.865 32.906 32.947 32.988 33.029 33.070 33.111 33.152 33.193 33.234 33.275
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+ ITS-90 Table for type K thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+					 Thermoelectric Voltage in mV
+
+ 800 33.275 33.316 33.357 33.398 33.439 33.480 33.521 33.562 33.603 33.644 33.685
+ 810 33.685 33.726 33.767 33.808 33.848 33.889 33.930 33.971 34.012 34.053 34.093
+ 820 34.093 34.134 34.175 34.216 34.257 34.297 34.338 34.379 34.420 34.460 34.501
+ 830 34.501 34.542 34.582 34.623 34.664 34.704 34.745 34.786 34.826 34.867 34.908
+ 840 34.908 34.948 34.989 35.029 35.070 35.110 35.151 35.192 35.232 35.273 35.313
+
+ 850 35.313 35.354 35.394 35.435 35.475 35.516 35.556 35.596 35.637 35.677 35.718
+ 860 35.718 35.758 35.798 35.839 35.879 35.920 35.960 36.000 36.041 36.081 36.121
+ 870 36.121 36.162 36.202 36.242 36.282 36.323 36.363 36.403 36.443 36.484 36.524
+ 880 36.524 36.564 36.604 36.644 36.685 36.725 36.765 36.805 36.845 36.885 36.925
+ 890 36.925 36.965 37.006 37.046 37.086 37.126 37.166 37.206 37.246 37.286 37.326
+
+ 900 37.326 37.366 37.406 37.446 37.486 37.526 37.566 37.606 37.646 37.686 37.725
+ 910 37.725 37.765 37.805 37.845 37.885 37.925 37.965 38.005 38.044 38.084 38.124
+ 920 38.124 38.164 38.204 38.243 38.283 38.323 38.363 38.402 38.442 38.482 38.522
+ 930 38.522 38.561 38.601 38.641 38.680 38.720 38.760 38.799 38.839 38.878 38.918
+ 940 38.918 38.958 38.997 39.037 39.076 39.116 39.155 39.195 39.235 39.274 39.314
+
+ 950 39.314 39.353 39.393 39.432 39.471 39.511 39.550 39.590 39.629 39.669 39.708
+ 960 39.708 39.747 39.787 39.826 39.866 39.905 39.944 39.984 40.023 40.062 40.101
+ 970 40.101 40.141 40.180 40.219 40.259 40.298 40.337 40.376 40.415 40.455 40.494
+ 980 40.494 40.533 40.572 40.611 40.651 40.690 40.729 40.768 40.807 40.846 40.885
+ 990 40.885 40.924 40.963 41.002 41.042 41.081 41.120 41.159 41.198 41.237 41.276
+
+1000 41.276 41.315 41.354 41.393 41.431 41.470 41.509 41.548 41.587 41.626 41.665
+1010 41.665 41.704 41.743 41.781 41.820 41.859 41.898 41.937 41.976 42.014 42.053
+1020 42.053 42.092 42.131 42.169 42.208 42.247 42.286 42.324 42.363 42.402 42.440
+1030 42.440 42.479 42.518 42.556 42.595 42.633 42.672 42.711 42.749 42.788 42.826
+1040 42.826 42.865 42.903 42.942 42.980 43.019 43.057 43.096 43.134 43.173 43.211
+
+1050 43.211 43.250 43.288 43.327 43.365 43.403 43.442 43.480 43.518 43.557 43.595
+1060 43.595 43.633 43.672 43.710 43.748 43.787 43.825 43.863 43.901 43.940 43.978
+1070 43.978 44.016 44.054 44.092 44.130 44.169 44.207 44.245 44.283 44.321 44.359
+1080 44.359 44.397 44.435 44.473 44.512 44.550 44.588 44.626 44.664 44.702 44.740
+1090 44.740 44.778 44.816 44.853 44.891 44.929 44.967 45.005 45.043 45.081 45.119
+
+1100 45.119 45.157 45.194 45.232 45.270 45.308 45.346 45.383 45.421 45.459 45.497
+1110 45.497 45.534 45.572 45.610 45.647 45.685 45.723 45.760 45.798 45.836 45.873
+1120 45.873 45.911 45.948 45.986 46.024 46.061 46.099 46.136 46.174 46.211 46.249
+1130 46.249 46.286 46.324 46.361 46.398 46.436 46.473 46.511 46.548 46.585 46.623
+1140 46.623 46.660 46.697 46.735 46.772 46.809 46.847 46.884 46.921 46.958 46.995
+
+1150 46.995 47.033 47.070 47.107 47.144 47.181 47.218 47.256 47.293 47.330 47.367
+1160 47.367 47.404 47.441 47.478 47.515 47.552 47.589 47.626 47.663 47.700 47.737
+1170 47.737 47.774 47.811 47.848 47.884 47.921 47.958 47.995 48.032 48.069 48.105
+1180 48.105 48.142 48.179 48.216 48.252 48.289 48.326 48.363 48.399 48.436 48.473
+1190 48.473 48.509 48.546 48.582 48.619 48.656 48.692 48.729 48.765 48.802 48.838
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+ ITS-90 Table for type K thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+					 Thermoelectric Voltage in mV
+
+1200 48.838 48.875 48.911 48.948 48.984 49.021 49.057 49.093 49.130 49.166 49.202
+1210 49.202 49.239 49.275 49.311 49.348 49.384 49.420 49.456 49.493 49.529 49.565
+1220 49.565 49.601 49.637 49.674 49.710 49.746 49.782 49.818 49.854 49.890 49.926
+1230 49.926 49.962 49.998 50.034 50.070 50.106 50.142 50.178 50.214 50.250 50.286
+1240 50.286 50.322 50.358 50.393 50.429 50.465 50.501 50.537 50.572 50.608 50.644
+
+1250 50.644 50.680 50.715 50.751 50.787 50.822 50.858 50.894 50.929 50.965 51.000
+1260 51.000 51.036 51.071 51.107 51.142 51.178 51.213 51.249 51.284 51.320 51.355
+1270 51.355 51.391 51.426 51.461 51.497 51.532 51.567 51.603 51.638 51.673 51.708
+1280 51.708 51.744 51.779 51.814 51.849 51.885 51.920 51.955 51.990 52.025 52.060
+1290 52.060 52.095 52.130 52.165 52.200 52.235 52.270 52.305 52.340 52.375 52.410
+
+1300 52.410 52.445 52.480 52.515 52.550 52.585 52.620 52.654 52.689 52.724 52.759
+1310 52.759 52.794 52.828 52.863 52.898 52.932 52.967 53.002 53.037 53.071 53.106
+1320 53.106 53.140 53.175 53.210 53.244 53.279 53.313 53.348 53.382 53.417 53.451
+1330 53.451 53.486 53.520 53.555 53.589 53.623 53.658 53.692 53.727 53.761 53.795
+1340 53.795 53.830 53.864 53.898 53.932 53.967 54.001 54.035 54.069 54.104 54.138
+
+1350 54.138 54.172 54.206 54.240 54.274 54.308 54.343 54.377 54.411 54.445 54.479
+1360 54.479 54.513 54.547 54.581 54.615 54.649 54.683 54.717 54.751 54.785 54.819
+1370 54.819 54.852 54.886
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+
+
+************************************
+* This section contains coefficients for type K thermocouples for
+* the two subranges of temperature listed below.  The coefficients
+* are in units of °C and mV and are listed in the order of constant
+* term up to the highest order.  The equation below 0 °C is of the form
+* E = sum(i=0 to n) c_i t^i.
+*
+* The equation above 0 °C is of the form
+* E = sum(i=0 to n) c_i t^i + a0 exp(a1 (t - a2)^2).
+*
+*     Temperature Range (°C)
+*        -270.000 to 0.000
+*         0.000 to 1372.000
+************************************
+name: reference function on ITS-90
+type: K
+temperature units: °C
+emf units: mV
+range: -270.000, 0.000, 10
+  0.000000000000E+00
+  0.394501280250E-01
+  0.236223735980E-04
+ -0.328589067840E-06
+ -0.499048287770E-08
+ -0.675090591730E-10
+ -0.574103274280E-12
+ -0.310888728940E-14
+ -0.104516093650E-16
+ -0.198892668780E-19
+ -0.163226974860E-22
+range: 0.000, 1372.000, 9
+ -0.176004136860E-01
+  0.389212049750E-01
+  0.185587700320E-04
+ -0.994575928740E-07
+  0.318409457190E-09
+ -0.560728448890E-12
+  0.560750590590E-15
+ -0.320207200030E-18
+  0.971511471520E-22
+ -0.121047212750E-25
+exponential:
+ a0 =  0.118597600000E+00
+ a1 = -0.118343200000E-03
+ a2 =  0.126968600000E+03
+
+
+
+************************************
+* This section contains coefficients of approximate inverse
+* functions for type K thermocouples for the subranges of
+* temperature and voltage listed below. The range of errors of
+* the approximate inverse function for each subrange is also given.
+* The coefficients are in units of °C and mV and are listed in
+* the order of constant term up to the highest order.
+* The equation is of the form t_90 = d_0 + d_1*E + d_2*E^2 + ...
+*     + d_n*E^n,
+* where E is in mV and t_90 is in °C.
+*
+*    Temperature        Voltage            Error
+*      range              range            range
+*      (°C)               (mV)             (° C)
+*    -200. to 0.      -5.891 to 0.000    -0.02 to 0.04
+*     0. to 500.      0.000 to 20.644    -0.05 to 0.04
+*     500. to 1372.   20.644 to 54.886   -0.05 to 0.06
+********************************************************
+Inverse coefficients for type K:
+
+Temperature  -200.             0.           500.
+  Range:        0.           500.          1372.
+
+  Voltage   -5.891          0.000         20.644
+  Range:     0.000         20.644         54.886
+
+         0.0000000E+00  0.000000E+00 -1.318058E+02
+         2.5173462E+01  2.508355E+01  4.830222E+01
+        -1.1662878E+00  7.860106E-02 -1.646031E+00
+        -1.0833638E+00 -2.503131E-01  5.464731E-02
+        -8.9773540E-01  8.315270E-02 -9.650715E-04
+        -3.7342377E-01 -1.228034E-02  8.802193E-06
+        -8.6632643E-02  9.804036E-04 -3.110810E-08
+        -1.0450598E-02 -4.413030E-05  0.000000E+00
+        -5.1920577E-04  1.057734E-06  0.000000E+00
+         0.0000000E+00 -1.052755E-08  0.000000E+00
+
+  Error      -0.02          -0.05          -0.05
+  Range:      0.04           0.04           0.06
+
+
+
+ ITS-90 Table for type N thermocouple
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+                               Thermoelectric Voltage in mV
+
+-270 -4.345
+-260 -4.336 -4.337 -4.339 -4.340 -4.341 -4.342 -4.343 -4.344 -4.344 -4.345 -4.345
+-250 -4.313 -4.316 -4.319 -4.321 -4.324 -4.326 -4.328 -4.330 -4.332 -4.334 -4.336
+
+-240 -4.277 -4.281 -4.285 -4.289 -4.293 -4.297 -4.300 -4.304 -4.307 -4.310 -4.313
+-230 -4.226 -4.232 -4.238 -4.243 -4.248 -4.254 -4.258 -4.263 -4.268 -4.273 -4.277
+-220 -4.162 -4.169 -4.176 -4.183 -4.189 -4.196 -4.202 -4.209 -4.215 -4.221 -4.226
+-210 -4.083 -4.091 -4.100 -4.108 -4.116 -4.124 -4.132 -4.140 -4.147 -4.154 -4.162
+-200 -3.990 -4.000 -4.010 -4.020 -4.029 -4.038 -4.048 -4.057 -4.066 -4.074 -4.083
+
+-190 -3.884 -3.896 -3.907 -3.918 -3.928 -3.939 -3.950 -3.960 -3.970 -3.980 -3.990
+-180 -3.766 -3.778 -3.790 -3.803 -3.815 -3.827 -3.838 -3.850 -3.862 -3.873 -3.884
+-170 -3.634 -3.648 -3.662 -3.675 -3.688 -3.702 -3.715 -3.728 -3.740 -3.753 -3.766
+-160 -3.491 -3.506 -3.521 -3.535 -3.550 -3.564 -3.578 -3.593 -3.607 -3.621 -3.634
+-150 -3.336 -3.352 -3.368 -3.384 -3.400 -3.415 -3.431 -3.446 -3.461 -3.476 -3.491
+
+-140 -3.171 -3.188 -3.205 -3.221 -3.238 -3.255 -3.271 -3.288 -3.304 -3.320 -3.336
+-130 -2.994 -3.012 -3.030 -3.048 -3.066 -3.084 -3.101 -3.119 -3.136 -3.153 -3.171
+-120 -2.808 -2.827 -2.846 -2.865 -2.883 -2.902 -2.921 -2.939 -2.958 -2.976 -2.994
+-110 -2.612 -2.632 -2.652 -2.672 -2.691 -2.711 -2.730 -2.750 -2.769 -2.789 -2.808
+-100 -2.407 -2.428 -2.448 -2.469 -2.490 -2.510 -2.531 -2.551 -2.571 -2.592 -2.612
+
+ -90 -2.193 -2.215 -2.237 -2.258 -2.280 -2.301 -2.322 -2.344 -2.365 -2.386 -2.407
+ -80 -1.972 -1.995 -2.017 -2.039 -2.062 -2.084 -2.106 -2.128 -2.150 -2.172 -2.193
+ -70 -1.744 -1.767 -1.790 -1.813 -1.836 -1.859 -1.882 -1.905 -1.927 -1.950 -1.972
+ -60 -1.509 -1.533 -1.557 -1.580 -1.604 -1.627 -1.651 -1.674 -1.698 -1.721 -1.744
+ -50 -1.269 -1.293 -1.317 -1.341 -1.366 -1.390 -1.414 -1.438 -1.462 -1.485 -1.509
+
+ -40 -1.023 -1.048 -1.072 -1.097 -1.122 -1.146 -1.171 -1.195 -1.220 -1.244 -1.269
+ -30 -0.772 -0.798 -0.823 -0.848 -0.873 -0.898 -0.923 -0.948 -0.973 -0.998 -1.023
+ -20 -0.518 -0.544 -0.569 -0.595 -0.620 -0.646 -0.671 -0.696 -0.722 -0.747 -0.772
+ -10 -0.260 -0.286 -0.312 -0.338 -0.364 -0.390 -0.415 -0.441 -0.467 -0.492 -0.518
+   0  0.000 -0.026 -0.052 -0.078 -0.104 -0.131 -0.157 -0.183 -0.209 -0.234 -0.260
+
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+
+ ITS-90 Table for type N thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+   0  0.000  0.026  0.052  0.078  0.104  0.130  0.156  0.182  0.208  0.235  0.261
+  10  0.261  0.287  0.313  0.340  0.366  0.393  0.419  0.446  0.472  0.499  0.525
+  20  0.525  0.552  0.578  0.605  0.632  0.659  0.685  0.712  0.739  0.766  0.793
+  30  0.793  0.820  0.847  0.874  0.901  0.928  0.955  0.983  1.010  1.037  1.065
+  40  1.065  1.092  1.119  1.147  1.174  1.202  1.229  1.257  1.284  1.312  1.340
+
+  50  1.340  1.368  1.395  1.423  1.451  1.479  1.507  1.535  1.563  1.591  1.619
+  60  1.619  1.647  1.675  1.703  1.732  1.760  1.788  1.817  1.845  1.873  1.902
+  70  1.902  1.930  1.959  1.988  2.016  2.045  2.074  2.102  2.131  2.160  2.189
+  80  2.189  2.218  2.247  2.276  2.305  2.334  2.363  2.392  2.421  2.450  2.480
+  90  2.480  2.509  2.538  2.568  2.597  2.626  2.656  2.685  2.715  2.744  2.774
+
+ 100  2.774  2.804  2.833  2.863  2.893  2.923  2.953  2.983  3.012  3.042  3.072
+ 110  3.072  3.102  3.133  3.163  3.193  3.223  3.253  3.283  3.314  3.344  3.374
+ 120  3.374  3.405  3.435  3.466  3.496  3.527  3.557  3.588  3.619  3.649  3.680
+ 130  3.680  3.711  3.742  3.772  3.803  3.834  3.865  3.896  3.927  3.958  3.989
+ 140  3.989  4.020  4.051  4.083  4.114  4.145  4.176  4.208  4.239  4.270  4.302
+
+ 150  4.302  4.333  4.365  4.396  4.428  4.459  4.491  4.523  4.554  4.586  4.618
+ 160  4.618  4.650  4.681  4.713  4.745  4.777  4.809  4.841  4.873  4.905  4.937
+ 170  4.937  4.969  5.001  5.033  5.066  5.098  5.130  5.162  5.195  5.227  5.259
+ 180  5.259  5.292  5.324  5.357  5.389  5.422  5.454  5.487  5.520  5.552  5.585
+ 190  5.585  5.618  5.650  5.683  5.716  5.749  5.782  5.815  5.847  5.880  5.913
+
+ 200  5.913  5.946  5.979  6.013  6.046  6.079  6.112  6.145  6.178  6.211  6.245
+ 210  6.245  6.278  6.311  6.345  6.378  6.411  6.445  6.478  6.512  6.545  6.579
+ 220  6.579  6.612  6.646  6.680  6.713  6.747  6.781  6.814  6.848  6.882  6.916
+ 230  6.916  6.949  6.983  7.017  7.051  7.085  7.119  7.153  7.187  7.221  7.255
+ 240  7.255  7.289  7.323  7.357  7.392  7.426  7.460  7.494  7.528  7.563  7.597
+
+ 250  7.597  7.631  7.666  7.700  7.734  7.769  7.803  7.838  7.872  7.907  7.941
+ 260  7.941  7.976  8.010  8.045  8.080  8.114  8.149  8.184  8.218  8.253  8.288
+ 270  8.288  8.323  8.358  8.392  8.427  8.462  8.497  8.532  8.567  8.602  8.637
+ 280  8.637  8.672  8.707  8.742  8.777  8.812  8.847  8.882  8.918  8.953  8.988
+ 290  8.988  9.023  9.058  9.094  9.129  9.164  9.200  9.235  9.270  9.306  9.341
+
+ 300  9.341  9.377  9.412  9.448  9.483  9.519  9.554  9.590  9.625  9.661  9.696
+ 310  9.696  9.732  9.768  9.803  9.839  9.875  9.910  9.946  9.982 10.018 10.054
+ 320 10.054 10.089 10.125 10.161 10.197 10.233 10.269 10.305 10.341 10.377 10.413
+ 330 10.413 10.449 10.485 10.521 10.557 10.593 10.629 10.665 10.701 10.737 10.774
+ 340 10.774 10.810 10.846 10.882 10.918 10.955 10.991 11.027 11.064 11.100 11.136
+
+ 350 11.136 11.173 11.209 11.245 11.282 11.318 11.355 11.391 11.428 11.464 11.501
+ 360 11.501 11.537 11.574 11.610 11.647 11.683 11.720 11.757 11.793 11.830 11.867
+ 370 11.867 11.903 11.940 11.977 12.013 12.050 12.087 12.124 12.160 12.197 12.234
+ 380 12.234 12.271 12.308 12.345 12.382 12.418 12.455 12.492 12.529 12.566 12.603
+ 390 12.603 12.640 12.677 12.714 12.751 12.788 12.825 12.862 12.899 12.937 12.974
+
+ 400 12.974 13.011 13.048 13.085 13.122 13.159 13.197 13.234 13.271 13.308 13.346
+ 410 13.346 13.383 13.420 13.457 13.495 13.532 13.569 13.607 13.644 13.682 13.719
+ 420 13.719 13.756 13.794 13.831 13.869 13.906 13.944 13.981 14.019 14.056 14.094
+ 430 14.094 14.131 14.169 14.206 14.244 14.281 14.319 14.356 14.394 14.432 14.469
+ 440 14.469 14.507 14.545 14.582 14.620 14.658 14.695 14.733 14.771 14.809 14.846
+
+ 450 14.846 14.884 14.922 14.960 14.998 15.035 15.073 15.111 15.149 15.187 15.225
+ 460 15.225 15.262 15.300 15.338 15.376 15.414 15.452 15.490 15.528 15.566 15.604
+ 470 15.604 15.642 15.680 15.718 15.756 15.794 15.832 15.870 15.908 15.946 15.984
+ 480 15.984 16.022 16.060 16.099 16.137 16.175 16.213 16.251 16.289 16.327 16.366
+ 490 16.366 16.404 16.442 16.480 16.518 16.557 16.595 16.633 16.671 16.710 16.748
+
+ 500 16.748 16.786 16.824 16.863 16.901 16.939 16.978 17.016 17.054 17.093 17.131
+ 510 17.131 17.169 17.208 17.246 17.285 17.323 17.361 17.400 17.438 17.477 17.515
+ 520 17.515 17.554 17.592 17.630 17.669 17.707 17.746 17.784 17.823 17.861 17.900
+ 530 17.900 17.938 17.977 18.016 18.054 18.093 18.131 18.170 18.208 18.247 18.286
+ 540 18.286 18.324 18.363 18.401 18.440 18.479 18.517 18.556 18.595 18.633 18.672
+
+ 550 18.672 18.711 18.749 18.788 18.827 18.865 18.904 18.943 18.982 19.020 19.059
+ 560 19.059 19.098 19.136 19.175 19.214 19.253 19.292 19.330 19.369 19.408 19.447
+ 570 19.447 19.485 19.524 19.563 19.602 19.641 19.680 19.718 19.757 19.796 19.835
+ 580 19.835 19.874 19.913 19.952 19.990 20.029 20.068 20.107 20.146 20.185 20.224
+ 590 20.224 20.263 20.302 20.341 20.379 20.418 20.457 20.496 20.535 20.574 20.613
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+ ITS-90 Table for type N thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+ 600 20.613 20.652 20.691 20.730 20.769 20.808 20.847 20.886 20.925 20.964 21.003
+ 610 21.003 21.042 21.081 21.120 21.159 21.198 21.237 21.276 21.315 21.354 21.393
+ 620 21.393 21.432 21.471 21.510 21.549 21.588 21.628 21.667 21.706 21.745 21.784
+ 630 21.784 21.823 21.862 21.901 21.940 21.979 22.018 22.058 22.097 22.136 22.175
+ 640 22.175 22.214 22.253 22.292 22.331 22.370 22.410 22.449 22.488 22.527 22.566
+
+ 650 22.566 22.605 22.644 22.684 22.723 22.762 22.801 22.840 22.879 22.919 22.958
+ 660 22.958 22.997 23.036 23.075 23.115 23.154 23.193 23.232 23.271 23.311 23.350
+ 670 23.350 23.389 23.428 23.467 23.507 23.546 23.585 23.624 23.663 23.703 23.742
+ 680 23.742 23.781 23.820 23.860 23.899 23.938 23.977 24.016 24.056 24.095 24.134
+ 690 24.134 24.173 24.213 24.252 24.291 24.330 24.370 24.409 24.448 24.487 24.527
+
+ 700 24.527 24.566 24.605 24.644 24.684 24.723 24.762 24.801 24.841 24.880 24.919
+ 710 24.919 24.959 24.998 25.037 25.076 25.116 25.155 25.194 25.233 25.273 25.312
+ 720 25.312 25.351 25.391 25.430 25.469 25.508 25.548 25.587 25.626 25.666 25.705
+ 730 25.705 25.744 25.783 25.823 25.862 25.901 25.941 25.980 26.019 26.058 26.098
+ 740 26.098 26.137 26.176 26.216 26.255 26.294 26.333 26.373 26.412 26.451 26.491
+
+ 750 26.491 26.530 26.569 26.608 26.648 26.687 26.726 26.766 26.805 26.844 26.883
+ 760 26.883 26.923 26.962 27.001 27.041 27.080 27.119 27.158 27.198 27.237 27.276
+ 770 27.276 27.316 27.355 27.394 27.433 27.473 27.512 27.551 27.591 27.630 27.669
+ 780 27.669 27.708 27.748 27.787 27.826 27.866 27.905 27.944 27.983 28.023 28.062
+ 790 28.062 28.101 28.140 28.180 28.219 28.258 28.297 28.337 28.376 28.415 28.455
+
+ 800 28.455 28.494 28.533 28.572 28.612 28.651 28.690 28.729 28.769 28.808 28.847
+ 810 28.847 28.886 28.926 28.965 29.004 29.043 29.083 29.122 29.161 29.200 29.239
+ 820 29.239 29.279 29.318 29.357 29.396 29.436 29.475 29.514 29.553 29.592 29.632
+ 830 29.632 29.671 29.710 29.749 29.789 29.828 29.867 29.906 29.945 29.985 30.024
+ 840 30.024 30.063 30.102 30.141 30.181 30.220 30.259 30.298 30.337 30.376 30.416
+
+ 850 30.416 30.455 30.494 30.533 30.572 30.611 30.651 30.690 30.729 30.768 30.807
+ 860 30.807 30.846 30.886 30.925 30.964 31.003 31.042 31.081 31.120 31.160 31.199
+ 870 31.199 31.238 31.277 31.316 31.355 31.394 31.433 31.473 31.512 31.551 31.590
+ 880 31.590 31.629 31.668 31.707 31.746 31.785 31.824 31.863 31.903 31.942 31.981
+ 890 31.981 32.020 32.059 32.098 32.137 32.176 32.215 32.254 32.293 32.332 32.371
+
+ 900 32.371 32.410 32.449 32.488 32.527 32.566 32.605 32.644 32.683 32.722 32.761
+ 910 32.761 32.800 32.839 32.878 32.917 32.956 32.995 33.034 33.073 33.112 33.151
+ 920 33.151 33.190 33.229 33.268 33.307 33.346 33.385 33.424 33.463 33.502 33.541
+ 930 33.541 33.580 33.619 33.658 33.697 33.736 33.774 33.813 33.852 33.891 33.930
+ 940 33.930 33.969 34.008 34.047 34.086 34.124 34.163 34.202 34.241 34.280 34.319
+
+ 950 34.319 34.358 34.396 34.435 34.474 34.513 34.552 34.591 34.629 34.668 34.707
+ 960 34.707 34.746 34.785 34.823 34.862 34.901 34.940 34.979 35.017 35.056 35.095
+ 970 35.095 35.134 35.172 35.211 35.250 35.289 35.327 35.366 35.405 35.444 35.482
+ 980 35.482 35.521 35.560 35.598 35.637 35.676 35.714 35.753 35.792 35.831 35.869
+ 990 35.869 35.908 35.946 35.985 36.024 36.062 36.101 36.140 36.178 36.217 36.256
+
+1000 36.256 36.294 36.333 36.371 36.410 36.449 36.487 36.526 36.564 36.603 36.641
+1010 36.641 36.680 36.718 36.757 36.796 36.834 36.873 36.911 36.950 36.988 37.027
+1020 37.027 37.065 37.104 37.142 37.181 37.219 37.258 37.296 37.334 37.373 37.411
+1030 37.411 37.450 37.488 37.527 37.565 37.603 37.642 37.680 37.719 37.757 37.795
+1040 37.795 37.834 37.872 37.911 37.949 37.987 38.026 38.064 38.102 38.141 38.179
+
+1050 38.179 38.217 38.256 38.294 38.332 38.370 38.409 38.447 38.485 38.524 38.562
+1060 38.562 38.600 38.638 38.677 38.715 38.753 38.791 38.829 38.868 38.906 38.944
+1070 38.944 38.982 39.020 39.059 39.097 39.135 39.173 39.211 39.249 39.287 39.326
+1080 39.326 39.364 39.402 39.440 39.478 39.516 39.554 39.592 39.630 39.668 39.706
+1090 39.706 39.744 39.783 39.821 39.859 39.897 39.935 39.973 40.011 40.049 40.087
+
+1100 40.087 40.125 40.163 40.201 40.238 40.276 40.314 40.352 40.390 40.428 40.466
+1110 40.466 40.504 40.542 40.580 40.618 40.655 40.693 40.731 40.769 40.807 40.845
+1120 40.845 40.883 40.920 40.958 40.996 41.034 41.072 41.109 41.147 41.185 41.223
+1130 41.223 41.260 41.298 41.336 41.374 41.411 41.449 41.487 41.525 41.562 41.600
+1140 41.600 41.638 41.675 41.713 41.751 41.788 41.826 41.864 41.901 41.939 41.976
+
+1150 41.976 42.014 42.052 42.089 42.127 42.164 42.202 42.239 42.277 42.314 42.352
+1160 42.352 42.390 42.427 42.465 42.502 42.540 42.577 42.614 42.652 42.689 42.727
+1170 42.727 42.764 42.802 42.839 42.877 42.914 42.951 42.989 43.026 43.064 43.101
+1180 43.101 43.138 43.176 43.213 43.250 43.288 43.325 43.362 43.399 43.437 43.474
+1190 43.474 43.511 43.549 43.586 43.623 43.660 43.698 43.735 43.772 43.809 43.846
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+ ITS-90 Table for type N thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+1200 43.846 43.884 43.921 43.958 43.995 44.032 44.069 44.106 44.144 44.181 44.218
+1210 44.218 44.255 44.292 44.329 44.366 44.403 44.440 44.477 44.514 44.551 44.588
+1220 44.588 44.625 44.662 44.699 44.736 44.773 44.810 44.847 44.884 44.921 44.958
+1230 44.958 44.995 45.032 45.069 45.105 45.142 45.179 45.216 45.253 45.290 45.326
+1240 45.326 45.363 45.400 45.437 45.474 45.510 45.547 45.584 45.621 45.657 45.694
+
+1250 45.694 45.731 45.767 45.804 45.841 45.877 45.914 45.951 45.987 46.024 46.060
+1260 46.060 46.097 46.133 46.170 46.207 46.243 46.280 46.316 46.353 46.389 46.425
+1270 46.425 46.462 46.498 46.535 46.571 46.608 46.644 46.680 46.717 46.753 46.789
+1280 46.789 46.826 46.862 46.898 46.935 46.971 47.007 47.043 47.079 47.116 47.152
+1290 47.152 47.188 47.224 47.260 47.296 47.333 47.369 47.405 47.441 47.477 47.513
+
+1300 47.513
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+
+
+************************************
+* This section contains coefficients for type N thermocouples for
+* the two subranges of temperature listed below.  The coefficients
+* are in units of °C and mV and are listed in the order of constant
+* term up to the highest order.  The equation is of the form
+* E = sum(i=0 to n) c_i t^i.
+*
+*     Temperature Range (°C)
+*        -270.000 to 0.000
+*         0.000 to 1300.000
+************************************
+name: reference function on ITS-90
+type: N
+temperature units: °C
+emf units: mV
+range:  -270.000,      0.000,  8
+ 0.000000000000E+00
+ 0.261591059620E-01
+ 0.109574842280E-04
+-0.938411115540E-07
+-0.464120397590E-10
+-0.263033577160E-11
+-0.226534380030E-13
+-0.760893007910E-16
+-0.934196678350E-19
+range:     0.000,   1300.000, 10
+ 0.000000000000E+00
+ 0.259293946010E-01
+ 0.157101418800E-04
+ 0.438256272370E-07
+-0.252611697940E-09
+ 0.643118193390E-12
+-0.100634715190E-14
+ 0.997453389920E-18
+-0.608632456070E-21
+ 0.208492293390E-24
+-0.306821961510E-28
+
+
+
+************************************
+* This section contains coefficients of approximate inverse
+* functions for type N thermocouples for the subranges of
+* temperature and voltage listed below. The range of errors of
+* the approximate inverse function for each subrange is also given.
+* The coefficients are in units of °C and mV and are listed in
+* the order of constant term up to the highest order.
+* The equation is of the form t_90 = d_0 + d_1*E + d_2*E^2 + ...
+*     + d_n*E^n,
+* where E is in mV and t_90 is in °C.
+*
+*    Temperature        Voltage            Error
+*      range              range            range
+*      (°C)               (mV)             (° C)
+*    -200. to 0.      -3.990 to 0.000    -0.02 to 0.03
+*     0. to 600.      0.000 to 20.613    -0.02 to 0.03
+*     600. to 1300.   20.613 to 47.513   -0.04 to 0.02
+********************************************************
+Inverse coefficients for type N:
+
+Temperature  -200.             0.           600.
+  Range:        0.           600.          1300.
+
+  Voltage   -3.990          0.000         20.613
+  Range:     0.000         20.613         47.513
+
+         0.0000000E+00  0.00000E+00  1.972485E+01
+         3.8436847E+01  3.86896E+01  3.300943E+01
+         1.1010485E+00 -1.08267E+00 -3.915159E-01
+         5.2229312E+00  4.70205E-02  9.855391E-03
+         7.2060525E+00 -2.12169E-06 -1.274371E-04
+         5.8488586E+00 -1.17272E-04  7.767022E-07
+         2.7754916E+00  5.39280E-06  0.000000E+00
+         7.7075166E-01 -7.98156E-08  0.000000E+00
+         1.1582665E-01  0.00000E+00  0.000000E+00
+         7.3138868E-03  0.00000E+00  0.000000E+00
+
+  Error      -0.02          -0.02          -0.04
+  Range:      0.03           0.03           0.02
+
+
+
+ ITS-90 Table for type R thermocouple
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+                               Thermoelectric Voltage in mV
+
+ -50 -0.226
+ -40 -0.188 -0.192 -0.196 -0.200 -0.204 -0.208 -0.211 -0.215 -0.219 -0.223 -0.226
+ -30 -0.145 -0.150 -0.154 -0.158 -0.163 -0.167 -0.171 -0.175 -0.180 -0.184 -0.188
+ -20 -0.100 -0.105 -0.109 -0.114 -0.119 -0.123 -0.128 -0.132 -0.137 -0.141 -0.145
+ -10 -0.051 -0.056 -0.061 -0.066 -0.071 -0.076 -0.081 -0.086 -0.091 -0.095 -0.100
+   0  0.000 -0.005 -0.011 -0.016 -0.021 -0.026 -0.031 -0.036 -0.041 -0.046 -0.051
+
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+
+ ITS-90 Table for type R thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+   0  0.000  0.005  0.011  0.016  0.021  0.027  0.032  0.038  0.043  0.049  0.054
+  10  0.054  0.060  0.065  0.071  0.077  0.082  0.088  0.094  0.100  0.105  0.111
+  20  0.111  0.117  0.123  0.129  0.135  0.141  0.147  0.153  0.159  0.165  0.171
+  30  0.171  0.177  0.183  0.189  0.195  0.201  0.207  0.214  0.220  0.226  0.232
+  40  0.232  0.239  0.245  0.251  0.258  0.264  0.271  0.277  0.284  0.290  0.296
+
+  50  0.296  0.303  0.310  0.316  0.323  0.329  0.336  0.343  0.349  0.356  0.363
+  60  0.363  0.369  0.376  0.383  0.390  0.397  0.403  0.410  0.417  0.424  0.431
+  70  0.431  0.438  0.445  0.452  0.459  0.466  0.473  0.480  0.487  0.494  0.501
+  80  0.501  0.508  0.516  0.523  0.530  0.537  0.544  0.552  0.559  0.566  0.573
+  90  0.573  0.581  0.588  0.595  0.603  0.610  0.618  0.625  0.632  0.640  0.647
+
+ 100  0.647  0.655  0.662  0.670  0.677  0.685  0.693  0.700  0.708  0.715  0.723
+ 110  0.723  0.731  0.738  0.746  0.754  0.761  0.769  0.777  0.785  0.792  0.800
+ 120  0.800  0.808  0.816  0.824  0.832  0.839  0.847  0.855  0.863  0.871  0.879
+ 130  0.879  0.887  0.895  0.903  0.911  0.919  0.927  0.935  0.943  0.951  0.959
+ 140  0.959  0.967  0.976  0.984  0.992  1.000  1.008  1.016  1.025  1.033  1.041
+
+ 150  1.041  1.049  1.058  1.066  1.074  1.082  1.091  1.099  1.107  1.116  1.124
+ 160  1.124  1.132  1.141  1.149  1.158  1.166  1.175  1.183  1.191  1.200  1.208
+ 170  1.208  1.217  1.225  1.234  1.242  1.251  1.260  1.268  1.277  1.285  1.294
+ 180  1.294  1.303  1.311  1.320  1.329  1.337  1.346  1.355  1.363  1.372  1.381
+ 190  1.381  1.389  1.398  1.407  1.416  1.425  1.433  1.442  1.451  1.460  1.469
+
+ 200  1.469  1.477  1.486  1.495  1.504  1.513  1.522  1.531  1.540  1.549  1.558
+ 210  1.558  1.567  1.575  1.584  1.593  1.602  1.611  1.620  1.629  1.639  1.648
+ 220  1.648  1.657  1.666  1.675  1.684  1.693  1.702  1.711  1.720  1.729  1.739
+ 230  1.739  1.748  1.757  1.766  1.775  1.784  1.794  1.803  1.812  1.821  1.831
+ 240  1.831  1.840  1.849  1.858  1.868  1.877  1.886  1.895  1.905  1.914  1.923
+
+ 250  1.923  1.933  1.942  1.951  1.961  1.970  1.980  1.989  1.998  2.008  2.017
+ 260  2.017  2.027  2.036  2.046  2.055  2.064  2.074  2.083  2.093  2.102  2.112
+ 270  2.112  2.121  2.131  2.140  2.150  2.159  2.169  2.179  2.188  2.198  2.207
+ 280  2.207  2.217  2.226  2.236  2.246  2.255  2.265  2.275  2.284  2.294  2.304
+ 290  2.304  2.313  2.323  2.333  2.342  2.352  2.362  2.371  2.381  2.391  2.401
+
+ 300  2.401  2.410  2.420  2.430  2.440  2.449  2.459  2.469  2.479  2.488  2.498
+ 310  2.498  2.508  2.518  2.528  2.538  2.547  2.557  2.567  2.577  2.587  2.597
+ 320  2.597  2.607  2.617  2.626  2.636  2.646  2.656  2.666  2.676  2.686  2.696
+ 330  2.696  2.706  2.716  2.726  2.736  2.746  2.756  2.766  2.776  2.786  2.796
+ 340  2.796  2.806  2.816  2.826  2.836  2.846  2.856  2.866  2.876  2.886  2.896
+
+ 350  2.896  2.906  2.916  2.926  2.937  2.947  2.957  2.967  2.977  2.987  2.997
+ 360  2.997  3.007  3.018  3.028  3.038  3.048  3.058  3.068  3.079  3.089  3.099
+ 370  3.099  3.109  3.119  3.130  3.140  3.150  3.160  3.171  3.181  3.191  3.201
+ 380  3.201  3.212  3.222  3.232  3.242  3.253  3.263  3.273  3.284  3.294  3.304
+ 390  3.304  3.315  3.325  3.335  3.346  3.356  3.366  3.377  3.387  3.397  3.408
+
+ 400  3.408  3.418  3.428  3.439  3.449  3.460  3.470  3.480  3.491  3.501  3.512
+ 410  3.512  3.522  3.533  3.543  3.553  3.564  3.574  3.585  3.595  3.606  3.616
+ 420  3.616  3.627  3.637  3.648  3.658  3.669  3.679  3.690  3.700  3.711  3.721
+ 430  3.721  3.732  3.742  3.753  3.764  3.774  3.785  3.795  3.806  3.816  3.827
+ 440  3.827  3.838  3.848  3.859  3.869  3.880  3.891  3.901  3.912  3.922  3.933
+
+ 450  3.933  3.944  3.954  3.965  3.976  3.986  3.997  4.008  4.018  4.029  4.040
+ 460  4.040  4.050  4.061  4.072  4.083  4.093  4.104  4.115  4.125  4.136  4.147
+ 470  4.147  4.158  4.168  4.179  4.190  4.201  4.211  4.222  4.233  4.244  4.255
+ 480  4.255  4.265  4.276  4.287  4.298  4.309  4.319  4.330  4.341  4.352  4.363
+ 490  4.363  4.373  4.384  4.395  4.406  4.417  4.428  4.439  4.449  4.460  4.471
+
+ 500  4.471  4.482  4.493  4.504  4.515  4.526  4.537  4.548  4.558  4.569  4.580
+ 510  4.580  4.591  4.602  4.613  4.624  4.635  4.646  4.657  4.668  4.679  4.690
+ 520  4.690  4.701  4.712  4.723  4.734  4.745  4.756  4.767  4.778  4.789  4.800
+ 530  4.800  4.811  4.822  4.833  4.844  4.855  4.866  4.877  4.888  4.899  4.910
+ 540  4.910  4.922  4.933  4.944  4.955  4.966  4.977  4.988  4.999  5.010  5.021
+
+ 550  5.021  5.033  5.044  5.055  5.066  5.077  5.088  5.099  5.111  5.122  5.133
+ 560  5.133  5.144  5.155  5.166  5.178  5.189  5.200  5.211  5.222  5.234  5.245
+ 570  5.245  5.256  5.267  5.279  5.290  5.301  5.312  5.323  5.335  5.346  5.357
+ 580  5.357  5.369  5.380  5.391  5.402  5.414  5.425  5.436  5.448  5.459  5.470
+ 590  5.470  5.481  5.493  5.504  5.515  5.527  5.538  5.549  5.561  5.572  5.583
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+ ITS-90 Table for type R thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+ 600  5.583  5.595  5.606  5.618  5.629  5.640  5.652  5.663  5.674  5.686  5.697
+ 610  5.697  5.709  5.720  5.731  5.743  5.754  5.766  5.777  5.789  5.800  5.812
+ 620  5.812  5.823  5.834  5.846  5.857  5.869  5.880  5.892  5.903  5.915  5.926
+ 630  5.926  5.938  5.949  5.961  5.972  5.984  5.995  6.007  6.018  6.030  6.041
+ 640  6.041  6.053  6.065  6.076  6.088  6.099  6.111  6.122  6.134  6.146  6.157
+
+ 650  6.157  6.169  6.180  6.192  6.204  6.215  6.227  6.238  6.250  6.262  6.273
+ 660  6.273  6.285  6.297  6.308  6.320  6.332  6.343  6.355  6.367  6.378  6.390
+ 670  6.390  6.402  6.413  6.425  6.437  6.448  6.460  6.472  6.484  6.495  6.507
+ 680  6.507  6.519  6.531  6.542  6.554  6.566  6.578  6.589  6.601  6.613  6.625
+ 690  6.625  6.636  6.648  6.660  6.672  6.684  6.695  6.707  6.719  6.731  6.743
+
+ 700  6.743  6.755  6.766  6.778  6.790  6.802  6.814  6.826  6.838  6.849  6.861
+ 710  6.861  6.873  6.885  6.897  6.909  6.921  6.933  6.945  6.956  6.968  6.980
+ 720  6.980  6.992  7.004  7.016  7.028  7.040  7.052  7.064  7.076  7.088  7.100
+ 730  7.100  7.112  7.124  7.136  7.148  7.160  7.172  7.184  7.196  7.208  7.220
+ 740  7.220  7.232  7.244  7.256  7.268  7.280  7.292  7.304  7.316  7.328  7.340
+
+ 750  7.340  7.352  7.364  7.376  7.389  7.401  7.413  7.425  7.437  7.449  7.461
+ 760  7.461  7.473  7.485  7.498  7.510  7.522  7.534  7.546  7.558  7.570  7.583
+ 770  7.583  7.595  7.607  7.619  7.631  7.644  7.656  7.668  7.680  7.692  7.705
+ 780  7.705  7.717  7.729  7.741  7.753  7.766  7.778  7.790  7.802  7.815  7.827
+ 790  7.827  7.839  7.851  7.864  7.876  7.888  7.901  7.913  7.925  7.938  7.950
+
+ 800  7.950  7.962  7.974  7.987  7.999  8.011  8.024  8.036  8.048  8.061  8.073
+ 810  8.073  8.086  8.098  8.110  8.123  8.135  8.147  8.160  8.172  8.185  8.197
+ 820  8.197  8.209  8.222  8.234  8.247  8.259  8.272  8.284  8.296  8.309  8.321
+ 830  8.321  8.334  8.346  8.359  8.371  8.384  8.396  8.409  8.421  8.434  8.446
+ 840  8.446  8.459  8.471  8.484  8.496  8.509  8.521  8.534  8.546  8.559  8.571
+
+ 850  8.571  8.584  8.597  8.609  8.622  8.634  8.647  8.659  8.672  8.685  8.697
+ 860  8.697  8.710  8.722  8.735  8.748  8.760  8.773  8.785  8.798  8.811  8.823
+ 870  8.823  8.836  8.849  8.861  8.874  8.887  8.899  8.912  8.925  8.937  8.950
+ 880  8.950  8.963  8.975  8.988  9.001  9.014  9.026  9.039  9.052  9.065  9.077
+ 890  9.077  9.090  9.103  9.115  9.128  9.141  9.154  9.167  9.179  9.192  9.205
+
+ 900  9.205  9.218  9.230  9.243  9.256  9.269  9.282  9.294  9.307  9.320  9.333
+ 910  9.333  9.346  9.359  9.371  9.384  9.397  9.410  9.423  9.436  9.449  9.461
+ 920  9.461  9.474  9.487  9.500  9.513  9.526  9.539  9.552  9.565  9.578  9.590
+ 930  9.590  9.603  9.616  9.629  9.642  9.655  9.668  9.681  9.694  9.707  9.720
+ 940  9.720  9.733  9.746  9.759  9.772  9.785  9.798  9.811  9.824  9.837  9.850
+
+ 950  9.850  9.863  9.876  9.889  9.902  9.915  9.928  9.941  9.954  9.967  9.980
+ 960  9.980  9.993 10.006 10.019 10.032 10.046 10.059 10.072 10.085 10.098 10.111
+ 970 10.111 10.124 10.137 10.150 10.163 10.177 10.190 10.203 10.216 10.229 10.242
+ 980 10.242 10.255 10.268 10.282 10.295 10.308 10.321 10.334 10.347 10.361 10.374
+ 990 10.374 10.387 10.400 10.413 10.427 10.440 10.453 10.466 10.480 10.493 10.506
+
+1000 10.506 10.519 10.532 10.546 10.559 10.572 10.585 10.599 10.612 10.625 10.638
+1010 10.638 10.652 10.665 10.678 10.692 10.705 10.718 10.731 10.745 10.758 10.771
+1020 10.771 10.785 10.798 10.811 10.825 10.838 10.851 10.865 10.878 10.891 10.905
+1030 10.905 10.918 10.932 10.945 10.958 10.972 10.985 10.998 11.012 11.025 11.039
+1040 11.039 11.052 11.065 11.079 11.092 11.106 11.119 11.132 11.146 11.159 11.173
+
+1050 11.173 11.186 11.200 11.213 11.227 11.240 11.253 11.267 11.280 11.294 11.307
+1060 11.307 11.321 11.334 11.348 11.361 11.375 11.388 11.402 11.415 11.429 11.442
+1070 11.442 11.456 11.469 11.483 11.496 11.510 11.524 11.537 11.551 11.564 11.578
+1080 11.578 11.591 11.605 11.618 11.632 11.646 11.659 11.673 11.686 11.700 11.714
+1090 11.714 11.727 11.741 11.754 11.768 11.782 11.795 11.809 11.822 11.836 11.850
+
+1100 11.850 11.863 11.877 11.891 11.904 11.918 11.931 11.945 11.959 11.972 11.986
+1110 11.986 12.000 12.013 12.027 12.041 12.054 12.068 12.082 12.096 12.109 12.123
+1120 12.123 12.137 12.150 12.164 12.178 12.191 12.205 12.219 12.233 12.246 12.260
+1130 12.260 12.274 12.288 12.301 12.315 12.329 12.342 12.356 12.370 12.384 12.397
+1140 12.397 12.411 12.425 12.439 12.453 12.466 12.480 12.494 12.508 12.521 12.535
+
+1150 12.535 12.549 12.563 12.577 12.590 12.604 12.618 12.632 12.646 12.659 12.673
+1160 12.673 12.687 12.701 12.715 12.729 12.742 12.756 12.770 12.784 12.798 12.812
+1170 12.812 12.825 12.839 12.853 12.867 12.881 12.895 12.909 12.922 12.936 12.950
+1180 12.950 12.964 12.978 12.992 13.006 13.019 13.033 13.047 13.061 13.075 13.089
+1190 13.089 13.103 13.117 13.131 13.145 13.158 13.172 13.186 13.200 13.214 13.228
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+ ITS-90 Table for type R thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+1200 13.228 13.242 13.256 13.270 13.284 13.298 13.311 13.325 13.339 13.353 13.367
+1210 13.367 13.381 13.395 13.409 13.423 13.437 13.451 13.465 13.479 13.493 13.507
+1220 13.507 13.521 13.535 13.549 13.563 13.577 13.590 13.604 13.618 13.632 13.646
+1230 13.646 13.660 13.674 13.688 13.702 13.716 13.730 13.744 13.758 13.772 13.786
+1240 13.786 13.800 13.814 13.828 13.842 13.856 13.870 13.884 13.898 13.912 13.926
+
+1250 13.926 13.940 13.954 13.968 13.982 13.996 14.010 14.024 14.038 14.052 14.066
+1260 14.066 14.081 14.095 14.109 14.123 14.137 14.151 14.165 14.179 14.193 14.207
+1270 14.207 14.221 14.235 14.249 14.263 14.277 14.291 14.305 14.319 14.333 14.347
+1280 14.347 14.361 14.375 14.390 14.404 14.418 14.432 14.446 14.460 14.474 14.488
+1290 14.488 14.502 14.516 14.530 14.544 14.558 14.572 14.586 14.601 14.615 14.629
+
+1300 14.629 14.643 14.657 14.671 14.685 14.699 14.713 14.727 14.741 14.755 14.770
+1310 14.770 14.784 14.798 14.812 14.826 14.840 14.854 14.868 14.882 14.896 14.911
+1320 14.911 14.925 14.939 14.953 14.967 14.981 14.995 15.009 15.023 15.037 15.052
+1330 15.052 15.066 15.080 15.094 15.108 15.122 15.136 15.150 15.164 15.179 15.193
+1340 15.193 15.207 15.221 15.235 15.249 15.263 15.277 15.291 15.306 15.320 15.334
+
+1350 15.334 15.348 15.362 15.376 15.390 15.404 15.419 15.433 15.447 15.461 15.475
+1360 15.475 15.489 15.503 15.517 15.531 15.546 15.560 15.574 15.588 15.602 15.616
+1370 15.616 15.630 15.645 15.659 15.673 15.687 15.701 15.715 15.729 15.743 15.758
+1380 15.758 15.772 15.786 15.800 15.814 15.828 15.842 15.856 15.871 15.885 15.899
+1390 15.899 15.913 15.927 15.941 15.955 15.969 15.984 15.998 16.012 16.026 16.040
+
+1400 16.040 16.054 16.068 16.082 16.097 16.111 16.125 16.139 16.153 16.167 16.181
+1410 16.181 16.196 16.210 16.224 16.238 16.252 16.266 16.280 16.294 16.309 16.323
+1420 16.323 16.337 16.351 16.365 16.379 16.393 16.407 16.422 16.436 16.450 16.464
+1430 16.464 16.478 16.492 16.506 16.520 16.534 16.549 16.563 16.577 16.591 16.605
+1440 16.605 16.619 16.633 16.647 16.662 16.676 16.690 16.704 16.718 16.732 16.746
+
+1450 16.746 16.760 16.774 16.789 16.803 16.817 16.831 16.845 16.859 16.873 16.887
+1460 16.887 16.901 16.915 16.930 16.944 16.958 16.972 16.986 17.000 17.014 17.028
+1470 17.028 17.042 17.056 17.071 17.085 17.099 17.113 17.127 17.141 17.155 17.169
+1480 17.169 17.183 17.197 17.211 17.225 17.240 17.254 17.268 17.282 17.296 17.310
+1490 17.310 17.324 17.338 17.352 17.366 17.380 17.394 17.408 17.423 17.437 17.451
+
+1500 17.451 17.465 17.479 17.493 17.507 17.521 17.535 17.549 17.563 17.577 17.591
+1510 17.591 17.605 17.619 17.633 17.647 17.661 17.676 17.690 17.704 17.718 17.732
+1520 17.732 17.746 17.760 17.774 17.788 17.802 17.816 17.830 17.844 17.858 17.872
+1530 17.872 17.886 17.900 17.914 17.928 17.942 17.956 17.970 17.984 17.998 18.012
+1540 18.012 18.026 18.040 18.054 18.068 18.082 18.096 18.110 18.124 18.138 18.152
+
+1550 18.152 18.166 18.180 18.194 18.208 18.222 18.236 18.250 18.264 18.278 18.292
+1560 18.292 18.306 18.320 18.334 18.348 18.362 18.376 18.390 18.404 18.417 18.431
+1570 18.431 18.445 18.459 18.473 18.487 18.501 18.515 18.529 18.543 18.557 18.571
+1580 18.571 18.585 18.599 18.613 18.627 18.640 18.654 18.668 18.682 18.696 18.710
+1590 18.710 18.724 18.738 18.752 18.766 18.779 18.793 18.807 18.821 18.835 18.849
+
+1600 18.849 18.863 18.877 18.891 18.904 18.918 18.932 18.946 18.960 18.974 18.988
+1610 18.988 19.002 19.015 19.029 19.043 19.057 19.071 19.085 19.098 19.112 19.126
+1620 19.126 19.140 19.154 19.168 19.181 19.195 19.209 19.223 19.237 19.250 19.264
+1630 19.264 19.278 19.292 19.306 19.319 19.333 19.347 19.361 19.375 19.388 19.402
+1640 19.402 19.416 19.430 19.444 19.457 19.471 19.485 19.499 19.512 19.526 19.540
+
+1650 19.540 19.554 19.567 19.581 19.595 19.609 19.622 19.636 19.650 19.663 19.677
+1660 19.677 19.691 19.705 19.718 19.732 19.746 19.759 19.773 19.787 19.800 19.814
+1670 19.814 19.828 19.841 19.855 19.869 19.882 19.896 19.910 19.923 19.937 19.951
+1680 19.951 19.964 19.978 19.992 20.005 20.019 20.032 20.046 20.060 20.073 20.087
+1690 20.087 20.100 20.114 20.127 20.141 20.154 20.168 20.181 20.195 20.208 20.222
+
+1700 20.222 20.235 20.249 20.262 20.275 20.289 20.302 20.316 20.329 20.342 20.356
+1710 20.356 20.369 20.382 20.396 20.409 20.422 20.436 20.449 20.462 20.475 20.488
+1720 20.488 20.502 20.515 20.528 20.541 20.554 20.567 20.581 20.594 20.607 20.620
+1730 20.620 20.633 20.646 20.659 20.672 20.685 20.698 20.711 20.724 20.736 20.749
+1740 20.749 20.762 20.775 20.788 20.801 20.813 20.826 20.839 20.852 20.864 20.877
+
+1750 20.877 20.890 20.902 20.915 20.928 20.940 20.953 20.965 20.978 20.990 21.003
+1760 21.003 21.015 21.027 21.040 21.052 21.065 21.077 21.089 21.101
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+
+
+************************************
+* This section contains coefficients for type R thermocouples for
+* the two subranges of temperature listed below.  The coefficients
+* are in units of °C and mV and are listed in the order of constant
+* term up to the highest order.  The equation is of the form
+* E = sum(i=0 to n) c_i t^i.
+*
+*     Temperature Range (°C)
+*      -50.000 to 1064.180
+*      1064.180 to 1664.500
+*      1664.500 to 1768.100
+************************************
+name: reference function on ITS-90
+type: R
+temperature units: °C
+emf units: mV
+range:   -50.000,   1064.180,  9
+ 0.000000000000E+00
+ 0.528961729765E-02
+ 0.139166589782E-04
+-0.238855693017E-07
+ 0.356916001063E-10
+-0.462347666298E-13
+ 0.500777441034E-16
+-0.373105886191E-19
+ 0.157716482367E-22
+-0.281038625251E-26
+range:  1064.180,   1664.500,  5
+ 0.295157925316E+01
+-0.252061251332E-02
+ 0.159564501865E-04
+-0.764085947576E-08
+ 0.205305291024E-11
+-0.293359668173E-15
+range:  1664.500,   1768.100,  4
+ 0.152232118209E+03
+-0.268819888545E+00
+ 0.171280280471E-03
+-0.345895706453E-07
+-0.934633971046E-14
+
+
+
+************************************
+* This section contains coefficients of approximate inverse
+* functions for type R thermocouples for the subranges of
+* temperature and voltage listed below. The range of errors of
+* the approximate inverse function for each subrange is also given.
+* The coefficients are in units of °C and mV and are listed in
+* the order of constant term up to the highest order.
+* The equation is of the form t_90 = d_0 + d_1*E + d_2*E^2 + ...
+*     + d_n*E^n,
+* where E is in mV and t_90 is in °C.
+*
+*      Temperature        Voltage               Error
+*         range              range               range
+*         (°C)               (mV)                (° C)
+*      -50. to 250.      -0.226 to 1.923    -0.02 to 0.02
+*      250. to 1200.      1.923 to 13.228   -0.005 to 0.005
+*     1064. to 1664.5    11.361 to 19.739   -0.0005 to 0.001
+*    1664.5 to 1768.1    19.739 to 21.103    -0.001 to 0.002
+********************************************************
+Inverse coefficients for type R:
+
+Temperature   -50.           250.          1064.          1664.5
+  Range:      250.          1200.          1664.5         1768.1
+
+  Voltage   -0.226          1.923         11.361         19.739
+  Range:     1.923         13.228         19.739         21.103
+
+       0.0000000E+00  1.334584505E+01 -8.199599416E+01  3.406177836E+04
+       1.8891380E+02  1.472644573E+02  1.553962042E+02 -7.023729171E+03
+      -9.3835290E+01 -1.844024844E+01 -8.342197663E+00  5.582903813E+02
+       1.3068619E+02  4.031129726E+00  4.279433549E-01 -1.952394635E+01
+      -2.2703580E+02 -6.249428360E-01 -1.191577910E-02  2.560740231E-01
+       3.5145659E+02  6.468412046E-02  1.492290091E-04  0.000000000E+00
+      -3.8953900E+02 -4.458750426E-03  0.000000000E+00  0.000000000E+00
+       2.8239471E+02  1.994710149E-04  0.000000000E+00  0.000000000E+00
+      -1.2607281E+02 -5.313401790E-06  0.000000000E+00  0.000000000E+00
+       3.1353611E+01  6.481976217E-08  0.000000000E+00  0.000000000E+00
+      -3.3187769E+00  0.000000000E+00  0.000000000E+00  0.000000000E+00
+
+  Error      -0.02         -0.005         -0.0005        -0.001
+  Range:      0.02          0.005          0.001          0.002
+
+
+
+ ITS-90 Table for type S thermocouple
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+                               Thermoelectric Voltage in mV
+
+ -50 -0.236
+ -40 -0.194 -0.199 -0.203 -0.207 -0.211 -0.215 -0.219 -0.224 -0.228 -0.232 -0.236
+ -30 -0.150 -0.155 -0.159 -0.164 -0.168 -0.173 -0.177 -0.181 -0.186 -0.190 -0.194
+ -20 -0.103 -0.108 -0.113 -0.117 -0.122 -0.127 -0.132 -0.136 -0.141 -0.146 -0.150
+ -10 -0.053 -0.058 -0.063 -0.068 -0.073 -0.078 -0.083 -0.088 -0.093 -0.098 -0.103
+   0  0.000 -0.005 -0.011 -0.016 -0.021 -0.027 -0.032 -0.037 -0.042 -0.048 -0.053
+
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+
+ ITS-90 Table for type S thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+   0  0.000  0.005  0.011  0.016  0.022  0.027  0.033  0.038  0.044  0.050  0.055
+  10  0.055  0.061  0.067  0.072  0.078  0.084  0.090  0.095  0.101  0.107  0.113
+  20  0.113  0.119  0.125  0.131  0.137  0.143  0.149  0.155  0.161  0.167  0.173
+  30  0.173  0.179  0.185  0.191  0.197  0.204  0.210  0.216  0.222  0.229  0.235
+  40  0.235  0.241  0.248  0.254  0.260  0.267  0.273  0.280  0.286  0.292  0.299
+
+  50  0.299  0.305  0.312  0.319  0.325  0.332  0.338  0.345  0.352  0.358  0.365
+  60  0.365  0.372  0.378  0.385  0.392  0.399  0.405  0.412  0.419  0.426  0.433
+  70  0.433  0.440  0.446  0.453  0.460  0.467  0.474  0.481  0.488  0.495  0.502
+  80  0.502  0.509  0.516  0.523  0.530  0.538  0.545  0.552  0.559  0.566  0.573
+  90  0.573  0.580  0.588  0.595  0.602  0.609  0.617  0.624  0.631  0.639  0.646
+
+ 100  0.646  0.653  0.661  0.668  0.675  0.683  0.690  0.698  0.705  0.713  0.720
+ 110  0.720  0.727  0.735  0.743  0.750  0.758  0.765  0.773  0.780  0.788  0.795
+ 120  0.795  0.803  0.811  0.818  0.826  0.834  0.841  0.849  0.857  0.865  0.872
+ 130  0.872  0.880  0.888  0.896  0.903  0.911  0.919  0.927  0.935  0.942  0.950
+ 140  0.950  0.958  0.966  0.974  0.982  0.990  0.998  1.006  1.013  1.021  1.029
+
+ 150  1.029  1.037  1.045  1.053  1.061  1.069  1.077  1.085  1.094  1.102  1.110
+ 160  1.110  1.118  1.126  1.134  1.142  1.150  1.158  1.167  1.175  1.183  1.191
+ 170  1.191  1.199  1.207  1.216  1.224  1.232  1.240  1.249  1.257  1.265  1.273
+ 180  1.273  1.282  1.290  1.298  1.307  1.315  1.323  1.332  1.340  1.348  1.357
+ 190  1.357  1.365  1.373  1.382  1.390  1.399  1.407  1.415  1.424  1.432  1.441
+
+ 200  1.441  1.449  1.458  1.466  1.475  1.483  1.492  1.500  1.509  1.517  1.526
+ 210  1.526  1.534  1.543  1.551  1.560  1.569  1.577  1.586  1.594  1.603  1.612
+ 220  1.612  1.620  1.629  1.638  1.646  1.655  1.663  1.672  1.681  1.690  1.698
+ 230  1.698  1.707  1.716  1.724  1.733  1.742  1.751  1.759  1.768  1.777  1.786
+ 240  1.786  1.794  1.803  1.812  1.821  1.829  1.838  1.847  1.856  1.865  1.874
+
+ 250  1.874  1.882  1.891  1.900  1.909  1.918  1.927  1.936  1.944  1.953  1.962
+ 260  1.962  1.971  1.980  1.989  1.998  2.007  2.016  2.025  2.034  2.043  2.052
+ 270  2.052  2.061  2.070  2.078  2.087  2.096  2.105  2.114  2.123  2.132  2.141
+ 280  2.141  2.151  2.160  2.169  2.178  2.187  2.196  2.205  2.214  2.223  2.232
+ 290  2.232  2.241  2.250  2.259  2.268  2.277  2.287  2.296  2.305  2.314  2.323
+
+ 300  2.323  2.332  2.341  2.350  2.360  2.369  2.378  2.387  2.396  2.405  2.415
+ 310  2.415  2.424  2.433  2.442  2.451  2.461  2.470  2.479  2.488  2.497  2.507
+ 320  2.507  2.516  2.525  2.534  2.544  2.553  2.562  2.571  2.581  2.590  2.599
+ 330  2.599  2.609  2.618  2.627  2.636  2.646  2.655  2.664  2.674  2.683  2.692
+ 340  2.692  2.702  2.711  2.720  2.730  2.739  2.748  2.758  2.767  2.776  2.786
+
+ 350  2.786  2.795  2.805  2.814  2.823  2.833  2.842  2.851  2.861  2.870  2.880
+ 360  2.880  2.889  2.899  2.908  2.917  2.927  2.936  2.946  2.955  2.965  2.974
+ 370  2.974  2.983  2.993  3.002  3.012  3.021  3.031  3.040  3.050  3.059  3.069
+ 380  3.069  3.078  3.088  3.097  3.107  3.116  3.126  3.135  3.145  3.154  3.164
+ 390  3.164  3.173  3.183  3.192  3.202  3.212  3.221  3.231  3.240  3.250  3.259
+
+ 400  3.259  3.269  3.279  3.288  3.298  3.307  3.317  3.326  3.336  3.346  3.355
+ 410  3.355  3.365  3.374  3.384  3.394  3.403  3.413  3.423  3.432  3.442  3.451
+ 420  3.451  3.461  3.471  3.480  3.490  3.500  3.509  3.519  3.529  3.538  3.548
+ 430  3.548  3.558  3.567  3.577  3.587  3.596  3.606  3.616  3.626  3.635  3.645
+ 440  3.645  3.655  3.664  3.674  3.684  3.694  3.703  3.713  3.723  3.732  3.742
+
+ 450  3.742  3.752  3.762  3.771  3.781  3.791  3.801  3.810  3.820  3.830  3.840
+ 460  3.840  3.850  3.859  3.869  3.879  3.889  3.898  3.908  3.918  3.928  3.938
+ 470  3.938  3.947  3.957  3.967  3.977  3.987  3.997  4.006  4.016  4.026  4.036
+ 480  4.036  4.046  4.056  4.065  4.075  4.085  4.095  4.105  4.115  4.125  4.134
+ 490  4.134  4.144  4.154  4.164  4.174  4.184  4.194  4.204  4.213  4.223  4.233
+
+ 500  4.233  4.243  4.253  4.263  4.273  4.283  4.293  4.303  4.313  4.323  4.332
+ 510  4.332  4.342  4.352  4.362  4.372  4.382  4.392  4.402  4.412  4.422  4.432
+ 520  4.432  4.442  4.452  4.462  4.472  4.482  4.492  4.502  4.512  4.522  4.532
+ 530  4.532  4.542  4.552  4.562  4.572  4.582  4.592  4.602  4.612  4.622  4.632
+ 540  4.632  4.642  4.652  4.662  4.672  4.682  4.692  4.702  4.712  4.722  4.732
+
+ 550  4.732  4.742  4.752  4.762  4.772  4.782  4.793  4.803  4.813  4.823  4.833
+ 560  4.833  4.843  4.853  4.863  4.873  4.883  4.893  4.904  4.914  4.924  4.934
+ 570  4.934  4.944  4.954  4.964  4.974  4.984  4.995  5.005  5.015  5.025  5.035
+ 580  5.035  5.045  5.055  5.066  5.076  5.086  5.096  5.106  5.116  5.127  5.137
+ 590  5.137  5.147  5.157  5.167  5.178  5.188  5.198  5.208  5.218  5.228  5.239
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+ ITS-90 Table for type S thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+ 600  5.239  5.249  5.259  5.269  5.280  5.290  5.300  5.310  5.320  5.331  5.341
+ 610  5.341  5.351  5.361  5.372  5.382  5.392  5.402  5.413  5.423  5.433  5.443
+ 620  5.443  5.454  5.464  5.474  5.485  5.495  5.505  5.515  5.526  5.536  5.546
+ 630  5.546  5.557  5.567  5.577  5.588  5.598  5.608  5.618  5.629  5.639  5.649
+ 640  5.649  5.660  5.670  5.680  5.691  5.701  5.712  5.722  5.732  5.743  5.753
+
+ 650  5.753  5.763  5.774  5.784  5.794  5.805  5.815  5.826  5.836  5.846  5.857
+ 660  5.857  5.867  5.878  5.888  5.898  5.909  5.919  5.930  5.940  5.950  5.961
+ 670  5.961  5.971  5.982  5.992  6.003  6.013  6.024  6.034  6.044  6.055  6.065
+ 680  6.065  6.076  6.086  6.097  6.107  6.118  6.128  6.139  6.149  6.160  6.170
+ 690  6.170  6.181  6.191  6.202  6.212  6.223  6.233  6.244  6.254  6.265  6.275
+
+ 700  6.275  6.286  6.296  6.307  6.317  6.328  6.338  6.349  6.360  6.370  6.381
+ 710  6.381  6.391  6.402  6.412  6.423  6.434  6.444  6.455  6.465  6.476  6.486
+ 720  6.486  6.497  6.508  6.518  6.529  6.539  6.550  6.561  6.571  6.582  6.593
+ 730  6.593  6.603  6.614  6.624  6.635  6.646  6.656  6.667  6.678  6.688  6.699
+ 740  6.699  6.710  6.720  6.731  6.742  6.752  6.763  6.774  6.784  6.795  6.806
+
+ 750  6.806  6.817  6.827  6.838  6.849  6.859  6.870  6.881  6.892  6.902  6.913
+ 760  6.913  6.924  6.934  6.945  6.956  6.967  6.977  6.988  6.999  7.010  7.020
+ 770  7.020  7.031  7.042  7.053  7.064  7.074  7.085  7.096  7.107  7.117  7.128
+ 780  7.128  7.139  7.150  7.161  7.172  7.182  7.193  7.204  7.215  7.226  7.236
+ 790  7.236  7.247  7.258  7.269  7.280  7.291  7.302  7.312  7.323  7.334  7.345
+
+ 800  7.345  7.356  7.367  7.378  7.388  7.399  7.410  7.421  7.432  7.443  7.454
+ 810  7.454  7.465  7.476  7.487  7.497  7.508  7.519  7.530  7.541  7.552  7.563
+ 820  7.563  7.574  7.585  7.596  7.607  7.618  7.629  7.640  7.651  7.662  7.673
+ 830  7.673  7.684  7.695  7.706  7.717  7.728  7.739  7.750  7.761  7.772  7.783
+ 840  7.783  7.794  7.805  7.816  7.827  7.838  7.849  7.860  7.871  7.882  7.893
+
+ 850  7.893  7.904  7.915  7.926  7.937  7.948  7.959  7.970  7.981  7.992  8.003
+ 860  8.003  8.014  8.026  8.037  8.048  8.059  8.070  8.081  8.092  8.103  8.114
+ 870  8.114  8.125  8.137  8.148  8.159  8.170  8.181  8.192  8.203  8.214  8.226
+ 880  8.226  8.237  8.248  8.259  8.270  8.281  8.293  8.304  8.315  8.326  8.337
+ 890  8.337  8.348  8.360  8.371  8.382  8.393  8.404  8.416  8.427  8.438  8.449
+
+ 900  8.449  8.460  8.472  8.483  8.494  8.505  8.517  8.528  8.539  8.550  8.562
+ 910  8.562  8.573  8.584  8.595  8.607  8.618  8.629  8.640  8.652  8.663  8.674
+ 920  8.674  8.685  8.697  8.708  8.719  8.731  8.742  8.753  8.765  8.776  8.787
+ 930  8.787  8.798  8.810  8.821  8.832  8.844  8.855  8.866  8.878  8.889  8.900
+ 940  8.900  8.912  8.923  8.935  8.946  8.957  8.969  8.980  8.991  9.003  9.014
+
+ 950  9.014  9.025  9.037  9.048  9.060  9.071  9.082  9.094  9.105  9.117  9.128
+ 960  9.128  9.139  9.151  9.162  9.174  9.185  9.197  9.208  9.219  9.231  9.242
+ 970  9.242  9.254  9.265  9.277  9.288  9.300  9.311  9.323  9.334  9.345  9.357
+ 980  9.357  9.368  9.380  9.391  9.403  9.414  9.426  9.437  9.449  9.460  9.472
+ 990  9.472  9.483  9.495  9.506  9.518  9.529  9.541  9.552  9.564  9.576  9.587
+
+1000  9.587  9.599  9.610  9.622  9.633  9.645  9.656  9.668  9.680  9.691  9.703
+1010  9.703  9.714  9.726  9.737  9.749  9.761  9.772  9.784  9.795  9.807  9.819
+1020  9.819  9.830  9.842  9.853  9.865  9.877  9.888  9.900  9.911  9.923  9.935
+1030  9.935  9.946  9.958  9.970  9.981  9.993 10.005 10.016 10.028 10.040 10.051
+1040 10.051 10.063 10.075 10.086 10.098 10.110 10.121 10.133 10.145 10.156 10.168
+
+1050 10.168 10.180 10.191 10.203 10.215 10.227 10.238 10.250 10.262 10.273 10.285
+1060 10.285 10.297 10.309 10.320 10.332 10.344 10.356 10.367 10.379 10.391 10.403
+1070 10.403 10.414 10.426 10.438 10.450 10.461 10.473 10.485 10.497 10.509 10.520
+1080 10.520 10.532 10.544 10.556 10.567 10.579 10.591 10.603 10.615 10.626 10.638
+1090 10.638 10.650 10.662 10.674 10.686 10.697 10.709 10.721 10.733 10.745 10.757
+
+1100 10.757 10.768 10.780 10.792 10.804 10.816 10.828 10.839 10.851 10.863 10.875
+1110 10.875 10.887 10.899 10.911 10.922 10.934 10.946 10.958 10.970 10.982 10.994
+1120 10.994 11.006 11.017 11.029 11.041 11.053 11.065 11.077 11.089 11.101 11.113
+1130 11.113 11.125 11.136 11.148 11.160 11.172 11.184 11.196 11.208 11.220 11.232
+1140 11.232 11.244 11.256 11.268 11.280 11.291 11.303 11.315 11.327 11.339 11.351
+
+1150 11.351 11.363 11.375 11.387 11.399 11.411 11.423 11.435 11.447 11.459 11.471
+1160 11.471 11.483 11.495 11.507 11.519 11.531 11.542 11.554 11.566 11.578 11.590
+1170 11.590 11.602 11.614 11.626 11.638 11.650 11.662 11.674 11.686 11.698 11.710
+1180 11.710 11.722 11.734 11.746 11.758 11.770 11.782 11.794 11.806 11.818 11.830
+1190 11.830 11.842 11.854 11.866 11.878 11.890 11.902 11.914 11.926 11.939 11.951
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+ ITS-90 Table for type S thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+1200 11.951 11.963 11.975 11.987 11.999 12.011 12.023 12.035 12.047 12.059 12.071
+1210 12.071 12.083 12.095 12.107 12.119 12.131 12.143 12.155 12.167 12.179 12.191
+1220 12.191 12.203 12.216 12.228 12.240 12.252 12.264 12.276 12.288 12.300 12.312
+1230 12.312 12.324 12.336 12.348 12.360 12.372 12.384 12.397 12.409 12.421 12.433
+1240 12.433 12.445 12.457 12.469 12.481 12.493 12.505 12.517 12.529 12.542 12.554
+
+1250 12.554 12.566 12.578 12.590 12.602 12.614 12.626 12.638 12.650 12.662 12.675
+1260 12.675 12.687 12.699 12.711 12.723 12.735 12.747 12.759 12.771 12.783 12.796
+1270 12.796 12.808 12.820 12.832 12.844 12.856 12.868 12.880 12.892 12.905 12.917
+1280 12.917 12.929 12.941 12.953 12.965 12.977 12.989 13.001 13.014 13.026 13.038
+1290 13.038 13.050 13.062 13.074 13.086 13.098 13.111 13.123 13.135 13.147 13.159
+
+1300 13.159 13.171 13.183 13.195 13.208 13.220 13.232 13.244 13.256 13.268 13.280
+1310 13.280 13.292 13.305 13.317 13.329 13.341 13.353 13.365 13.377 13.390 13.402
+1320 13.402 13.414 13.426 13.438 13.450 13.462 13.474 13.487 13.499 13.511 13.523
+1330 13.523 13.535 13.547 13.559 13.572 13.584 13.596 13.608 13.620 13.632 13.644
+1340 13.644 13.657 13.669 13.681 13.693 13.705 13.717 13.729 13.742 13.754 13.766
+
+1350 13.766 13.778 13.790 13.802 13.814 13.826 13.839 13.851 13.863 13.875 13.887
+1360 13.887 13.899 13.911 13.924 13.936 13.948 13.960 13.972 13.984 13.996 14.009
+1370 14.009 14.021 14.033 14.045 14.057 14.069 14.081 14.094 14.106 14.118 14.130
+1380 14.130 14.142 14.154 14.166 14.178 14.191 14.203 14.215 14.227 14.239 14.251
+1390 14.251 14.263 14.276 14.288 14.300 14.312 14.324 14.336 14.348 14.360 14.373
+
+1400 14.373 14.385 14.397 14.409 14.421 14.433 14.445 14.457 14.470 14.482 14.494
+1410 14.494 14.506 14.518 14.530 14.542 14.554 14.567 14.579 14.591 14.603 14.615
+1420 14.615 14.627 14.639 14.651 14.664 14.676 14.688 14.700 14.712 14.724 14.736
+1430 14.736 14.748 14.760 14.773 14.785 14.797 14.809 14.821 14.833 14.845 14.857
+1440 14.857 14.869 14.881 14.894 14.906 14.918 14.930 14.942 14.954 14.966 14.978
+
+1450 14.978 14.990 15.002 15.015 15.027 15.039 15.051 15.063 15.075 15.087 15.099
+1460 15.099 15.111 15.123 15.135 15.148 15.160 15.172 15.184 15.196 15.208 15.220
+1470 15.220 15.232 15.244 15.256 15.268 15.280 15.292 15.304 15.317 15.329 15.341
+1480 15.341 15.353 15.365 15.377 15.389 15.401 15.413 15.425 15.437 15.449 15.461
+1490 15.461 15.473 15.485 15.497 15.509 15.521 15.534 15.546 15.558 15.570 15.582
+
+1500 15.582 15.594 15.606 15.618 15.630 15.642 15.654 15.666 15.678 15.690 15.702
+1510 15.702 15.714 15.726 15.738 15.750 15.762 15.774 15.786 15.798 15.810 15.822
+1520 15.822 15.834 15.846 15.858 15.870 15.882 15.894 15.906 15.918 15.930 15.942
+1530 15.942 15.954 15.966 15.978 15.990 16.002 16.014 16.026 16.038 16.050 16.062
+1540 16.062 16.074 16.086 16.098 16.110 16.122 16.134 16.146 16.158 16.170 16.182
+
+1550 16.182 16.194 16.205 16.217 16.229 16.241 16.253 16.265 16.277 16.289 16.301
+1560 16.301 16.313 16.325 16.337 16.349 16.361 16.373 16.385 16.396 16.408 16.420
+1570 16.420 16.432 16.444 16.456 16.468 16.480 16.492 16.504 16.516 16.527 16.539
+1580 16.539 16.551 16.563 16.575 16.587 16.599 16.611 16.623 16.634 16.646 16.658
+1590 16.658 16.670 16.682 16.694 16.706 16.718 16.729 16.741 16.753 16.765 16.777
+
+1600 16.777 16.789 16.801 16.812 16.824 16.836 16.848 16.860 16.872 16.883 16.895
+1610 16.895 16.907 16.919 16.931 16.943 16.954 16.966 16.978 16.990 17.002 17.013
+1620 17.013 17.025 17.037 17.049 17.061 17.072 17.084 17.096 17.108 17.120 17.131
+1630 17.131 17.143 17.155 17.167 17.178 17.190 17.202 17.214 17.225 17.237 17.249
+1640 17.249 17.261 17.272 17.284 17.296 17.308 17.319 17.331 17.343 17.355 17.366
+
+1650 17.366 17.378 17.390 17.401 17.413 17.425 17.437 17.448 17.460 17.472 17.483
+1660 17.483 17.495 17.507 17.518 17.530 17.542 17.553 17.565 17.577 17.588 17.600
+1670 17.600 17.612 17.623 17.635 17.647 17.658 17.670 17.682 17.693 17.705 17.717
+1680 17.717 17.728 17.740 17.751 17.763 17.775 17.786 17.798 17.809 17.821 17.832
+1690 17.832 17.844 17.855 17.867 17.878 17.890 17.901 17.913 17.924 17.936 17.947
+
+1700 17.947 17.959 17.970 17.982 17.993 18.004 18.016 18.027 18.039 18.050 18.061
+1710 18.061 18.073 18.084 18.095 18.107 18.118 18.129 18.140 18.152 18.163 18.174
+1720 18.174 18.185 18.196 18.208 18.219 18.230 18.241 18.252 18.263 18.274 18.285
+1730 18.285 18.297 18.308 18.319 18.330 18.341 18.352 18.362 18.373 18.384 18.395
+1740 18.395 18.406 18.417 18.428 18.439 18.449 18.460 18.471 18.482 18.493 18.503
+
+1750 18.503 18.514 18.525 18.535 18.546 18.557 18.567 18.578 18.588 18.599 18.609
+1760 18.609 18.620 18.630 18.641 18.651 18.661 18.672 18.682 18.693
+
+ °C      0      1      2      3      4      5      6      7      8      9     10
+
+
+
+************************************
+* This section contains coefficients for type S thermocouples for
+* the two subranges of temperature listed below.  The coefficients
+* are in units of °C and mV and are listed in the order of constant
+* term up to the highest order.  The equation is of the form
+* E = sum(i=0 to n) c_i t^i.
+*
+*     Temperature Range (°C)
+*      -50.000 to 1064.180
+*      1064.180 to 1664.500
+*      1664.500 to 1768.100
+************************************
+name: reference function on ITS-90
+type: S
+temperature units: °C
+emf units: mV
+range:   -50.000,   1064.180,  8
+ 0.000000000000E+00
+ 0.540313308631E-02
+ 0.125934289740E-04
+-0.232477968689E-07
+ 0.322028823036E-10
+-0.331465196389E-13
+ 0.255744251786E-16
+-0.125068871393E-19
+ 0.271443176145E-23
+range:  1064.180,   1664.500,  4
+ 0.132900444085E+01
+ 0.334509311344E-02
+ 0.654805192818E-05
+-0.164856259209E-08
+ 0.129989605174E-13
+range:  1664.500,   1768.100,  4
+ 0.146628232636E+03
+-0.258430516752E+00
+ 0.163693574641E-03
+-0.330439046987E-07
+-0.943223690612E-14
+
+
+
+************************************
+* This section contains coefficients of approximate inverse
+* functions for type S thermocouples for the subranges of
+* temperature and voltage listed below. The range of errors of
+* the approximate inverse function for each subrange is also given.
+* The coefficients are in units of °C and mV and are listed in
+* the order of constant term up to the highest order.
+* The equation is of the form t_90 = d_0 + d_1*E + d_2*E^2 + ...
+*     + d_n*E^n,
+* where E is in mV and t_90 is in °C.
+*
+*      Temperature        Voltage               Error
+*         range              range               range
+*         (°C)               (mV)                (° C)
+*      -50. to 250.      -0.235 to 1.874     -0.02 to 0.02
+*      250. to 1200.      1.874 to 11.950    -0.01 to 0.01
+*     1064. to 1664.5    10.332 to 17.536    -0.0002 to 0.0002
+*    1664.5 to 1768.1    17.536 to 18.693    -0.002 to 0.002
+********************************************************
+Inverse coefficients for type S:
+
+Temperature   -50.           250.          1064.          1664.5
+  Range:      250.          1200.          1664.5         1768.1
+
+  Voltage   -0.235          1.874         10.332         17.536
+  Range:     1.874         11.950         17.536         18.693
+
+       0.00000000E+00  1.291507177E+01 -8.087801117E+01  5.333875126E+04
+       1.84949460E+02  1.466298863E+02  1.621573104E+02 -1.235892298E+04
+      -8.00504062E+01 -1.534713402E+01 -8.536869453E+00  1.092657613E+03
+       1.02237430E+02  3.145945973E+00  4.719686976E-01 -4.265693686E+01
+      -1.52248592E+02 -4.163257839E-01 -1.441693666E-02  6.247205420E-01
+       1.88821343E+02  3.187963771E-02  2.081618890E-04  0.000000000E+00
+      -1.59085941E+02 -1.291637500E-03  0.000000000E+00  0.000000000E+00
+       8.23027880E+01  2.183475087E-05  0.000000000E+00  0.000000000E+00
+      -2.34181944E+01 -1.447379511E-07  0.000000000E+00  0.000000000E+00
+       2.79786260E+00  8.211272125E-09  0.000000000E+00  0.000000000E+00
+
+  Error      -0.02          -0.01         -0.0002        -0.002
+  Range:      0.02           0.01          0.0002         0.002
+
+
+ ITS-90 Table for type T thermocouple
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+                               Thermoelectric Voltage in mV
+
+-270 -6.258
+-260 -6.232 -6.236 -6.239 -6.242 -6.245 -6.248 -6.251 -6.253 -6.255 -6.256 -6.258
+-250 -6.180 -6.187 -6.193 -6.198 -6.204 -6.209 -6.214 -6.219 -6.223 -6.228 -6.232
+
+-240 -6.105 -6.114 -6.122 -6.130 -6.138 -6.146 -6.153 -6.160 -6.167 -6.174 -6.180
+-230 -6.007 -6.017 -6.028 -6.038 -6.049 -6.059 -6.068 -6.078 -6.087 -6.096 -6.105
+-220 -5.888 -5.901 -5.914 -5.926 -5.938 -5.950 -5.962 -5.973 -5.985 -5.996 -6.007
+-210 -5.753 -5.767 -5.782 -5.795 -5.809 -5.823 -5.836 -5.850 -5.863 -5.876 -5.888
+-200 -5.603 -5.619 -5.634 -5.650 -5.665 -5.680 -5.695 -5.710 -5.724 -5.739 -5.753
+
+-190 -5.439 -5.456 -5.473 -5.489 -5.506 -5.523 -5.539 -5.555 -5.571 -5.587 -5.603
+-180 -5.261 -5.279 -5.297 -5.316 -5.334 -5.351 -5.369 -5.387 -5.404 -5.421 -5.439
+-170 -5.070 -5.089 -5.109 -5.128 -5.148 -5.167 -5.186 -5.205 -5.224 -5.242 -5.261
+-160 -4.865 -4.886 -4.907 -4.928 -4.949 -4.969 -4.989 -5.010 -5.030 -5.050 -5.070
+-150 -4.648 -4.671 -4.693 -4.715 -4.737 -4.759 -4.780 -4.802 -4.823 -4.844 -4.865
+
+-140 -4.419 -4.443 -4.466 -4.489 -4.512 -4.535 -4.558 -4.581 -4.604 -4.626 -4.648
+-130 -4.177 -4.202 -4.226 -4.251 -4.275 -4.300 -4.324 -4.348 -4.372 -4.395 -4.419
+-120 -3.923 -3.949 -3.975 -4.000 -4.026 -4.052 -4.077 -4.102 -4.127 -4.152 -4.177
+-110 -3.657 -3.684 -3.711 -3.738 -3.765 -3.791 -3.818 -3.844 -3.871 -3.897 -3.923
+-100 -3.379 -3.407 -3.435 -3.463 -3.491 -3.519 -3.547 -3.574 -3.602 -3.629 -3.657
+
+ -90 -3.089 -3.118 -3.148 -3.177 -3.206 -3.235 -3.264 -3.293 -3.322 -3.350 -3.379
+ -80 -2.788 -2.818 -2.849 -2.879 -2.910 -2.940 -2.970 -3.000 -3.030 -3.059 -3.089
+ -70 -2.476 -2.507 -2.539 -2.571 -2.602 -2.633 -2.664 -2.695 -2.726 -2.757 -2.788
+ -60 -2.153 -2.186 -2.218 -2.251 -2.283 -2.316 -2.348 -2.380 -2.412 -2.444 -2.476
+ -50 -1.819 -1.853 -1.887 -1.920 -1.954 -1.987 -2.021 -2.054 -2.087 -2.120 -2.153
+
+ -40 -1.475 -1.510 -1.545 -1.579 -1.614 -1.648 -1.683 -1.717 -1.751 -1.785 -1.819
+ -30 -1.121 -1.157 -1.192 -1.228 -1.264 -1.299 -1.335 -1.370 -1.405 -1.440 -1.475
+ -20 -0.757 -0.794 -0.830 -0.867 -0.904 -0.940 -0.976 -1.013 -1.049 -1.085 -1.121
+ -10 -0.383 -0.421 -0.459 -0.496 -0.534 -0.571 -0.608 -0.646 -0.683 -0.720 -0.757
+   0  0.000 -0.039 -0.077 -0.116 -0.154 -0.193 -0.231 -0.269 -0.307 -0.345 -0.383
+
+ °C      0     -1     -2     -3     -4     -5     -6     -7     -8     -9    -10
+
+ ITS-90 Table for type T thermocouple
+ °C      0      1      2      3      4      5      6      7      8      9     10
+                               Thermoelectric Voltage in mV
+
+   0  0.000  0.039  0.078  0.117  0.156  0.195  0.234  0.273  0.312  0.352  0.391
+  10  0.391  0.431  0.470  0.510  0.549  0.589  0.629  0.669  0.709  0.749  0.790
+  20  0.790  0.830  0.870  0.911  0.951  0.992  1.033  1.074  1.114  1.155  1.196
+  30  1.196  1.238  1.279  1.320  1.362  1.403  1.445  1.486  1.528  1.570  1.612
+  40  1.612  1.654  1.696  1.738  1.780  1.823  1.865  1.908  1.950  1.993  2.036
+
+  50  2.036  2.079  2.122  2.165  2.208  2.251  2.294  2.338  2.381  2.425  2.468
+  60  2.468  2.512  2.556  2.600  2.643  2.687  2.732  2.776  2.820  2.864  2.909
+  70  2.909  2.953  2.998  3.043  3.087  3.132  3.177  3.222  3.267  3.312  3.358
+  80  3.358  3.403  3.448  3.494  3.539  3.585  3.631  3.677  3.722  3.768  3.814
+  90  3.814  3.860  3.907  3.953  3.999  4.046  4.092  4.138  4.185  4.232  4.279
+
+ 100  4.279  4.325  4.372  4.419  4.466  4.513  4.561  4.608  4.655  4.702  4.750
+ 110  4.750  4.798  4.845  4.893  4.941  4.988  5.036  5.084  5.132  5.180  5.228
+ 120  5.228  5.277  5.325  5.373  5.422  5.470  5.519  5.567  5.616  5.665  5.714
+ 130  5.714  5.763  5.812  5.861  5.910  5.959  6.008  6.057  6.107  6.156  6.206
+ 140  6.206  6.255  6.305  6.355  6.404  6.454  6.504  6.554  6.604  6.654  6.704
+
+ 150  6.704  6.754  6.805  6.855  6.905  6.956  7.006  7.057  7.107  7.158  7.209
+ 160  7.209  7.260  7.310  7.361  7.412  7.463  7.515  7.566  7.617  7.668  7.720
+ 170  7.720  7.771  7.823  7.874  7.926  7.977  8.029  8.081  8.133  8.185  8.237
+ 180  8.237  8.289  8.341  8.393  8.445  8.497  8.550  8.602  8.654  8.707  8.759
+ 190  8.759  8.812  8.865  8.917  8.970  9.023  9.076  9.129  9.182  9.235  9.288
+
+ 200  9.288  9.341  9.395  9.448  9.501  9.555  9.608  9.662  9.715  9.769  9.822
+ 210  9.822  9.876  9.930  9.984 10.038 10.092 10.146 10.200 10.254 10.308 10.362
+ 220 10.362 10.417 10.471 10.525 10.580 10.634 10.689 10.743 10.798 10.853 10.907
+ 230 10.907 10.962 11.017 11.072 11.127 11.182 11.237 11.292 11.347 11.403 11.458
+ 240 11.458 11.513 11.569 11.624 11.680 11.735 11.791 11.846 11.902 11.958 12.013
+
+ 250 12.013 12.069 12.125 12.181 12.237 12.293 12.349 12.405 12.461 12.518 12.574
+ 260 12.574 12.630 12.687 12.743 12.799 12.856 12.912 12.969 13.026 13.082 13.139
+ 270 13.139 13.196 13.253 13.310 13.366 13.423 13.480 13.537 13.595 13.652 13.709
+ 280 13.709 13.766 13.823 13.881 13.938 13.995 14.053 14.110 14.168 14.226 14.283
+ 290 14.283 14.341 14.399 14.456 14.514 14.572 14.630 14.688 14.746 14.804 14.862
+
+ 300 14.862 14.920 14.978 15.036 15.095 15.153 15.211 15.270 15.328 15.386 15.445
+ 310 15.445 15.503 15.562 15.621 15.679 15.738 15.797 15.856 15.914 15.973 16.032
+ 320 16.032 16.091 16.150 16.209 16.268 16.327 16.387 16.446 16.505 16.564 16.624
+ 330 16.624 16.683 16.742 16.802 16.861 16.921 16.980 17.040 17.100 17.159 17.219
+ 340 17.219 17.279 17.339 17.399 17.458 17.518 17.578 17.638 17.698 17.759 17.819
+
+ 350 17.819 17.879 17.939 17.999 18.060 18.120 18.180 18.241 18.301 18.362 18.422
+ 360 18.422 18.483 18.543 18.604 18.665 18.725 18.786 18.847 18.908 18.969 19.030
+ 370 19.030 19.091 19.152 19.213 19.274 19.335 19.396 19.457 19.518 19.579 19.641
+ 380 19.641 19.702 19.763 19.825 19.886 19.947 20.009 20.070 20.132 20.193 20.255
+ 390 20.255 20.317 20.378 20.440 20.502 20.563 20.625 20.687 20.748 20.810 20.872
+
+ 400 20.872
+
+°C      0      1      2      3      4      5      6      7      8      9     10
+
+
+
+************************************
+* This section contains coefficients for type T thermocouples for
+* the two subranges of temperature listed below.  The coefficients
+* are in units of °C and mV and are listed in the order of constant
+* term up to the highest order.   The equation is of the form
+* E = sum(i=0 to n) c_i t^i.
+*
+*     Temperature Range (°C)
+*       -270.000 to 0.000
+*        0.000 °C to 400.000
+************************************
+name: reference function on ITS-90
+type: T
+temperature units: °C
+emf units: mV
+range:  -270.000,      0.000, 14
+ 0.000000000000E+00
+ 0.387481063640E-01
+ 0.441944343470E-04
+ 0.118443231050E-06
+ 0.200329735540E-07
+ 0.901380195590E-09
+ 0.226511565930E-10
+ 0.360711542050E-12
+ 0.384939398830E-14
+ 0.282135219250E-16
+ 0.142515947790E-18
+ 0.487686622860E-21
+ 0.107955392700E-23
+ 0.139450270620E-26
+ 0.797951539270E-30
+range:     0.000,    400.000,  8
+ 0.000000000000E+00
+ 0.387481063640E-01
+ 0.332922278800E-04
+ 0.206182434040E-06
+-0.218822568460E-08
+ 0.109968809280E-10
+-0.308157587720E-13
+ 0.454791352900E-16
+-0.275129016730E-19
+
+
+
+************************************
+* This section contains coefficients of approximate inverse
+* functions for type T thermocouples for the subranges of
+* temperature and voltage listed below. The range of errors of
+* the approximate inverse function for each subrange is also given.
+* The coefficients are in units of °C and mV and are listed in
+* the order of constant term up to the highest order.
+* The equation is of the form t_90 = d_0 + d_1*E + d_2*E^2 + ...
+*     + d_n*E^n,
+* where E is in mV and t_90 is in °C.
+*
+*    Temperature        Voltage            Error
+*      range              range            range
+*      (°C)               (mV)             (° C)
+*    -200. to 0.     -5.603 to 0.000    -0.02 to 0.04
+*     .0 to 400.     0.000 to 20.872    -0.03 to 0.03
+********************************************************
+Inverse coefficients for type T:
+
+Temperature  -200.             0.
+  Range:        0.           400.
+
+  Voltage   -5.603          0.000
+  Range:     0.000         20.872
+
+         0.0000000E+00  0.000000E+00
+         2.5949192E+01  2.592800E+01
+        -2.1316967E-01 -7.602961E-01
+         7.9018692E-01  4.637791E-02
+         4.2527777E-01 -2.165394E-03
+         1.3304473E-01  6.048144E-05
+         2.0241446E-02 -7.293422E-07
+         1.2668171E-03  0.000000E+00
+
+  Error      -0.02          -0.03
+  Range:      0.04           0.03
\ No newline at end of file