11 years, 6 months ago.

MAX31855 main

Dear all,

I am trying to build a main.cpp according to the library given by Joe Staton however, I couldn't figure out how to configure Max31855 SPI pins to p11: Mosi, p12:miso, p13:sck and p14 for cs.

Could you please give your suggestions?

Best regards,

3 Answers

11 years, 6 months ago.

Hi Aykut,

You need to start by defining an SPI interface using pins 11,12 and 13 as such:

//----------------------------------------------------------
//SPI Interfaces
SPI testSPI(p11,p12,p13);
//----------------------------------------------------------

Then, define each MAX31855 using the SPI interface you definined previously and the CS pin (14 in your case):

//----------------------------------------------------------
//Thermocouples
max31855 max1(testSPI,p14);
//----------------------------------------------------------

You're then free to call the functions using the name given (max1):

int main(){
max1.initialise();

float fvalue = 0;

while(1){
  if (max1.ready()==1){
      //Get the reading
      fvalue = max1.read_temp();
  }
}

Hope that helps. Any further questions, let me know.

If I get chance today, I'll write up a sample program and publish it along with library (really should have done that before).

Regards,

Joe

Accepted Answer

Library page updated with sample program.

Sample can also be found here: http://mbed.org/users/Stavlin/code/max31855Sample/

posted by Joe Staton 22 Oct 2012

Thanks a lot Joe , it works just fine. I can transfer thermocouple data to my nokia lcd right now, It will be a modest data logger soon. Regards,

posted by Aykut Sever 22 Oct 2012

Hello Joe,

I'm using the MAX31855 amplifier. In the Output of this component (SO pin in this case) we can read the temperature of the thermocouples, and this is my goal. I have imported the main and the header files of MAX31855 which you had published, but unfortunatly it doesn't work.

Can you tell me if the SPI interface & the thermocouples must be defined in the main or in a headrer file ? And do you think that I have not to use the function DigitalIn to read the temperature value in the output of the MAX31588 ? For Information, I'm using STM32L152RE as MCU.

Any help, will be highly appreciated. Thank you.

posted by Anass KAZIZ 14 Oct 2016
11 years, 6 months ago.

I've not tried the library but it looks like you would create an SPI object and pass that as the first argument, the second argument would be the chip select.

SPI spi(p11, p12, p13);
max31855 therm(spi, p14);

Aykut Sever
poster
11 years, 6 months ago.

Thanks a lot Joe , it works just fine. I can transfer thermocouple data to my nokia lcd right now, It will be a modest data logger soon. Regards,

No problem. It's encouraged me to get a sample program written.

posted by Joe Staton 22 Oct 2012