# Thermocouple Measurement C Functions

This glossary defines the important constants and C library functions that comprise the Thermocouple Measurement Wildcard driver code.

The Thermocouple Measurement Wildcard measures one or two temperatures over wide temperature ranges using Type B, E, J, K, N, R, S or T thermocouples. It delivers built-in cold junction compensation and pre-coded curve fitting for accurate temperature measurement. The functions described in this glossary make it easy to add accurate temperature measurement to your embedded instrument.

Specific functions are provided to initialize the hardware and acquire cold junction compensated temperature measurements. An overview is provided in the Thermocouple Wildcard User's Guide.

Some functions require an input parameter for the thermocouple type, and many also require the temperature channel number (1 or 2) and the Thermocouple Measurement Wildcard module number (that is, the address, 0 through 7). Make certain the module number passed to the function corresponds to the actual hardware address jumper settings.

`Thermo_Temperature()` is the highest level function, and for many applications it is the only one you'll need to acquire and compute temperature data (that is, after initializing the board using `Thermo_Init`) . `Thermo_Temperature` acquires new samples from an analog to digital converter (ADC) and returns the cold-junction-compensated temperature as a floating point number in °C.

## Thermocouple measurement function glossary entries

##### THERMISTOR_FAHRENHEIT

A C macro (no equivalent is provided in Forth) which functions identically to `Thermistor_Temperature` but returns a result in degrees Fahrenheit. Defined as:

`THERMISTOR_FAHRENHEIT(M)   THERMO_DEGC_TO_DEGF( Thermistor_Temperature( M ) )`

See the glossary entry for `Thermistor_Temperature`.

##### Thermistor_Model

` C: float Thermistor_Model ( int count )`
`4th: Thermistor_Model ( count -- cold_jn_degrees_C_fp )`

Based on the specified Analog to Digital Converter (ADC) count (typically provided by the Thermo_Read function), applies an accurate curve fit model to report the corresponding cold junction temperature. The count input is read from ADC channel 2 (the thermistor bridge circuit count reading). If the input count equals `THERMO_TIMEOUT` (0x7FFE), this routine returns `THERMO_TEMP_INVALID` = -10000. degrees. This function is typically not called by the programmer; it is a low level curve fit function used by `Thermo_Calc_Temperature` and `Thermo_Temperature` for use with the single-channel version of the Thermocouple Wildcard.

##### Thermistor_Temperature

` C: float Thermistor_Temperature ( int modulenum )`
`4th: Thermistor_Temperature ( modulenum -- cold_jn_degrees_C_fp )`

For the specified single-channel Thermocouple Wildcard, acquires the cold junction thermistor count by invoking `Thermo_Read`, and then invokes `Thermistor_Model` to report the corresponding cold junction temperature. The count input is read from ADC channel 2 (the thermistor bridge circuit count reading). If the input count equals `THERMO_TIMEOUT` (0x7FFE), this routine returns `THERMO_TEMP_INVALID` = -10000. degrees. This low level function is typically not called by the programmer, but it may be used to report the temperature of the Thermocouple Wildcard itself.

##### THERMO_CALC_FAHRENHEIT

A C macro (no equivalent is provided in Forth) which functions identically to `Thermo_Calc_Temperature` but returns a result in degrees Fahrenheit. Defined as:

`THERMO_CALC_FAHRENHEIT(T,V,A,F) THERMO_DEGC_TO_DEGF(Thermo_Calc_Temperature(T,V,A,F))`

See the glossary entry for `Thermo_Calc_Temperature`.

##### Thermo_Calc_Temperature

``` C: float Thermo_Calc_Temperature ( int thermocouple_type, float thermocouple_mV, int thermistor_count, int thermistor_flag)```
```4th: Thermo_Calc_Temperature ( thermocouple_type\thermocouple_mV_fp\thermistor_count\thermistor_flag--degrees_C_fp)```

This high-level routine runs accurate curve fits and returns the cold-junction-compensated temperature in degrees C. Because the Analog to Digital Converter (ADC) parameters are acquired by other routines and passed to this function, `Thermo_Calc_Temperature` does not perform ADC coversions, wait or `PAUSE`. Thus it can be used to perform temperature calculations in situations where the programmer wants to perform pre-filtering of the ADC readings, or to precisely control the timing of the temperature conversion process. For a higher level routine that both acquires the ADC readings and performs the temperature conversion, use Thermo_Temperature. Allowed thermocouple types are specified by the constants `TYPE_B`, `TYPE_E`, `TYPE_J`, `TYPE_K`, `TYPE_N`, `TYPE_R`, `TYPE_S`, or `TYPE_T`. `Thermo_Calc_Temperature` works for either configuration of the Thermocouple Wildcard: the single-channel version with `thermistor_flag` true (non-zero), and the dual-channel version with `thermistor_flag` = false (zero). If `thermistor_flag` is true, then channel 1 is a thermocouple of the specified type and the `thermocouple_mV` is a voltage that has been acquired from ADC channel 1, typically via the `Thermo_mV` routine. In this case, `thermistor_count` is the ADC count acquired from channel 2, typically via `Thermo_Read`. If `thermistor_flag` is false, then both ADC channels can be connected to thermocouples, and the on-board chip with jumper-selectable thermocouple types is used for cold junction compensation. In this case: (A) the value of the `thermistor_count` input is not used (it's a "don't care" parameter); (B) the thermocouple has the specified `thermocouple_type`; and (C) `thermocouple_mV` is a voltage in millivolts that has been acquired from the desired thermocouple channel, typically via the `Thermo_mV` routine. This routine returns `THERMO_TEMP_INVALID` (-10000. degrees C) if the input parameter thermocouple_mV equals `THERMO_VMAX_TIMEOUT` (as returned by T`hermo_mV`), or if the input parameter `thermistor_count` equals `THERMO_TIMEOUT` (0x7FFE).

##### THERMO_CHANNEL_1

` C: THERMO_CHANNEL_1`
`4th: THERMO_CHANNEL_1` A 16-bit constant that returns the value 1. This constant specifies that channel 1 of the dual-channel Thermocouple Wildcard or the thermocouple of the single-channel Wildcard should be read. It can be passed as a parameter to `Thermo_Read`, `Thermo_mV`, or `Thermo_Temperature`.

##### THERMO_CHANNEL_2

` C: THERMO_CHANNEL_2`
`4th: THERMO_CHANNEL_2` A 16-bit constant that returns the value 2. This constant specifies that channel 2 of the dual-channel Thermocouple Wildcard or the thermistor of the single-channel Wildcard should be read. It can be passed as a parameter to `Thermo_Read`, `Thermo_mV`, or `Thermo_Temperature` (dual-channel only).

##### Thermo_Cold_Junction_Model

` C: float Thermo_Cold_Junction_Model ( int thermocouple_type, float cold_jn_temperature )`
`4th: Thermo_Cold_Junction_Model ( thermocouple_type\cold_jn_temp_fp -- mV_fp )`

Uses an accurate curve fit model to report the voltage in millivolts corresponding to the specified cold junction temperature and thermocouple type. Allowed thermocouple types are specified by the constants `TYPE_B`, `TYPE_E`, `TYPE_J`, `TYPE_K`, `TYPE_N`, `TYPE_R`, `TYPE_S`, or `TYPE_T`. The allowed range of the input cold junction temperature is -20 to +70 C for all thermocouples except type B; the type B range is 0 to +70 C. This function is typically not called by the programmer; it is a low level curve fit function used by `Thermo_Calc_Temperature` and `Thermo_Temperature` for use with the single-channel version of the Thermocouple Wildcard.

##### Thermo_Counts_To_mV

` C: float Thermo_Counts_To_mV ( int count )`
`4th: Thermo_Counts_To_mV ( n -- r | n = ADC count, r = milliVolts )`

Converts the input parameter, a signed integer result count returned by `Thermo_Read`, to the corresponding voltage expressed as a floating point return value in millivolts (mV). The range of the dual-channel Analog to Digital Converter (ADC) on the Thermocouple Wildcard is from -56.25 mV to +56.25 mV. At count = 0x8001 the voltage is just above -56.25mV. At count = 0xFFFF, the voltage is just below 0 mV. At count = 0x0000, the voltage equals 0 mV, and the lowest positive voltage corresponds to a count of 0x0001. At count = 0x7FFD the voltage is just under +56.25mV. The conversion algorithm is: isolate the sign of the result, calculate
absolute_mV = THERMO_VMAX * (abs_count / 32768 )
and then apply the correct sign to the calculated absolute result. The following special values are checked for by this routine:
if count = 0x7FFF, we have a negative overflow: report as `THERMO_VMIN` = -56.25
if count = 0x8000, we have a positive overflow: report as `THERMO_VMAX` = +56.25
if count = 0x7FFE, we have a timeout: report as `THERMO_VMAX_TIMEOUT` = 1000. See the glossary entry for `Thermo_Read`.

##### THERMO_DEGC_TO_DEGF

A C macro (no equivalent is provided in Forth) which converts a floating point value in degrees Celsius to a floating point value in degrees Fahrenheit. Defined as:

`THERMO_DEGC_TO_DEGF(C)   ( 1.8f * (C) + 32.0f )`

##### THERMO_DEGF_TO_DEGC

A C macro (no equivalent is provided in Forth) which converts a floating point value in degrees Fahrenheit to a floating point value in degrees Celsius. Defined as:

`THERMO_DEGF_TO_DEGC(F)   ( ( (F) - 32.0f ) / 1.8f )`

##### THERMO_FAHRENHEIT

A C macro (no equivalent is provided in Forth) which functions identically to `Thermo_Temperature` but returns a result in degrees Fahrenheit. Defined as:

`THERMO_FAHRENHEIT(T,N,S,M) THERMO_DEGC_TO_DEGF( Thermo_Temperature( T, N, S, M ) )`

See the glossary entry for `Thermo_Temperature`.

##### Thermo_Free

` C: void Thermo_Free ( int modulenum )`
`4th: Thermo_Free ( modulenum -- )`

This low-level routine releases the processor's access to the ADC (Analog to Digital Converter) hardware resource on the Thermocouple Wildcard with the specified module number. This is a non-blocking routine, meaning that there is no waiting or `PAUSE`-ing. After this routine is called, further ADC updates of the data latches are enabled. This primitive routine is typically not directly used by the application programmer; it is invoked by other high level routines in this library.

##### Thermo_Grab

` C: int Thermo_Grab ( int modulenum )`
`4th: Thermo_Grab ( modulenum -- aflag | flag = access_granted? )`

This low-level routine waits and `PAUSE`s until it gains access to the ADC (Analog to Digital Converter) hardware resource on the thermocouple Wildcard with the specified module number. If successful, a true flag is returned, meaning that the processor is able to read the Thermocouple Wildcard data, and further ADC updates are disabled until `Thermo_Free` is called. If the attempt to grab the resource fails due to a timeout, this routine returns with a false flag. This primitive routine is typically not directly used by the high level programmer; it is invoked by other high level routines in this library.

##### Thermo_Init

` C: void Thermo_Init ( int modulenum )`
`4th: Thermo_Init ( modulenum -- )`

Initializes the ADC (Analog to Digital Converter) on the specified Thermocouple Wildcard and calls `Thermo_Free` to enable updates by the ADC. This function should be called once after each powerup, restart or reset. Note that the first reading from each channel can be "old", that is, it may correspond to a prior voltage. In some applications, asking for and discarding readings after calling `Thermo_Init` time may be advisable; see `Thermo_Read`.

##### Thermo_mV

` C: float Thermo_mV ( int channel_num, int modulenum )`
`4th: Thermo_mV ( channel_num\modulenum -- r | r = milliVolts )`

Waits for, acquires and reports the latest voltage in millivolts on the specified thermocouple channel (1 or 2) on the specified Thermocouple Wildcard. Calls `PAUSE` while waiting (if necessary) for the data which is asynchronously updated 7 times per second by the Analog to Digital Converter (ADC) on the Wildcard. The range of the dual-channel ADC on the Thermocouple Wildcard is from -56.25 mV to +56.25 mV. This routine calls `Thermo_Read` and then `Thermo_Counts_To_mV`; see their glossary entries for more details. Negative overflow is reported as `THERMO_VMIN` = -56.25 mV. Positive overflow is reported as `THERMO_VMAX` = +56.25 mV. A timeout (the resource is not present or new data does not become available) is reported as `THERMO_VMAX_TIMEOUT` = 1000. mV. Note that the thermocouple is wired to output a negative voltage for positive temperatures; the high level routines `Thermo_mV_To_Temperature` and `Thermistor_Temperature` properly handle this and produce the correct temperature reading. In applications where a 16-bit Analog to Digital Conversion (ADC) is required covering a voltage range of -56.25 to +56.25 millivolts (mV), the Thermo_mV can be invoked. For example, if the dual channel Thermocouple Measurement Wildcard is used, but only one temperature is being measured, the second channel can be used to measure millivolts with 16 bit resolution. If you wish to use a channel to measure a voltage instead of a temperature, install a jumper cap across the H1 jumper pair labeled "GND" (pins 1 and 2 for channel 1, or pins 11 and 12 for channel 2). Be sure to connect the input voltage to the negative ("-") terminal of the screw terminal header, as each positive ("+") input is tied to ground at the screw terminal. Then simply pass to the Thermo_mV the channel number (1 or 2) and the modulenum parameter that matches the hardware settings of jumpers J1 and J2, and it returns a floating point millivolt reading in the range -56.25 to +56.25. If you are using the ADC to convert a voltage, the floating point result reported by Thermo_mV has negative polarity, so your application program must negate the result to compensate for this inversion.

##### THERMO_MV_TO_FAHRENHEIT

A C macro (no equivalent is provided in Forth) which functions identically to `Thermo_Temperature` but returns a result in degrees Fahrenheit. Defined as:

`THERMO_MV_TO_FAHRENHEIT(T,V) THERMO_DEGC_TO_DEGF( Thermo_mV_To_Temperature( T, V ) )`

See the glossary entry for `Thermo_mV_To_Temperature`.

##### Thermo_mV_To_Temperature

` C: float Thermo_mV_To_Temperature ( int thermocouple_type, float millivolts )`
`4th: Thermo_mV_To_Temperature ( n\r1 -- r2 | n = thermocouple_type, r1 =mV, r2 =degrees_C )`

Converts the specified voltage in millivolts to temperature in degrees C using an accurate curve fit model for the specified thermocouple type. Allowed thermocouple types are specified by the constants `TYPE_B`, `TYPE_E`, `TYPE_J`, `TYPE_K`, `TYPE_N`, `TYPE_R`, `TYPE_S`, or `TYPE_T`. This routine returns `THERMO_TEMP_INVALID` (-10000. degrees) if the thermocouple type code is invalid, or if the input millivolt parameter equals `THERMO_VMAX_TIMEOUT` (1000.) which represents a timeout error when the voltage was acquired. Any non-timeout voltage is converted to a temperature by first clamping to the specified model's voltage range, then applying the curve fit model. This routine does not mathematically apply cold junction compensation. If the Thermocouple Wildcard has the built-in cold junction compensation chip (dual-channel version of the Wildcard), then the `Thermo_mV` routine acquires a voltage that has been cold-junction compensated in hardware, so the temperature returned by `Thermo_mV_To_Temperature` will be cold junction compensated within the tolerance of the hardware chip. (Note that type B and N thermocouples cannot be handled by the onboard cold junction chip). If the single-channel version of the Thermocouple Wildcard (which uses the thermistor for cold junction compensation) is in use, then the higher level routines `Thermo_Calc_Temperature` or `Thermo_Temperature` must be invoked to report the cold-junction-compensated temperature.

##### Thermo_New

` C: int Thermo_New ( int modulenum )`
`4th: Thermo_New ( modulenum -- u )`

This low-level routine returns a value indicating which channels have been updated (that is, have "new" values) by the Analog to Digital Converter (ADC) on the specified Thermocouple Wildcard since the last execution of one of the functions `Thermo_Read`, `Thermo_mV`, `Thermistor_Temperature`, or `Thermo_Temperature`. There are two ADC channels on the Wildcard: channel 1 and channel 2. The returned value has the following meanings: 0 means neither channel is new; 1 means channel 1 is new; 2 means TC2 is new; and 3 means that both channel 1 and channel 2 are new.

##### THERMO_OVERFLOW_PLUS

` C: THERMO_OVERFLOW_PLUS`
`4th: THERMO_OVERFLOW_PLUS`

A 16-bit constant that returns the value 0x8000. This value is returned by the `Thermo_Read` function if the Analog to Digital Converter (ADC) attempted to convert a voltage equal to or higher than +56.25 millivolts. Higher level functions appropriately clamp the result when this ADC count is detected. This non-intuitive negative overflow value to indicate a positive overflow condition results from the hardware implementation.

##### THERMO_OVERFLOW_MINUS

` C: THERMO_OVERFLOW_MINUS`
`4th: THERMO_OVERFLOW_MINUS`

A 16-bit constant that returns the value 0x7FFF. This value is returned by the `Thermo_Read` function if the Analog to Digital Converter (ADC) attempted to convert a voltage equal to or lower than -56.25 millivolts. Higher level functions appropriately clamp the result when this ADC count is detected. This non-intuitive positive overflow value to indicate a negative overflow condition results from the hardware implementation.

` C: int Thermo_Read ( int channel_num, int modulenum )`
`4th: Thermo_Read ( channel_num\modulenum -- n | n = result_count )`

This low level function waits for, acquires and reports new data on the specified thermocouple channel (1 or 2) on the specified Thermocouple Wildcard. Calls `PAUSE` while waiting (if necessary) for the data which is asynchronously updated 7 times per second by the Analog to Digital Converter (ADC) on the Wildcard. This routine returns a 16-bit signed result count for the specified thermocouple channel, and frees the resource after reading it by calling `Thermo_Free`. If new data is not available or we cannot grab the Thermocouple Wildcard resource before timing out, this routine returns `THERMO_TIMEOUT` (0x7FFE). Valid counts are in the range 0x8001 to 0xFFFF (negative voltages from just above -56.25 millivolts to just below zero), 0x0000 (zero millivolts), or 0x0001 to 0x7FFD (positive voltages from just above zero to just below 56.25 millivolts). If the ADC happens to return the value 0x7FFE, this routine returns it as 0x7FFD because 0x7FFE is reserved as the `THERMO_TIMEOUT `value that indicates a timeout occured (that is, we could not `Thermo_Grab` the resource in the allotted time). This routine returns `THERMO_OVERFLOW_PLUS` if there is a positive voltage overflow, and `THERMO_OVERFLOW_MINUS` if there is a negative voltage overflow. Note: In applications that need to use the ADC to convert a voltage directly, use the `Thermo_mV` function, and see its glossary entry for notes on how to connect the signal source and the required negation of the reported result.

##### Thermo_Status

` C: int Thermo_Status ( int modulenum )`
`4th: Thermo_Status ( modulenum -- u )`

This low-level routine returns a value indicating the status of the specified Thermocouple Wildcard. This primitive routine is typically not directly used by the application programmer; it is invoked by other high level routines in this library. The returned value is bit-encoded, with the following meaning:
bit3: = 0 if the Thermocouple hardware resource is Free, = 1 if Grab has been accomplished;
bit2: = 0 if channel 1 was last updated, = 1 if channel 2 was last updated
bit1: = 0 if channel 2 has not been updated since it was read, = 1 if it has
bit0: = 0 if channel 1 has not been updated since it was read, = 1 if it has

##### Thermo_Temperature

` C: float Thermo_Temperature ( int thermocouple_type, int channel_num, int thermistor_flag, int modulenum)`
`4th: Thermo_Temperature ( thermocouple_type\channel_num\thermistor_flag\modulenum--degrees_C_fp)`

This high-level routine runs accurate curve fits and returns the cold-junction-compensated temperature in degrees C for the specified thermocouple channel and type on the specified Thermocouple Wildcard. `Thermo_Temperature` waits for new Analog to Digital Converter (ADC) conversion(s), `PAUSE`-ing if necessary while the ADC is updating. The ADC outputs new data every 150 milliseconds (ms), ping-ponging between ADC channel 1 and channel 2. Consequently, this routine may `PAUSE` up to 300 ms if the thermistor flag is true, or up to 150 ms if the thermistor flag is false. See the glossary entry for `Thermo_Calc_Temperature` if you want to use a routine that does not wait for the ADC conversions. Allowed thermocouple types are specified by the constants `TYPE_B`, `TYPE_E`, `TYPE_J`, `TYPE_K`, `TYPE_N`, `TYPE_R`, `TYPE_S`, or `TYPE_T`. `Thermo_Calc_Temperature` works for either configuration of the Thermocouple Wildcard: the single-channel version with `thermistor_flag` true (non-zero), and the dual-channel version with `thermistor_flag` = false (zero). If `thermistor_flag` is true, then channel 1 is a thermocouple of the specified type and the cold junction is measured by a thermistor on ADC channel 2. If `thermistor_flag` is false, then both ADC channels can be connected to thermocouples, and the on-board chip with jumper-selectable thermocouple types is used for cold junction compensation. In this case the `thermocouple_type` and `channel_num` specify the type and channel of the thermocouple to be converted. This routine returns `THERMO_TEMP_INVALID` (-10000. degrees) if one or both of the ADC channels cannot be acquired.

##### THERMO_THERMO_TEMP_INVALID

` C: THERMO_THERMO_TEMP_INVALID`
`4th: THERMO_TEMP_INVALID`

A float constant that returns the value -10000. This value (in degrees Centigrade) is returned by the `Thermo_mV_To_Temperature`, `Thermistor_Model`, `Thermistor_Temperature`, `Thermo_Calc_Temperature`, and `Thermo_Temperature` functions if a valid reading could not be obtained from the Analog to Digital Converter (ADC). The application program can test for this result and use it for error reporting purposes.

##### THERMO_TIMEOUT

` C: THERMO_TIMEOUT`
`4th: THERMO_TIMEOUT`

A 16-bit constant that returns the value 0x7FFE. This value is returned by the `Thermo_Read` function if a valid reading could not be obtained from the Analog to Digital Converter (ADC). Higher level functions will return an appropriate error value if the ADC count equals `THERMO_TIMEOUT`.

##### Thermo_Try_To_Grab

` C: int Thermo_Try_To_Grab ( int modulenum )`
`4th: Thermo_Try_To_Grab ( modulenum -- flag | flag = access_granted? )`

This low-level routine attempts to gain access to the ADC (Analog to Digital Converter) hardware resource on the Thermocouple Wildcard with the specified module number. If the attempt is successful, a true flag is returned, meaning that the processor is able to read the Thermocouple Wildcard data, and further ADC updates are disabled until `Thermo_Free` is called. This is a non-blocking routine, meaning that there is no waiting or `PAUSE`-ing; if the attempt to grab the resource fails, this routine returns with a false flag. This primitive routine is typically not directly used by the application programmer; it is invoked by other high level routines in this library.

##### Thermo_Wait_Til_New

``` C: int Thermo_Wait_Til_New ( int channel_num, int modulenum ) 4th: Thermo_Wait_Til_New ( channel_num\modulenum -- flag | flag = new_data_available? )```

This low-level routine waits and `PAUSE`s until the specified channel (1 or 2) on the specified Thermocouple Wildcard is "new", returning a true flag (-1) if successful, and a false flag (0) if a timeout occurred. A "new" value means that the specified channel has been updated by the Analog to Digital Converter (ADC) on the Thermocouple Wildcard since the last execution of one of the functions `Thermo_Read`, `Thermo_mV`, `Thermistor_Temperature`, or `Thermo_Temperature`. `Thermo_Wait_Til_New` is automatically called by the `Thermo_Read`, `Thermo_mV`, `Thermistor_Temperature`, and `Thermo_Temperature` functions to ensure that a given value from the ADC is only read once. The ADC outputs new data every 150 milliseconds (ms), ping-ponging between ADC channel 1 and channel 2. Consequently, this routine may `PAUSE` up to 300 ms.

##### THERMO_VMAX

` C: THERMO_VMAX`
`4th: THERMO_VMAX`

A float constant that returns the value 56.25. This value (in millivolts) is returned by the `Thermo_Counts_To_mV` and `Thermo_mV` functions if a positive overflow reading was obatined from the Analog to Digital Converter (ADC). Higher level temperature reporting functions will return an appropriately clamped temperature if the acquired voltage equals `THERMO_VMAX`.

##### THERMO_VMAX_TIMEOUT

` C: THERMO_VMAX_TIMEOUT`
`4th: THERMO_VMAX_TIMEOUT`

A float constant that returns the value 1000. This value (in millivolts) is returned by the `Thermo_Counts_To_mV` and `Thermo_mV` functions if a valid reading could not be obtained from the Analog to Digital Converter (ADC). Higher level temperature reporting functions will return `THERMO_TEMP_INVALID` if the incoming voltage equals `THERMO_VMAX_TIMEOUT`. The application program can test for this result and use it for error reporting purposes.

##### THERMO_VMIN

` C: THERMO_VMIN`
`4th: THERMO_VMIN`

A float constant that returns the value -56.25. This value (in millivolts) is returned by the `Thermo_Counts_To_mV` and `Thermo_mV` functions if a negative overflow reading was obatined from the Analog to Digital Converter (ADC). Higher level temperature reporting functions will return an appropriately clamped temperature if the acquired voltage equals `THERMO_VMIN`.

##### TYPE_B

` C: TYPE_B`
`4th: TYPE_B`

A 16-bit constant that returns the value 0. This constant specifies that a type B thermocouple is in use. It can be passed as a parameter to `Thermo_mV_To_Temperature`, `Thermo_Cold_Junction_Model`, `Thermo_Calc_Temperature`, or `Thermo_Temperature`.

##### TYPE_E

` C: TYPE_E`
`4th: TYPE_E`

A 16-bit constant that returns the value 1. This constant specifies that a type E thermocouple is in use. It can be passed as a parameter to `Thermo_mV_To_Temperature`, `Thermo_Cold_Junction_Model`, `Thermo_Calc_Temperature`, or `Thermo_Temperature`.

##### TYPE_J

` C: TYPE_J`
`4th: TYPE_J`

A 16-bit constant that returns the value 2. This constant specifies that a type J thermocouple is in use. It can be passed as a parameter to `Thermo_mV_To_Temperature`, `Thermo_Cold_Junction_Model`, `Thermo_Calc_Temperature`, or `Thermo_Temperature`.

##### TYPE_K

` C: TYPE_K`
`4th: TYPE_K`

A 16-bit constant that returns the value 3. This constant specifies that a type K thermocouple is in use. It can be passed as a parameter to `Thermo_mV_To_Temperature`, `Thermo_Cold_Junction_Model`, `Thermo_Calc_Temperature`, or `Thermo_Temperature`.

##### TYPE_N

` C: TYPE_N`
`4th: TYPE_N`

A 16-bit constant that returns the value 4. This constant specifies that a type N thermocouple is in use. It can be passed as a parameter to `Thermo_mV_To_Temperature`, `Thermo_Cold_Junction_Model`, `Thermo_Calc_Temperature`, or `Thermo_Temperature`.

##### TYPE_R

` C: TYPE_R`
`4th: TYPE_R`

A 16-bit constant that returns the value 5. This constant specifies that a type R thermocouple is in use. It can be passed as a parameter to `Thermo_mV_To_Temperature`, `Thermo_Cold_Junction_Model`, `Thermo_Calc_Temperature`, or `Thermo_Temperature`.

##### TYPE_S

` C: TYPE_S`
`4th: TYPE_S`

A 16-bit constant that returns the value 6. This constant specifies that a type S thermocouple is in use. It can be passed as a parameter to `Thermo_mV_To_Temperature`, `Thermo_Cold_Junction_Model`, `Thermo_Calc_Temperature`, or `Thermo_Temperature`.

##### TYPE_T

` C: TYPE_T`
`4th: TYPE_T`

A 16-bit constant that returns the value 7. This constant specifies that a type T thermocouple is in use. It can be passed as a parameter to `Thermo_mV_To_Temperature`, `Thermo_Cold_Junction_Model`, `Thermo_Calc_Temperature`, or `Thermo_Temperature`.

This page is about: C Library Function for Thermocouple Measurement – This glossary defines the constants and C library functions of the Thermocouple Measurement Wildcard driver code which accurately measures temperatures over wide ranges with cold junction compensation from K type, J type, E type, or Type R, S, T, B or N thermocouples. The thermocouple board has built-in cold junction compensation and pre-coded curve fitting functions for accurate temperature measurement. These functions make it easy to add highly accurate temperature measurement to your embedded instrument. thermocouple, cold junction compensation, cold junction compensated, thermistor, B type B, E type E, J type J, K type K, N type N, R type R, S type S, T type T
{"ft_lang_label":"__label__en","ft_lang_prob":0.7641304,"math_prob":0.90933543,"size":27226,"snap":"2023-40-2023-50","text_gpt3_token_len":6821,"char_repetition_ratio":0.19212402,"word_repetition_ratio":0.346908,"special_character_ratio":0.21560273,"punctuation_ratio":0.11307263,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.963165,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-10-03T14:54:16Z\",\"WARC-Record-ID\":\"<urn:uuid:8864090a-2ee9-4155-bf00-d5d28d3ffe17>\",\"Content-Length\":\"164731\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e11c9300-4fcb-4078-9693-90ce307a1744>\",\"WARC-Concurrent-To\":\"<urn:uuid:4b4537b7-8fe8-461b-b45e-eccaad90b26b>\",\"WARC-IP-Address\":\"198.54.115.131\",\"WARC-Target-URI\":\"https://www.mosaic-industries.com/embedded-systems/instrumentation/thermocouple-measurement/c-functions-temperature-measurement\",\"WARC-Payload-Digest\":\"sha1:53OP2JN6YMFG7DONQPJPZWQ6TPEAZ6HF\",\"WARC-Block-Digest\":\"sha1:WAOGNTXY7RXZZXGCJXAJ4BC7WYYMN5HH\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233511106.1_warc_CC-MAIN-20231003124522-20231003154522-00805.warc.gz\"}"}