Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MAX31856_example_program by
Diff: MAX31856.cpp
- Revision:
- 10:4b907f32b4d4
- Parent:
- 9:2d284cc2f65c
diff -r 2d284cc2f65c -r 4b907f32b4d4 MAX31856.cpp
--- a/MAX31856.cpp Tue Aug 01 03:37:57 2017 +0000
+++ b/MAX31856.cpp Tue Aug 01 03:39:32 2017 +0000
@@ -588,27 +588,6 @@
return buf_read;
}
-
-
-
-
-
-
-
-
-
-///Define parameters for control register one (CR1)
-/** Adding Samples increases the conversion time and reduces noise.
- Typical conversion times:
- 1-shot or first conversion in Auto mode:
- = t_Conversion + (samples-1)*33.33mS (60Hz rejection)
- = t_Conversion + (samples-1)*40.00mS (50Hz rejection)
- 2 thru n conversions in Auto mode:
- = t_Conversion + (samples-1)*16.67mS (60Hz rejection)
- = t_Conversion + (samples-1)*20.00mS (50Hz rejection)
-*/
-
-
//******************************************************************************
void MAX31856::calculateDelayTime() {
uint32_t temp_int;
@@ -638,167 +617,3 @@
//empty block
}
-
-//
-//
-//
-//auto 50 169
-//auto 60 143
-//1shot 50 98
-//1shot 60 82
-
-
-//*****************************************************************************
-//EXTRA
-//*****************************************************************************
-//bool MAX31856::checkFaultsAll()
-//{
-// uint8_t temp[9];
-// uint8_t buf_read, buf_write=ADDRESS_SR_READ;
-//
-// spiEnable();
-// buf_read=spi.write(buf_write);
-// buf_read=spi.write(buf_write);
-// spiDisable();
-// for(int i=0; i<9; i++)
-// temp[i]=buf_read;
-//
-// //Check if any of the faults are triggered
-// if ((temp[0]&0xFF)==0) //means no fault is detected
-// return_val=1;
-// else{
-// if (temp[0]&0x80) {
-// LOG("Cold Junction out of range fault is triggered! ");
-// return_val=0;
-// }
-// if (temp[1]&0x40) {
-// LOG("Thermocouple out of range fault is triggered! ");
-// return_val=0;
-// }
-// if (temp[2]&0x20) {
-// LOG("Temperature is higher than the threshold that is set!\r\n");
-// return_val=0;
-// }
-// if (temp[3]&0x10) {
-// LOG("Temperature is lower than the threshold that is set!\r\n");
-// return_val=0;
-// }
-// if (temp[4]&0x08) {
-// LOG("Temperature is higher than the threshold that is set!\r\n");
-// return_val=0;
-// }
-// if (temp[5]&0x04) {
-// LOG("Temperature is lower than the threshold that is set!\r\n");
-// return_val=0;
-// }
-// if (temp[6]&0x02) {
-// LOG("Overvotage/Undervoltage Fault triggered! Input voltage is negative or the voltage is greater than Vdd! Please check thermocouple connection!\r\n");
-// return_val=0;
-// }
-// if (temp[7]&0x01) {
-// LOG("Open circuit fault detected! Please check thermocouple connection!\r\n");
-// return_val=0;
-// }
-// }
-// return return_val;
-//}
-
-
-
-////******************************************************************************
-//int8_t MAX31856::twosComplimentToSigned8(int8_t temp)
-//{
-// temp=(~(temp)+1); //Take two's complement of the negative number
-// temp|=(int8_t)(0x80UL); //And convert it into 7-bit val with msb as sign bit
-// return temp;
-//}
-
-
-
-////******************************************************************************
-//int16_t MAX31856::twosComplimentToSigned16(int16_t temp)
-//{
-// temp=(~(temp)+1); //Take two's complement of the negative number
-// temp|=(int16_t)(0x8000UL); //And convert it into 15-bit val with msb as sign bit
-// return temp;
-//}
-
-////Register:MASK Bits: 5:0
-////******************************************************************************
-//float MAX31856::setFaultThresholds(uint8_t val, bool enable_mask, float temperature)
-//{
-// float return_val;
-// uint8_t temp_val;
-// if(enable_mask) {
-// temp_val=0;
-// }
-// else {
-// temp_val=val;
-// }
-// if (val==MASK_CJ_FAULT_THRESHOLD_HIGH) { //Cold Junction High Threshold Fault Mask
-// return_val=registerReadWriteByte(ADDRESS_MASK_READ, ADDRESS_MASK_WRITE, MASK_CLEAR_BITS_5, temp_val);
-//
-// int8_t temperature_byte=temperature;
-//
-// if (temperature_byte>CJ_MAX_VAL_FAULT)
-// temperature_byte=CJ_MAX_VAL_FAULT;
-// else if (temperature_byte<=0 || temperature_byte>=CJ_MIN_VAL_FAULT)
-// temperature_byte=twosComplimentToSigned8(temperature_byte); //Convert the 2's compliment int into a signed value
-// else if (temperature_byte<CJ_MIN_VAL_FAULT)
-// temperature_byte=twosComplimentToSigned8(CJ_MIN_VAL_FAULT); //Convert the 2's compliment int into a signed value
-// //else the data is within range, no more manipulation of data is needed
-// return_val=registerWriteByte(ADDRESS_CJHF_WRITE, temperature_byte);
-// }
-// else if (val==MASK_CJ_FAULT_THRESHOLD_LOW) { //Cold Junction Low Threshold Fault Mask
-// return_val=registerReadWriteByte(ADDRESS_MASK_READ, ADDRESS_MASK_WRITE, MASK_CLEAR_BITS_4, temp_val);
-//
-// int8_t temperature_byte=temperature;
-//
-// if (temperature_byte>CJ_MAX_VAL_FAULT)
-// temperature_byte=CJ_MAX_VAL_FAULT;
-// else if (temperature_byte<=0 || temperature_byte>=CJ_MIN_VAL_FAULT)
-// temperature_byte=twosComplimentToSigned8(temperature_byte); //Convert the 2's compliment int into a signed value
-// else if (temperature_byte<CJ_MIN_VAL_FAULT)
-// temperature_byte=twosComplimentToSigned8(CJ_MIN_VAL_FAULT); //Convert the 2's compliment int into a signed value
-// //else the data is within range, no more manipulation of data is needed
-//
-// return_val=registerWriteByte(ADDRESS_CJLF_WRITE, temperature_byte);
-// }
-// else if (val==MASK_TC_FAULT_THRESHOLD_HIGH) { //Thermocouple High Threshold Fault Mask
-// return_val=registerReadWriteByte(ADDRESS_MASK_READ, ADDRESS_MASK_WRITE, MASK_CLEAR_BITS_3, temp_val);
-//
-// if (temperature) {
-// int8_t temperature_byte[2];
-// int16_t temperature_multi_byte =(int16_t)(temperature*4.0);
-// if (temperature_multi_byte>(TC_MAX_VAL_FAULT*4.0f))
-// temperature_multi_byte=TC_MAX_VAL_FAULT*4.0f;
-// else if (temperature_multi_byte<=0 || temperature_multi_byte>=(TC_MIN_VAL_FAULT*4.0f))
-// temperature_multi_byte=twosComplimentToSigned16(temperature_multi_byte); //Convert the 2's compliment int into a signed value
-// else if (temperature_multi_byte<(TC_MIN_VAL_FAULT*4.0f))
-// temperature_multi_byte=twosComplimentToSigned16(TC_MIN_VAL_FAULT*4.0f); //Convert the 2's compliment int into a signed value
-//
-// //now split up the 32bit int into two bytes to program the registers with
-// temperature_byte[0]=((uint8_t)((temperature_multi_byte)&(0xFF00) >> 8));
-// temperature_byte[1]=((uint8_t)((temperature_multi_byte)&(0x00FF)));
-//
-// return_val=registerWriteByte(ADDRESS_LTHFTH_WRITE, temperature_byte[0]);
-// return_val=registerWriteByte(ADDRESS_LTHFTL_WRITE, temperature_byte[1]);
-//
-// return_val=temperature;
-// }
-//// else {
-//// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////return_val="WHATEVER IS IN THE REGISTERS WHEN YOU SET THE FLAG JUST INCASE YOU NEED TO SEE WHAT IS INSISIDE THE REGISTER";
-//// }
-// }
-// else if (val==MASK_TC_FAULT_THRESHOLD_LOW) //Thermocouple Low Threshold Fault Mask
-// return_val=registerReadWriteByte(ADDRESS_MASK_READ, ADDRESS_MASK_WRITE, MASK_CLEAR_BITS_2, temp_val);
-// else if (val==MASK_OVER_UNDER_VOLT_FAULT) //Over-Voltage/Under-Voltage Input Fault Mask
-// return_val=registerReadWriteByte(ADDRESS_MASK_READ, ADDRESS_MASK_WRITE, MASK_CLEAR_BITS_1, temp_val);
-// else if (val==MASK_OPEN_CIRCUIT_FAULT) //Thermocouple Open-Circuit Fault Mask
-// return_val=registerReadWriteByte(ADDRESS_MASK_READ, ADDRESS_MASK_WRITE, MASK_CLEAR_BITS_0, temp_val);
-// else {
-// LOG("Incorrect parameter selected for MASK Register. Default value not changed.\r\nPlease see MAX31856.h for list of valid parameters. \r\n");
-// return_val=0; //returns a 0 to flag that the parameter wasn't programmed due to wrong parameter in function call
-// }
-// return return_val;
-//}
\ No newline at end of file
