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
I used this code for MAX6675 from Byte_Butcher.
Bookmarks