You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/SparkFun_MCP9600.h
+43-18Lines changed: 43 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -34,35 +34,53 @@ enum MCP9600_Register {
34
34
HOT_JUNC_TEMP = 0x00,
35
35
DELTA_JUNC_TEMP = 0x01,
36
36
COLD_JUNC_TEMP = 0x02,
37
-
STATUS = 0x04,
37
+
RAW_ADC = 0x03,
38
+
SENSOR_STATUS = 0x04,
38
39
THERMO_SENSOR_CONFIG = 0x05,
39
40
DEVICE_CONFIG = 0x06,
40
41
DEVICE_ID = 0x20,
41
42
};
42
43
43
-
enumthermocoupleType {
44
-
K_type = 0b000,
45
-
J_type = 0b001,
46
-
T_type = 0b010,
47
-
N_type = 0b011,
48
-
S_type = 0b100,
49
-
E_type = 0b101,
50
-
B_type = 0b110,
51
-
R_type = 0b111,
44
+
enumThermocouple_Type {
45
+
TYPE_K = 0b000,
46
+
TYPE_J = 0b001,
47
+
TYPE_T = 0b010,
48
+
TYPE_N = 0b011,
49
+
TYPE_S = 0b100,
50
+
TYPE_E = 0b101,
51
+
TYPE_B = 0b110,
52
+
TYPE_R = 0b111,
52
53
};
53
54
54
-
enumambientResolution {
55
+
enumAmbient_Resolution {
55
56
RES_ZERO_POINT_0625 = 0b0,
56
57
RES_ZERO_POINT_25 = 0b1,
57
58
};
58
59
59
-
enumthermocoupleResolution {
60
+
enumThermocouple_Resolution {
60
61
RES_18_BIT = 0b00,
61
62
RES_16_BIT = 0b01,
62
63
RES_14_BIT = 0b10,
63
64
RES_12_BIT = 0b11,
64
65
};
65
66
67
+
enum Burst_Sample {
68
+
SAMPLES_1 = 0b000,
69
+
SAMPLES_2 = 0b001,
70
+
SAMPLES_4 = 0b010,
71
+
SAMPLES_8 = 0b011,
72
+
SAMPLES_16 = 0b100,
73
+
SAMPLES_32 = 0b101,
74
+
SAMPLES_64 = 0b110,
75
+
SAMPLES_128 = 0b111,
76
+
};
77
+
78
+
enum Shutdown_Mode {
79
+
NORMAL = 0b00,
80
+
SHUTDOWN = 0b01,
81
+
BURST = 0b10,
82
+
};
83
+
66
84
classMCP9600{
67
85
public:
68
86
@@ -79,18 +97,25 @@ class MCP9600{
79
97
floatthermocoupleTemp(); //Returns the thermocouple temperature in degrees Celcius
80
98
floatambientTemp(); //Returns the ambient (IC die) temperature in degrees Celcius
81
99
floattempDelta(); //Returns the difference in temperature between the thermocouple and ambient junctions, in degrees Celcius
100
+
signedlongrawADC(); //Returns the raw contents of the raw ADC register
82
101
83
102
//Measurement configuration
84
-
boolsetAmbientResolution(ambientResolution res);//Changes the resolution on the cold (ambient) junction, for either 0.0625 or 0.25 degree C resolution. Lower resolution reduces conversion time.
85
-
ambientResolutiongetAmbientResolution();//Returns the resolution on the cold (ambient) junction, for either 0.0625 or 0.25 degree C resolution. Lower resolution reduces conversion time.
86
-
boolsetThermocoupleResolution(thermocoupleResolution res);//Changes the resolution on the hot (thermocouple) junction, for either 18, 16, 14, or 12-bit resolution. Lower resolution reduces conversion time.
87
-
thermocoupleResolutiongetThermocoupleResolution();//Returns the resolution on the hot (thermocouple) junction, for either 18, 16, 14, or 12-bit resolution. Lower resolution reduces conversion time.
103
+
boolsetAmbientResolution(Ambient_Resolution res); //Changes the resolution on the cold (ambient) junction, for either 0.0625 or 0.25 degree C resolution. Lower resolution reduces conversion time.
104
+
Ambient_ResolutiongetAmbientResolution(); //Returns the resolution on the cold (ambient) junction, for either 0.0625 or 0.25 degree C resolution. Lower resolution reduces conversion time.
105
+
boolsetThermocoupleResolution(Thermocouple_Resolution res); //Changes the resolution on the hot (thermocouple) junction, for either 18, 16, 14, or 12-bit resolution. Lower resolution reduces conversion time.
106
+
Thermocouple_ResolutiongetThermocoupleResolution(); //Returns the resolution on the hot (thermocouple) junction, for either 18, 16, 14, or 12-bit resolution. Lower resolution reduces conversion time.
88
107
89
-
uint8_tsetThermocoupleType(thermocoupleType type);//Changes the type of thermocouple connected to the MCP9600. Supported types are KJTNSEBR.
90
-
thermocoupleTypegetThermocoupleType();//Returns the type of thermocouple connected to the MCP9600 as found in its configuration register. Supported types are KJTNSEBR.
108
+
uint8_tsetThermocoupleType(Thermocouple_Type type); //Changes the type of thermocouple connected to the MCP9600. Supported types are KJTNSEBR.
109
+
Thermocouple_TypegetThermocoupleType(); //Returns the type of thermocouple connected to the MCP9600 as found in its configuration register. Supported types are KJTNSEBR.
91
110
uint8_tsetFilterCoeffecients(uint8_t coeffecient); //Changes the weight of the on-chip exponential moving average filter. Set this to 0 for no filter, 1 for minimum filter, and 7 for maximum filter.
92
111
uint8_tgetFilterCoeffecients(); //Returns the weight of the on-chip exponential moving average filter.
93
112
113
+
boolsetBurstSamples(Burst_Sample samples); //Changes the amount of samples to take in burst mode. Returns 0 if set sucessfully, 1 otherwise.
114
+
Burst_Sample getBurstSamples(); //Returns the amount of samples to take in burst mode, according to the device's configuration register.
115
+
boolburstAvailable(); //Returns true if all the burst samples have been taken and the results are ready. Returns false otherwise.
116
+
boolstartBurst(); //Initiates a burst on the MCP9600.
117
+
boolsetShutdownMode(Shutdown_Mode mode); //Changes the shutdown "operating" mode of the MCP9600. Configurable to Normal, Shutdown, and Burst. Returns 0 if properly set, 1 otherwise.
118
+
Shutdown_Mode getShutdownMode(); //Returns the shutdown "operating" mode of the MCP9600. Configurable to Normal, Shutdown, and Burst.
0 commit comments