Library for MAX31850 thermocouple temperature sensor

Embed: (wiki syntax)

« Back to documentation index

MAX31850 Class Reference

MAX31850. More...

#include <MAX31850.h>

Public Member Functions

 MAX31850 (PinName data_pin, PinName power_pin=NC, bool power_polarity=0)
 Create a probe object connected to the specified pins.
void readAll ()
 This routine will initiate the temperature conversion within all MAX31850 probes.
float getTemp (int scale=4)
 This function will return the probe temperature.
unsigned long long getId ()
 This function returns the 64 bit address associated with a particular DS18B20.
void setUnits (int)
 This function sets the _units variable to the users desired temperature units.

Static Public Member Functions

static bool unassignedProbe (PinName pin)
 Function to see if there are MAX31850 devices left on a pin which do not have a corresponding MAX31850 object.

Detailed Description

MAX31850.

Example:

 #include "mbed.h"
 #include "MAX31850.h"

 MAX31850 probe(DATA_PIN);
  
 int main() {
     while(true) {
         probe.convertTemperature(true, MAX31850::all_devices); //Start temperature conversion, wait until ready
         printf("It is %3.1foC\r\n", probe.temperature());
         wait(1);
     }
 }

Definition at line 73 of file MAX31850.h.


Constructor & Destructor Documentation

MAX31850 ( PinName  data_pin,
PinName  power_pin = NC,
bool  power_polarity = 0 
)

Create a probe object connected to the specified pins.

The probe might either by regular powered or parasite powered. If it is parasite powered and power_pin is set, that pin will be used to switch an external mosfet connecting data to Vdd. If it is parasite powered and the pin is not set, the regular data pin is used to supply extra power when required. This will be sufficient as long as the number of probes is limitted.

For our application, we have the functions set up to only use external power. The constructor still supports parasite power but the functions to not support it.

Definition at line 12 of file MAX31850.cpp.


Member Function Documentation

unsigned long long getId (  )

This function returns the 64 bit address associated with a particular DS18B20.

Contributed by John M. Larkin (jlarkin@whitworth.edu)

Returns:
unsigned long long

Definition at line 353 of file MAX31850.cpp.

float getTemp ( int  scale = 4 )

This function will return the probe temperature.

Approximately 10ms per probe to read its scratchpad, do CRC check and convert temperature on the LPC1768.

scale, may be either 'c', 'f', 'k', and 'r'

Returns:
temperature for that scale, or MAX31850::invalid_conversion (-1000) if CRC error detected.

Definition at line 301 of file MAX31850.cpp.

void readAll (  )

This routine will initiate the temperature conversion within all MAX31850 probes.

Definition at line 277 of file MAX31850.cpp.

void setUnits ( int  units )

This function sets the _units variable to the users desired temperature units.

Definition at line 362 of file MAX31850.cpp.

bool unassignedProbe ( PinName  pin ) [static]

Function to see if there are MAX31850 devices left on a pin which do not have a corresponding MAX31850 object.

Returns:
- true if there are one or more unassigned devices, otherwise false

Definition at line 102 of file MAX31850.cpp.