Using the Type K thermocouple and the MCP9600 amp

Forgive me, but I am not sure this is the right place to post this, so many choices. Anyways, for over 20 years I have been using the Parallax Basic Stamp and the Propeller. I have had success using the I2C format for the HMC6352, which is no longer made. I sis use that component in a satellite tracker for directv on my boat while anchored in calm waters. Yes, it worked quit well, holding to 1 degree. I have lost all the PBASIC source code for that project which includes the I2C code.

So, my question is, does anyone out there have working source code, using a BASIC STAMP for the above two items. I which to build a high temperature device for my wood burner. I just need the I2C part of the source code that would give me a temperature number. I can take it from there. I have tried to read the liturature on I2C, but much to complicated…

Thank you…

Hello, if you are looking for a good Type-K Thermocouple Converter, you can consider MAX6675.

https://www.jakelectronics.com/subject/ … comparison

Here is a simple PBASIC code to read temperature data from the sensor using I2C:

' {$STAMP BS2}
' {$PBASIC 2.5}

SDA         PIN 1
SCL         PIN 2

' Define constants for I2C commands
I2C_READ    CON $01
I2C_WRITE   CON $00

' TMP102 sensor address (you may need to check the datasheet for your specific sensor)
TMP102_ADDR CON %1001000

' Define variables
tempMSB     VAR Byte
tempLSB     VAR Byte
temperature VAR Word

' Initialize I2C bus
HIGH SDA
HIGH SCL

' Main program loop
DO
  ' Start I2C communication
  GOSUB I2CStart
  
  ' Send the TMP102 address with the write command
  GOSUB I2CSendByte(TMP102_ADDR << 1 | I2C_WRITE)
  
  ' Send the pointer register address (0x00 for temperature register)
  GOSUB I2CSendByte(0x00)
  
  ' Restart I2C communication for read
  GOSUB I2CStart
  
  ' Send the TMP102 address with the read command
  GOSUB I2CSendByte(TMP102_ADDR << 1 | I2C_READ)
  
  ' Read the temperature MSB and LSB
  GOSUB I2CReceiveByte(tempMSB)
  GOSUB I2CReceiveByte(tempLSB)
  
  ' Combine MSB and LSB to get the full temperature value
  temperature = tempMSB << 4 | (tempLSB >> 4)
  
  ' Convert to Celsius if needed (depends on your sensor's data format)
  ' temperature = temperature * 0.0625
  
  ' Debug output to display the temperature
  DEBUG "Temperature: ", DEC temperature, CR
  
  ' Delay before the next reading
  PAUSE 1000
LOOP

' I2C start condition
I2CStart:
  LOW SDA
  LOW SCL
  RETURN

' I2C send byte subroutine
I2CSendByte:
  SHIFTOUT SDA, SCL, MSBFIRST, [ARG1]
  RETURN

' I2C receive byte subroutine
I2CReceiveByte:
  SHIFTIN SDA, SCL, MSBPOST, [ARG1]
  RETURN

This code is a basic example and may require adjustments based on the specific temperature sensor you are using.