
Originally Posted by
SKOLS1
Fratello,can you make a code with MAX6675 thermocouple cold junction sensor?I have one,so I want to use it.
Here, I'm familiar with the MAX6675 so I'll give you a start...
This should read the MAX6675 and display degrees C & degrees F on a LCD display.
(Pin aliases for LCD not shown, only for the MAX6675)
Code:
'Alias pins - MAX6675 temp sensor
MXSCLK var PORTD.0 'MAX6675 Clock
MXCS var PORTD.2 'MAX6675 Chip Select
MXSO Var PORTD.3 'MAX6675 Serial Data
'--Variables-----------------------
kTemp var word 'raw data from MAX6675
tempC var word 'temperature in degrees C
tempF var word 'temp C converted to degrees F
'-----------Read and display temperature from MAX6675-----------
main:
LOW MXCS 'chip select low
shiftin MXSO, MXSCLK, 0, [kTemp\16] 'shift in the data
HIGH MXCS 'chip select high
tempC = kTemp >> 5 '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
lcdout $fe,1,dec tempC," degrees C ",$fe,$c0,dec tempF," degrees F " 'display the data on LCD
pause 500
goto main
end
Bookmarks