Reading K type thermo couple on SPI bus

CAI_Support

Senior Member
Both WC8 and WC32 latest firmware supporting SPI bus.  There are low cost K-type thermo couple can be purchased like this one:

http://www.ebay.com/itm/151324177617

Using this sample PLC code, you can read K-type thermocouple 
 
 

START
SET OP1 0 # max6675 chip enable
SPIBYTE 0 0 RAM11 # reading higher 8 bites, mode 0
SPIBYTE 0 0 RAM10 # reading lower 8 bits, mode 0
SET VAR1 RAM1 # copy to see what value
SET OP1 1 # turn off CS
ANDB VAR1 32760 VAR2 # remove lower 3 bits
ROTR VAR2 3 VAR3 # shift to lower 3 bits
MUL VAR3 25 VAR4 # times 25 for actual value in C x 100
DELAY 100 # just wait here or do anything you like
END

 
In this sample code,OP1 is used as CS pin for SPI chip.  The result showing  2200 when actual temperature is 22.00C
 
 
 
 
 
 
 
 
 
You can use MAX31865 on the same SPI bus. as long as you have CS pin assigned to another OP port.
For WC32, the WC32 optional IO board has the SPI screw terminal.  For WC8, please refer to the WC8 3.02.18dx user guide online.
 
K type thermocouple can read up to 2000C, that is must for wood burner or some higher temperature measurement.  That is different from what MAX31865 doing.
 
MAX6675 chip reads 100 when K thermal sensor disconnected, in normal operation, those lower 3 bits are shifted out.
In sample code, we did not check that before shifting, In real usage, checking that is important.
 
Back
Top