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
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