Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 10 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, 10 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
Library page updated with sample program.
Sample can also be found here: http://mbed.org/users/Stavlin/code/max31855Sample/
posted by 22 Oct 2012Thanks 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 22 Oct 2012Hello 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 14 Oct 201611 years, 10 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);