help reading individual thermos

i have a quad max31865 TC board and Im using the following code adapted from the playing with fusion library example

however, im having a hard time trying to get something to work so i can print to an LCD, bluetooth etc

Im wanting something like this:
TC0 = print31856Results(&TC_CH0);
TC1= print31856Results(&TC_CH1);

how do i do that?

#include "PlayingWithFusion_MAX31856.h"
#include "PlayingWithFusion_MAX31856_STRUCT.h"
#include "SPI.h"

uint8_t TC0_CS  =  7;
uint8_t TC1_CS  =  8;
uint8_t TC2_CS  =  9;
uint8_t TC3_CS  = 10;

PWF_MAX31856  thermocouple0(TC0_CS);
PWF_MAX31856  thermocouple1(TC1_CS);
PWF_MAX31856  thermocouple2(TC2_CS);
PWF_MAX31856  thermocouple3(TC3_CS);
struct var_max31856 TC_CH0, TC_CH1, TC_CH2, TC_CH3;

// proto for display results function
void print31856Results(struct var_max31856 *tc_ptr);

void setup()
{ // give chip a chance to stabilize
  Serial.begin(9600);                   // set baudrate of serial port

  // setup for the the SPI library:
  SPI.begin();                            // begin SPI
  SPI.setClockDivider(SPI_CLOCK_DIV64);   // SPI speed to SPI_CLOCK_DIV16 (1MHz)
  SPI.setDataMode(SPI_MODE1);             // MAX31856 is a MODE3 device

  // call config command... options can be seen in the PlayingWithFusion_MAX31856.h file
  thermocouple0.MAX31856_config(K_TYPE, CUTOFF_60HZ, AVG_SEL_1SAMP, CMODE_AUTO);
  thermocouple1.MAX31856_config(K_TYPE, CUTOFF_60HZ, AVG_SEL_1SAMP, CMODE_AUTO);
  thermocouple2.MAX31856_config(K_TYPE, CUTOFF_60HZ, AVG_SEL_1SAMP, CMODE_AUTO);
  thermocouple3.MAX31856_config(K_TYPE, CUTOFF_60HZ, AVG_SEL_1SAMP, CMODE_AUTO);
}

void loop()
{

  delay(100);                                   // 500ms delay... can be as fast as ~100ms in continuous mode, 1 samp avg

  // Read CH 0
  thermocouple0.MAX31856_update(&TC_CH0);        // Update MAX31856 channel 0
  // Read CH 1
  thermocouple1.MAX31856_update(&TC_CH1);        // Update MAX31856 channel 1
  // Read CH 2
  thermocouple2.MAX31856_update(&TC_CH2);        // Update MAX31856 channel 2
  // Read CH 3
  thermocouple3.MAX31856_update(&TC_CH3);        // Update MAX31856 channel 3


  // ##### Print information to serial port ####
  Serial.print("TC_0: ");
  // Print TC0 header
  print31856Results(&TC_CH0);

  Serial.println(" ");

  Serial.print("TC_1: ");            // Print TC1 header
  print31856Results(&TC_CH1);
  Serial.println(" ");

  Serial.print("TC_2: ");            // Print TC2 header
  print31856Results(&TC_CH2);
  Serial.println(" ");

  Serial.print("TC_3: ");            // Print TC3 header
  print31856Results(&TC_CH3);
  Serial.println(" ");
}

void print31856Results(struct var_max31856 *tc_ptr)
{
  double tmp;
  // MAX31856 External (thermocouple) Temp
  tmp = (double)((tc_ptr->lin_tc_temp * 0.0078125) * 9 / 5) + 32;     // convert fixed pt # to double
  // print TC temp heading
  Serial.print(tmp);
}

Qhergt1987:
Im I'm using the following code adapted from the playing with fusion library example

It would be ever so helpful if you were to post a link to that library.

You mean something like this? Where TC0 and TC1 are double.

double print31856Results(struct var_max31856 *tc_ptr)
{
  double tmp;
  // MAX31856 External (thermocouple) Temp
  tmp = (double)((tc_ptr->lin_tc_temp * 0.0078125) * 9 / 5) + 32;     // convert fixed pt # to double
  // print TC temp heading
  Serial.print(tmp);
  return tmp;
}

ToddL1962:
You mean something like this? Where TC0 and TC1 are double.

double print31856Results(struct var_max31856 *tc_ptr)

{
 double tmp;
 // MAX31856 External (thermocouple) Temp
 tmp = (double)((tc_ptr->lin_tc_temp * 0.0078125) * 9 / 5) + 32;     // convert fixed pt # to double
 // print TC temp heading
 Serial.print(tmp);
 return tmp;
}

i guess that may work.

how would i do that?

double TC0;
double TC1;

TC0 =  print31856Results(&TC_CH0);
TC1=  print31856Results(&TC_CH1);

Now you have the the double values that were printed to the serial port. You can print those values to an LCD or bluetooth.

thanks, I tried that in loop, as well as under the void print31865 results and had the same error come up

In function 'void loop()':

qtc:41:33: error: void value not ignored as it ought to be

 TC0 =  print31856Results(&TC_CH0);

                                 ^

qtc:42:32: error: void value not ignored as it ought to be

 TC1=  print31856Results(&TC_CH1);

                                ^

exit status 1
void value not ignored as it ought to be

Did you change return type from void to double?

Repost your sketch and I will try it.

No I did not.

I kept the void printresults.

void print31856Results(struct var_max31856 *tc_ptr)
{
double tmp;
// MAX31856 External (thermocouple) Temp
tmp = (double)((tc_ptr->lin_tc_temp * 0.0078125) * 9 / 5) + 32; // convert fixed pt # to double
// print TC temp heading
Serial.print(tmp);
}

If you code it and call it like I posted it I don’t see why it wouldn’t work.

still no luck

#include "PlayingWithFusion_MAX31856.h"
#include "PlayingWithFusion_MAX31856_STRUCT.h"
#include "SPI.h"

uint8_t TC0_CS  =  7;
uint8_t TC1_CS  =  8;
uint8_t TC2_CS  =  9;
uint8_t TC3_CS  = 10;

PWF_MAX31856  thermocouple0(TC0_CS);
PWF_MAX31856  thermocouple1(TC1_CS);
PWF_MAX31856  thermocouple2(TC2_CS);
PWF_MAX31856  thermocouple3(TC3_CS);
struct var_max31856 TC_CH0, TC_CH1, TC_CH2, TC_CH3;
// proto for display results function
void print31856Results(struct var_max31856 *tc_ptr);

void setup()
{ // give chip a chance to stabilize
  Serial.begin(9600);                   // set baudrate of serial port

  // setup for the the SPI library:
  SPI.begin();                            // begin SPI
  SPI.setClockDivider(SPI_CLOCK_DIV64);   // SPI speed to SPI_CLOCK_DIV16 (1MHz)
  SPI.setDataMode(SPI_MODE1);             // MAX31856 is a MODE3 device

  // call config command... options can be seen in the PlayingWithFusion_MAX31856.h file
  thermocouple0.MAX31856_config(K_TYPE, CUTOFF_60HZ, AVG_SEL_1SAMP, CMODE_AUTO);
  thermocouple1.MAX31856_config(K_TYPE, CUTOFF_60HZ, AVG_SEL_1SAMP, CMODE_AUTO);
  thermocouple2.MAX31856_config(K_TYPE, CUTOFF_60HZ, AVG_SEL_1SAMP, CMODE_AUTO);
  thermocouple3.MAX31856_config(K_TYPE, CUTOFF_60HZ, AVG_SEL_1SAMP, CMODE_AUTO);
}

void loop()
{

  delay(100);                                   // 500ms delay... can be as fast as ~100ms in continuous mode, 1 samp avg

  // Read CH 0
  thermocouple0.MAX31856_update(&TC_CH0);        // Update MAX31856 channel 0
  // Read CH 1
  thermocouple1.MAX31856_update(&TC_CH1);        // Update MAX31856 channel 1
  // Read CH 2
  thermocouple2.MAX31856_update(&TC_CH2);        // Update MAX31856 channel 2
  // Read CH 3
  thermocouple3.MAX31856_update(&TC_CH3);        // Update MAX31856 channel 3


  // ##### Print information to serial port ####
  Serial.print("TC_0: ");
  print31856Results(&TC_CH0);
  Serial.println(" ");

  Serial.print("TC_1: ");            
  print31856Results(&TC_CH1);
  Serial.println(" ");

  Serial.print("TC_2: ");            
  print31856Results(&TC_CH2);
  Serial.println(" ");

  Serial.print("TC_3: ");            // Print TC3 header
  print31856Results(&TC_CH3);
  Serial.println(" ");

}

double print31856Results(struct var_max31856 *tc_ptr)
{
  double tmp;
double tc0;
double tc1;
  // MAX31856 External (thermocouple) Temp
  tmp = (double)((tc_ptr->lin_tc_temp * 0.0078125) * 9 / 5) + 32;     // convert fixed pt # to double
tc0 =  print31856Results(&TC_CH0);
tc1 =  print31856Results(&TC_CH1);
  // print TC temp heading
  Serial.print(tmp);
}

error message: exit status 1
ambiguating new declaration of 'double print31856Results(var_max31856*)'

maybe library issue??