Wrong type of serial. This shows how to read it
http://www.picbasic.co.uk/forum/show...1178#post71178
And if you want degrees F add this bit
TempF = ABS(TempC) */ 461
TempF = TempF + 32
Wrong type of serial. This shows how to read it
http://www.picbasic.co.uk/forum/show...1178#post71178
And if you want degrees F add this bit
TempF = ABS(TempC) */ 461
TempF = TempF + 32
Dave
Always wear safety glasses while programming.
I tried the code and when I compile I get a "Invalid RAM location specified". How can I fix this?
Also, all I see on the LCD is a line of black boxes across the top row. Is this a timing problem?
The same circuit setup works with my other lcd program so I know it's not a wiring error.
I still need to change the ports...whoops
Last edited by emerson; - 10th December 2010 at 05:03.
Normally black boxes are a contrast problem, but is the LCD cod is the same as on another project...
Post your whole current code and config setup so we can have a look.
Dave
Always wear safety glasses while programming.
This is what I have so far:
The contrast on the LCD is alright I have it adjusted properly. What does "Invalid RAM location specified" mean?Code:INCLUDE "modedefs.bas" define OSC 4 'Alias pins - MAX6675 temp sensor MXSCLK var PORTA.5 'Clock MXCS var PORTA.2 'Chip Select MXSO Var PORTA.4 'Serial out 'Allocate MAX6875 Variables MXTemp var word 'raw data from 6675/type K sensor TempC var word 'converted to degrees C '-----------Read and display temperature from MAX6675----------- 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) LCDOUT $fe,2,"Temp = ", DEC TempC, "degrees C " ' Spit it out on an LCD
Last edited by emerson; - 10th December 2010 at 05:24.
In this case it means you are compiling a LCDOUT command without having LCD defines.What does "Invalid RAM location specified" mean?
Dave
Always wear safety glasses while programming.
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.
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.
Bookmarks