'{$STAMP BS2e} ' Program MAX667x.bse ' Demo of MAXIM thermocouple interface chip. ' thermocouple pins ' +5.0 volts to MAXpin4 ' common to MAXpin1 ' k thermocouple to (-) red alumel pin 2, and (+) yellow chromel pin 3 ' or t thermocouple to (-) red constantan pin 2, and (+) blue copper pin 3 ' SPI pins as follows: thdta con 8 ' MAXpin7 brown thcs con 9 ' MAXpin6 white thclk con 10 ' MAXpin5 green result var word THC var word ' degrees Celsius (* power of 10) THCb var bit initialize: outs=0 dirs=%1111111011111111 ' fedcba9876543210 mainloop: getMAX667x: low thcs ' select chip shiftin thdta,thclk,msbpre,[result\16] ' get data high thcs ' start new data capture THC=result>>5*/3200 ' for MAX6674 0-128 +/- 0.01 degC, up to 127.87 debug dec THC/100,".",dec2 THC,cr pause 250 ' conversion time required between readings goto mainloop ' other conversion options ' for MAX6674 results +/- 0.125 up to 65.535 degrees C ' THC=result>>5*/32000 ' debug dec THC/1000,".",dec3 THC,cr ' ' for MAX6675 +/- 0.25 degC, up to 655.25 ' THC=result>>3*/6400 ' debug dec THC/100,".",dec2 THC,cr ' for MAX6675 +/- 0.1 degC, up to 1023.7 ' THC=result>>3*/640 ' debug dec THC/10,".",dec1 THC,cr ' 0.1 degree C is probably the limit of meaningful resolution.