Parallax, Inc. DS2760 Thermocouple Kit (#28022) 01/2004
4
' -----[ Constants ]-------------------------------------------------------
ReadNet CON $33 ' read OW net address
SkipNet CON $CC ' skip OW net address
RdReg CON $69 ' read register
' -----[ Variables ]-------------------------------------------------------
idx VAR Nib ' loop counter
type VAR Nib ' device type
char VAR Byte ' display byte/char
vIn VAR Word ' in millivolts
tmpCJ VAR Word ' device temp in C
tCuV VAR Word ' thermocouple millivolts
sign VAR Word ' TC sign bit
cjComp VAR Word ' temp compensation
tempC VAR Word ' temp in Celsius
tempF VAR Word ' temp in Fahrenheit
tblLo VAR Word ' table pointers
tblHi VAR Word
eePntr VAR Word
testVal VAR Word ' test value from table
error VAR Bit ' 1 = out of range
' -----[ EEPROM Data ]-----------------------------------------------------
' -----[ Initialization ]--------------------------------------------------
Stamp_Check:
#IF ($stamp < BS2P) #THEN
#ERROR "This program requires BS2p or BS2pe"
#ENDIF
Check_Device:
OWOUT OW, %0001, [ReadNet] ' get serial number
OWIN OW, %0010, [SPSTR 8] ' store in SPRAM
GET idx, char ' read device type
IF (char <> $30) THEN ' if not $30, wrong device
DEBUG "No DS2760 found."
STOP ' stop program
ENDIF
Parallax, Inc. DS2760 Thermocouple Kit (#28022) 01/2004
5
Menu:
DEBUG CLS,
"===============================", CR,
" DS2760 Thermocouple Interface ", CR,
"===============================", CR,
CR,
"Select TC Type (1 - 3)", CR,
CR,
"(1) K - Chromel/Alumel", CR,
"(2) J - Iron/Constantan", CR,
"(3) T - Copper/Constantan", CR,
CR,
">>> "
DEBUGIN DEC1 type ' get selection
IF (type < 1) OR (type > 3) THEN Menu ' validate selection
DEBUG CRSRXY, 0, 3, CLRDN ' remove selections
STORE type ' point READ to table
Show_SN:
DEBUG CRSRXY, 0, 4, "Device SN... "
FOR idx = 0 TO 7
GET idx, char
DEBUG HEX2 char
NEXT
Show_Type:
DEBUG CRSRXY, 0, 6, "TC Type..... "
LOOKUP (type - 1), ["KJT"], char
DEBUG char
' -----[ Program Code ]----------------------------------------------------
Main:
DO
GOSUB Read_TC_Volts ' read Seebeck voltage
GOSUB Read_CJ_Temp ' read cold junction temp
READ (tmpCJ * 2), Word cjComp ' get compensation voltage
' combine cjComp and tCuV
'
IF sign THEN
' TC below cold junction
IF (tCuV < cjComp) THEN
cjComp = cjComp - tCuV
ELSE
cjComp = 0 ' limit to 0C
ENDIF
Parallax, Inc. DS2760 Thermocouple Kit (#28022) 01/2004
6
ELSE
' TC above cold junction
cjComp = cjComp + tCuV
ENDIF
LOOKUP type, [1023, 1023, 400], tblHi ' set high end of search
GOSUB TC_Lookup ' reverse lookup of table
tempF = tempC * 9 / 5 + 32 ' x 1.8 + 32
IF (error = 0) THEN
DEBUG CRSRXY, 0, 7,
"Temp °C..... ", SDEC tempC, CLREOL
DEBUG CRSRXY, 0, 8,
"Temp °F..... ", SDEC tempF, CLREOL
ELSE
DEBUG CRSRXY, 0, 7,
"Temp °C..... Out of Range", CLREOL
DEBUG CRSRXY, 0, 8,
"Temp °F..... Out of Range", CLREOL
ENDIF
PAUSE 1000
LOOP
END
' -----[ Subroutines ]-----------------------------------------------------
' Reads device input voltage (Vin pin)
' -- mV in millivolts (max reading is 4.75 volts)
Read_Vin:
OWOUT OW, %0001, [SkipNet, RdReg, $0C]
OWIN OW, %0010, [vIn.BYTE1, vIn.BYTE0]
IF (vIn.BIT15) THEN ' check sign
vIn = 0 ' disallow negative
ELSE
vIn = vIn >> 5 */ $4E1 ' x 4.88 millivolts
ENDIF
RETURN
' Reads current register to get TC voltage
' -- each raw bit = 15.625 uV
' -- tCuV in microvolts
Read_TC_Volts:
OWOUT OW, %0001, [SkipNet, RdReg, $0E] ' read current register
OWIN OW, %0010, [tCuV.BYTE1, tCuV.BYTE0]

28022

Mfr. #:
Manufacturer:
Parallax
Description:
Sensor Development Tools Temperature Sensor Development Tools DS2760 THERMOCOUPLE KIT
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet