Max31855 Thermocouple Temperature Reading


Results 1 to 6 of 6

Threaded View

  1. #1
    Lefteris's Avatar
    Lefteris Guest

    Smile Max31855 Thermocouple Temperature Reading

    I was looking hard to find a picbasic code for the new MAX31855 from Maxim but I could't find anywhere.
    This is a nice chip to read temperature from -210 up to 1300 C for many types of thermocouples with internal ColdJuction and faults report!!.
    Here is datasheet for details : http://datasheets.maximintegrated.co...s/MAX31855.pdf

    Thermocouples are using for high temperatures, so I am not interesting for negative sign !!!
    I send data to PC using Hyperterminal at 9600 bauds.
    Brown out detect is disable So I can use 3.3 Volts supply on my pic16f877A
    I hope this code is usefull for you as is for me!

    Code:
    define OSC 20
    @ DEVICE PIC16F877A,HS_OSC,WDT_ON,MCLR_OFF,BOD_Off,LVP_OFF,PROTECT_OFF
    include "modedefs.bas"
    
    
    '----- Data Output To Pc Without MAX232 at 9600bauds reverse ----
    
    DataTx var portc.6  'TX serial data to PC 
    BaudTx con 16468     '9600 bauds reverse
    
    
    
    'Alias pins - MAX31855 temp sensor
           MXSCLK      var     PORTD.0   'MAX31855 Clock 
           MXCS        var     PORTD.1   'MAX31855 Chip Select 
           MXSO        Var     PORTD.3   'MAX31855 Serial Data  
           '--Variables----------------------- 
           TCtemp       var     word    'raw data from MAX31855
           tempC       var     word    'temperature in degrees C 
           tempF       var     word    'temp C converted to degrees F  
           CJtemp       var     word    'raw data from MAX31855
           tempcjC       var     word    'temperature ColdJuction in degrees C 
           tempcjF       var     word    'ColdJuction C converted to degrees F  
         
    
    
      '-----------Read and display temperature from MAX31855----------- 
      
           main: 
      
           'Read Temp of Thermocouple
           
           LOW MXCS                            'chip select low     
           shiftin MXSO, MXSCLK, 0, [TCtemp\16] 'shift in the data     
           HIGH MXCS                           'chip select high     
          tempC =   TCtemp >> 4              'side shift to ditch the stuff to the right of the decimal point and just show whole degrees)       
          tempF = ((tempC * 18)/10) + 32      'convert C to F             
         
         '--------- Send Temp To PC ------------------
          if TempC.bit11 = 0 then        'Positive Sign of Temperature
          SEROUT2 DataTx,BaudTx, ["Theromocouple ",dec tempc ," degrees C  ",dec tempF," degrees F  " ,10,13 ] 'display the data on PC     
           PAUSE 1000
           else 
            SEROUT2 DataTx,BaudTx, ["OUT of Range ",10,13 ]
            pause 1000
                 endif
           
          'Read Temp of ColdJuction 
           LOW MXCS                            'chip select low     
           shiftin MXSO, MXSCLK, 0, [CJtemp\32] 'shift in the data     
           HIGH MXCS                           'chip select high     
          tempcjC  =   CJtemp>> 8                 'side shift to ditch the stuff to the right of the decimal point and just show whole degrees)       
          tempcjF  = ((tempcjC * 18)/10) + 32      'convert C to F             
         
          
          
          '--------- Send Cj Temp To PC ------------------
          SEROUT2 DataTx,BaudTx, ["ColdJuction ",dec tempcjc ," degrees C  ",dec tempcjF," degrees F  " ,10,13 ] 'display the data on PC    
           pause 1000
         
         
         'Check Thermocouple Status
          IF CJtemp.bit0=1  THEN
          SEROUT2 DataTx,BaudTx, [" NO CONNECTION  " ,10,13 ] 'display the data on PC    
               pause 1000  
           ENDIF
       
         IF CJtemp.bit1=1  THEN
          SEROUT2 DataTx,BaudTx, [" SHORT to GND " ,10,13 ] 'display the data on PC 
              pause 1000  
           ENDIF
    
            IF CJtemp.bit2=1  THEN
          SEROUT2 DataTx,BaudTx, [" SHORT to VCC   " ,10,13 ] 'display the data on PC  
        PAUSE 1000 
           ENDIF 
           
           goto main    
           end
    Last edited by Archangel; - 21st January 2015 at 02:55.

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts