Library to interface with the MAX31855 Cold Junction Compensated Thermocouple-to-Digital Converter
Dependents: max31855Sample Reflow_Oven_Controller test_draft Soldering_Tips_Thermometer
You are viewing an older revision! See the latest version
Homepage
Interface library for the MAX31855 Cold Junction Compendated Thermocouple-to-Digital Converter. This part is the reaplacement for the now discontinued MAX6675. The library is based on the original MAX6675 library found on this site altered to fit the serial specification of the new chip as well as adding a few new features.
The main new feature of note is that the library itself deals with the 0.25 second delay required to complete a conversion. Polling the 'ready()' function will return a '1' when the chip is read to submit a new reading.
#include "mbed.h" #include "max31855.h" DigitalOut myled(LED1); //---------------------------------------------------------- //SPI Interfaces SPI testSPI(p11,p12,p13); //---------------------------------------------------------- //---------------------------------------------------------- //Thermocouples max31855 max1(testSPI,p21); //---------------------------------------------------------- int main() { //Initialise chip (starts internal timer) max1.initialise(); //Float value to hold temperature returned float fvalue = 0; while(1) { //Check if the chip is ready for a reading to be taken if (max1.ready()==1){ //Get the reading fvalue = max1.read_temp(); printf("Temperature is: %f\n\r", fvalue); } //Heartbeat signal (not necessary) myled = !myled; //Delay is not required, here simply for test program wait(0.25); } }