Having trouble with SERIN command and MAX6675


Closed Thread
Results 1 to 40 of 40

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    for a start your temp var is a declared as byte , how can 12 bit reading fit in that ?
    Warning I'm not a teacher

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    I corrected my code just after I sent it - couldn't edit the post anymore, should have mentionned it, sorry
    Roger

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    Anyway, I understand the calculation to get the temperature value BUT why do I have around 5°C diffrence between the thermocouple and my home thermometer?

    Must a thermocouple be kind of "adjusted" (correct the result in the code) or something like that?
    Roger

  4. #4
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    My actual code is:
    Code:
    ' ====== FUSES ====================================================================================
    ' PIC 16F690
    @ __Config _FCMEN_OFF &_IESO_OFF &_CPD_OFF &_WDT_OFF &_INTRC_OSC_NOCLKOUT &_BOR_OFF &_CP_OFF &_PWRTE_OFF &_MCLRE_OFF 
    
    ' ====== DEFINES ==================================================================================
    DEFINE OSC 4
    
    DEFINE SHIFT_PAUSE 250  'for MAX6675 conversion time
    
    DEFINE LCD_DREG PORTC   'LCD data port 
    DEFINE LCD_DBIT 0       'LCD data starting bit 0 or 4 on µC 
    DEFINE LCD_RSREG PORTC  'LCD Register Select port 
    DEFINE LCD_RSBIT 4      'LCD Register Select bit 
    DEFINE LCD_EREG PORTC   'LCD Enable port 
    DEFINE LCD_EBIT 5       'LCD Enable bit 
    DEFINE LCD_BITS 4       'LCD bus size 4 or 8 
    DEFINE LCD_LINES 2      'Number lines on LCD 
    
    ' ====== REGISTERS ================================================================================
    '             76543210
    OPTION_REG = %10000000 ' PORT A&B Pull-Ups disabled (look WPUA & WPUB)
    'OSCCON     = %01100000 ' Internal RC set to 4Mhz - not to be used with XTal
    ANSEL      = %00000000 ' Analog inputs Channels 0 to 7
    ANSELH     = %00000000 ' Analog inputs Channels 8 to 11
    ADCON0     = %00000000 ' A/D Module is OFF
    CM1CON0    = %00000000 ' Comparator1 Module is OFF
    CM2CON0    = %00000000 ' Comparator2 Module is OFF
    INTCON     = %00000000 ' INTerrupts CONtrol / RA2 is ON
    PORTA      = %00000000 ' Ports High/Low (0 to 5)
    TRISA      = %00000000 ' Set Input/Output (0 to 5)
    PORTB      = %00000000 ' Ports High/Low (4 to 7)
    TRISB      = %00000000 ' Set Input/Output (4 to 7)
    PORTC      = %00000000 ' Ports High/Low (0 to 7)
    TRISC      = %00000000 ' Set Input/Output (0 to 7)
    
    ' ====== VARIABLES ================================================================================
    MAX6675_SDO var PORTB.4
    MAX6675_CS  var PORTB.5
    MAX6675_SCK var PORTB.6
    
    Temperature var word
    Temperature = 0
    
    ' ====== PROGRAM ==================================================================================
    
    MAX6675_READ:
        
        MAX6675_CS = 0
        shiftin MAX6675_SDO,MAX6675_SCK,0,[Temperature\16]
        MAX6675_CS = 1
    
        Temperature = Temperature >> 3
        
        lcdout $FE,2,DEC Temperature/4,",",DEC (Temperature//4)*25," C"
        
        PAUSE 1000
    
    Goto MAX6675_READ:
    
    END
    Roger

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    if you have cheap ebay sourced k type probes a reading of 5 -+ is typical , they seem more accurate [precise anyway] at higher temps >200c
    but there is still a fair spread of variation in the readings

    how to interpret reading
    Attached Images Attached Images  
    Warning I'm not a teacher

  6. #6
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    Thanks Richard,

    With your calculation example you gave me above, I could understand how to read my result.

    Do you know if thermocouples are "qualified" according to their precision?

    PS: yup, mine has made the travel from China
    Roger

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    Do you know if thermocouples are "qualified" according to their precision?
    not cheapies on ebay .

    a more likely source of some probes with actual specs would be rs components ,farnel/element14 ,digikey or similar
    but they will cost more.

    I have never had the need for real absolute accuracy and just add or subtract a suitable offset to compensate for error,
    so far it works acceptably for my 3d printer [precision being more important]
    Warning I'm not a teacher

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    And I will add... Take extra care with your cold junctions. The 6675 does a good job compensating if the junction is close and in the same environment as it is. As do not have the cold junction on the outside of an enclosure and the 6675 on the inside. And noise that can be picked up from breadboard connections can be trouble.
    Dave
    Always wear safety glasses while programming.

Members who have read this thread : 2

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

Posting Permissions

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