Having trouble with SERIN command and MAX6675


Results 1 to 40 of 40

Threaded View

  1. #7
    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.

Members who have read this thread : 1

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