beautypg.com

Measurement Computing TempBook rev.3.0 User Manual

Page 58

background image

8-2 Thermocouple Measurement

TempBook User’s Manual

The low-level temperature conversion functions
take data from one or more scans from the
TempBook. They examine the CJC and
thermocouple readings within that scan and,
after optional averaging, convert them to
temperatures which are stored as output. For
example, assume the readings in the table at right.

This shows that the first two readings of each scan are a CJC zero reading and a TC zero reading. The third
reading is from the CJC, and the remaining three readings are from three type J thermocouples. If the auto-
zero feature is not used, the first two readings will be ignored. Otherwise, they
will be used to remove any offset errors in the CJC and thermocouple reading
before proceeding. When not using averaging, the CJC readings are combined
with the thermocouple readings to produce one temperature result for each
thermocouple reading. Reducing the 24 original readings to 12 temperatures
(see table at right).

The conversion process is divided into two steps: setup and conversion. The setup step describes the
characteristics of the temperature measurement, and the conversion step actually converts the data from raw
readings to temperatures. All of the functions return error codes which are defined in TempBook.H which
includes the function prototypes and definitions of the thermocouple type codes.

The setup function is tbkTCSetup. The C-language version of tbkTCSetup is very similar to that of
the other programming languages and is described below. Note: uint is short for unsigned int, and
uchar

is short for unsigned char. Further details in Command Reference chapter.

tbkTCSetup( uint nscan, uint cjcPosition, uint ntc, uint tcType, uchar
bipolar, uint avg)

uint nscan

The number of readings in a single scan of TempBook data. The

tbkTC

functions can convert several consecutive scans worth of data in a single
invocation.

Valid range: 2 to 512.

uint cjcPosition

The position of the actual cold-junction compensation circuit (CJC) reading within

each scan (not the CJC zero reading, if any). The first reading of the scan is
position 0, and the last reading is position nscan-1. Each scan of temperature
data must include a reading of the CJC. The CJC readings must be taken with
the appropriate unipolar or bipolar CJC gain setting.

Valid range: 0 to nscan-2 with no zero compensation; 2 to nscan-2 with zero

compensation.

uint ntc

The number of thermocouple readings that are to be converted to temperature

values. The thermocouple signal readings must immediately follow the CJC
reading in the scan data. The first thermocouple signal is at scan position
cjcPosition+1, the next is at cjcPosition+2, and so on.

Valid range: 1 to nscan-1-cjcPosition.

uint tcType

The type of thermocouples that generated the measurements: J, K, T, E, N28,

N14, S, R, or B.

Valid range: One of the predefined values:

TbkTCTypeJ, TbkTCTypeK,

TbkTCTypeT, TbkTCTypeE, TbkTCTypeN28, TbkTCTypeN14,
TbkTCTypeS, TbkTCTypeR or TbkTCTypeB.

uchar bipolar

Non-zero if the TempBook is configured for bipolar readings.

uint avg

The type of averaging to be performed.
Valid range: any unsigned integer.
Note: Since the thermocouple voltage may be small compared to the ambient

electrical noise, averaging may sometimes be necessary to yield a steady
temperature output.

0 specifies block averaging in which all of the scans are averaged together to

compute a single temperature measurement for each of the ntemp
thermocouples.

1 specifies no averaging. Each scan's readings are converted into ntemp

measured temperatures for a total of scans*ntemp results.

2 or more specifies moving average of the specified number of scans. Each

scan's readings are averaged with the avg-1 preceding scans' readings before
conversion. The first avg-1 scans are averaged with all of the preceding scans
because they do not have enough preceding scans. For example, if avg is 3,
then the results from the first scan are not averaged at all, the results from the
second scan are averaged with the first scan, the results from the third and
subsequent scans are averaged with the preceding two scans as shown in the
next table.

Scan

Reading

0

1

2

3

4

5

1

CJC Zero

J Zero

CJC

J1a

J1b

J1c

2

CJC Zero

J Zero

CJC

J2a

J2b

J2c

3

CJC Zero

J Zero

CJC

J3a

J3b

J3c

4

CJC Zero

J Zero

CJC

J4a

J4b

J4c

Scan

Result

0

1

2

1

J1a

J1b

J1c

2

J2a

J2b

J2c

3

J3a

J3b

J3c

4

J4a

J4b

J4c