PT100 RTD TEMPERATURE SENSOR AMPLIFIER - MAX31865
Embed:
(wiki syntax)
Show/hide line numbers
max31865.h
00001 #ifndef MBED_MAX31865_H 00002 #define MBED_MAX31865_H 00003 00004 #include "mbed.h" 00005 00006 #define MAX31856_CONFIG_REG 0x00 00007 #define MAX31856_CONFIG_BIAS 0x80 00008 #define MAX31856_CONFIG_MODEAUTO 0x40 00009 #define MAX31856_CONFIG_MODEOFF 0x00 00010 #define MAX31856_CONFIG_1SHOT 0x20 00011 #define MAX31856_CONFIG_3WIRE 0x10 00012 #define MAX31856_CONFIG_24WIRE 0x00 00013 #define MAX31856_CONFIG_FAULTSTAT 0x02 00014 #define MAX31856_CONFIG_FILT50HZ 0x01 00015 #define MAX31856_CONFIG_FILT60HZ 0x00 00016 00017 #define MAX31856_RTDMSB_REG 0x01 00018 #define MAX31856_RTDLSB_REG 0x02 00019 #define MAX31856_HFAULTMSB_REG 0x03 00020 #define MAX31856_HFAULTLSB_REG 0x04 00021 #define MAX31856_LFAULTMSB_REG 0x05 00022 #define MAX31856_LFAULTLSB_REG 0x06 00023 #define MAX31856_FAULTSTAT_REG 0x07 00024 00025 00026 #define MAX31865_FAULT_HIGHTHRESH 0x80 00027 #define MAX31865_FAULT_LOWTHRESH 0x40 00028 #define MAX31865_FAULT_REFINLOW 0x20 00029 #define MAX31865_FAULT_REFINHIGH 0x10 00030 #define MAX31865_FAULT_RTDINLOW 0x08 00031 #define MAX31865_FAULT_OVUV 0x04 00032 00033 typedef enum max31865_numwires { 00034 MAX31865_2WIRE = 0, 00035 MAX31865_3WIRE = 1, 00036 MAX31865_4WIRE = 0 00037 } max31865_numwires_t; 00038 00039 class max31865 { 00040 public: 00041 00042 max31865(PinName MOSI, PinName MISO, PinName SCLK, PinName CS); 00043 00044 void Begin(max31865_numwires_t x = MAX31865_2WIRE); 00045 int ReadFault(); 00046 void ClearFault(); 00047 int ReadRTD(); 00048 00049 void SetWires(max31865_numwires_t wires); 00050 void AutoConvert(bool b); 00051 void EnableBias(bool b); 00052 00053 private: 00054 SPI spi; 00055 DigitalOut cs; 00056 00057 void ReadRegistorN(int address, int buffer[], int n); 00058 00059 int ReadRegistor8(int address); 00060 int ReadRegistor16(int address); 00061 00062 void WriteRegistor(int address, int reg); 00063 int spiXfer(int address); 00064 }; 00065 00066 00067 #endif
Generated on Wed Jul 13 2022 18:39:57 by
1.7.2