Having trouble with SERIN command and MAX6675


Closed Thread
Results 1 to 40 of 40

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    What does "Invalid RAM location specified" mean?
    In this case it means you are compiling a LCDOUT command without having LCD defines.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Dec 2010
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    In this case it means you are compiling a LCDOUT command without having LCD defines.
    Alright, I put my LCD defines into the code and i get a readout of 32 degrees F (the temp probe on my multimeter reads the room is 70 degrees F), but the temperature didn't change when I put a lighter to the temp probe. I added a main loop to cycle through the program but that didn't help. Is it something with the SHIFTIN command or could I have fried the surface mount chip when soldering leads to it?
    And thank you for your help. I've been working on this for weeks with no turnout.

    Here is my current code:

    Code:
    INCLUDE "modedefs.bas"
    
    define    OSC 4
    
    'Define LCD registers and bits
    DEFINE LCD_DREG PORTC 'Define PIC port used for LCD Data lines
    DEFINE LCD_DBIT 0 'LCD Data Starting Bit = Bit 0 or 4
    DEFINE LCD_EREG PORTC 'Define PIC port used for E line of LCD
    DEFINE LCD_EBIT 5 'Define Port pin used for E connection
    DEFINE LCD_RSREG PORTC 'Define PIC port used for RS line of LCD
    DEFINE LCD_RSBIT 4 'Define Port pin used for RS connection
    DEFINE LCD_BITS 4 'Define the 4 bit communication mode to LCD
    DEFINE LCD_LINES 2 'Define using a 2 line LCD
    DEFINE LCD_COMMANDUS 2000 'Define delay time between sending LCD commands
    DEFINE LCD_DATAUS 50 'Define delay time between data sent.
    
    Pause 500 ' Wait for LCD to startup
    
    'Alias pins - MAX6675 temp sensor
    MXSCLK  var     PORTA.5   'Clock MAX pin 5
    MXCS     var     PORTA.2    'Chip Select MAX pin 6
    MXSO     Var     PORTA.4   'Serial out MAX pin 7
    
     'Allocate MAX6875 Variables
    MXTemp   var     word    'raw data from 6675/type K sensor
    TempC   var     word    'converted to degrees C
    TempF     var   word
    
    
    '-----------Read and display temperature from MAX6675-----------
    
    Main:
    
    MXCS = 0  'Chip select low
    shiftin MXSO, MXSCLK, 0, [MXTemp\16]   'read the data to MXTemp
    MXCS = 1    'Chip select high
    TempC = MXtemp >> 5   'right shift the data 5 places to get degrees C (Read the Data sheet)
    TempF = ABS(TempC) */ 461
    TempF = TempF + 32
    lcdout $fe, 1
    LCDOUT $fe,2,"  Temperature "
    lcdout $fe, $c0, " Faren=", DEC Tempf, " Cel=", dec tempc ' Spit it out on an LCD
    pause 500
    
    goto main
    Last edited by emerson; - 10th December 2010 at 14:19.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    You want to read each bit on the falling edge of the clock so use mode 2. And you only need to shift MXtemp >> 3. Not 5.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    Join Date
    Dec 2010
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    You want to read each bit on the falling edge of the clock so use mode 2. And you only need to shift MXtemp >> 3. Not 5.
    I changed both but there's still no response? On the datasheet it says the MAX6675 serial clock frequency is 4.3MHz, and I'm running my pic at 4MHz, will this effect data communication?
    Last edited by emerson; - 10th December 2010 at 16:03.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    If you have an O-scope check the data out pin. That will at least let you know if it's responding.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    Dec 2010
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    If you have an O-scope check the data out pin. That will at least let you know if it's responding.
    the O-scope test checked out alright

  7. #7
    Join Date
    Dec 2010
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    I just disabled the comparators in the chip but it still won't. I even replaced the thermocouple and the MAX76675 but i get the same response. I have no idea what could be wrong with this. Any ideas?
    Last edited by emerson; - 10th December 2010 at 17:44.

  8. #8
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Have you tried sending the raw value received 'without modifying it' to your LCD while heating or cooling the part?

    Something like: lcdout $fe, $c0, BIN16 MXtemp

    Does it change when heated?

    Edit: Since you're using the internal osc on this one, place Define OSCCAL_1K 1 in the top section. Not sure it that will fix it, but it will for sure affect timing.
    Last edited by Bruce; - 10th December 2010 at 17:48. Reason: Define OSCCAL_1K 1
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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