How to Use the Analog IO Module ai

Analog input channel #2 is a J-Type thermocouple (another temperature measurement device). If you want to get the official reference on thermocouples, you should get the NIST Monograph 175 (see "Bibliography" on page 374). A thermocouple produces a small voltage (called the Seebeck voltage) that varies as a function of temperature. The temperature at the thermocouple is not a linear function of the voltage produced. To further complicate things, the temperature at the thermocouple is also a function of a reference temperature called the Cold Junction. Determining the temperature at the thermocouple is beyond the scope of this book. Let's say for now that all you need to do is to measure the voltage (actually milli-volts) produced by the thermocouple. It is thus up to you to write a linearization function (also called thermocouple compensation function). A J-Type thermocouple produces -2.223 mV at -50 °F and 21.785 mV at 750 °F. This voltage is amplified by 400 so that it can be read by the ADC. A bias voltage is introduced to ensure that the ADC only sees positive voltages. From Equations [10.9], [10.10], and [10.11], the number of milli-volts at the thermocouple is given by:

[10.34] ConvGain = 0.006105

ConvOffset counts = -409.5

ThermocouplemV = (ADCcounts - 409.5) x 0.006105

All you have to do is linearize the thermocouple based on the number of milli-volts read from the thermocouple. The pass counter for analog input channel #2 will be set to 5 in order to read the thermocouple every 500 mS.