Which way to go?

Hi Everyone, first post and looking for a little advice or some recommendations.

I'm looking to do a thermocouple (tc) project that has to be able to handle types K, N or R. Each may be used from 0degC upto their maximum temps as shown in the NIST tc tables.(1300-1600degC) My limited background is in

68hc05 assembly but I'd like to transition to using C.

If anyone is able to offer any opinions or recommendations regarding the following points I'd be most grateful...

(1) After a bit of reading I'm currently leaning toward either TI's MSP430F147 or Microchip's PIC18F2550 or close derivatives of either. Microchip have a tc reference design based on the '2550'

(2) The TI part is 16bit with a 12bit ADC. Good enough for the tc input. Not real happy with their leadtimes though...18+ weeks. I've even read some posts questioning the long term availability of the MSP430 1xxx series.

(3) The Microchip part is 8bit with a 10bit ADC. Suitable for the cold junction compensation input. It is much more readily available, has seemingly more community support and is a bit easier to play with being available in dip packaging. Microchip have a pretty good record for long term avaialability.

(4) The Microchip part will need external ADC (minimum 12bit) plus an amp for the front end. There's any number of suitable ADC's and AD have the AD8628 op amp with 1uV offset and input offset drift of 0.002 ?V/°C.

(5)I'd like to use the NIST polynomials to resolve temperature readings and my reading indicates I'll need 32bit floating point support to do that. I've seen numerous posts which use lookup tables to avoid the nist equations, but these are usually examples where only one tc type is in use, usually within a limited temperature range and sacrificing some accuracy. I need multiple tc types, pretty much full temp range and good accuracy. Are these nist equations THAT bad???

(6) I'd like to keep the cold junction compensation circuitry seperate because of the multiple tc type requirement. That way the software can handle the voltage differences between the various tc types and the pcb can be left more or less unchanged for whatever tc type is used.

(7) TI's Code Composer Studio vs Microchip's C18 or Hi-Tech C??? Floating point math support???

There may well be better choices than the above so please don't limit any possible suggestions just to these. The aim is to make an informed decision before laying out any major $$$.

Cheers,

Peter

--------------------------------------- Posted through

formatting link

Reply to
PeteG
Loading thread data ...

N and K are roughly the same mV at full scale but you'll need to do some work to accomodate R, depending the specs you are shooting for.

No they're not that bad, provided you have the code space for the floating point and your reading rate is not that high. You can't get away with 24-bit floats because the polynomials are poorly conditioned. It's also possible to implement similar polynomials in fixed point math, but C does not lend itself to doing that sort of thing efficiently, IME.

Reply to
Spehro Pefhany

PeteG skrev:

The ATXMEGA16A4 has 12 bit ADC + AMP and is supported by gcc (WinAVR), which should be able to provide floating point emulation off the shelf. No DIP packaging though.

BR Ulf Samuelsson.

Reply to
Ulf Samuelsson

If a 12bit on-uP ADC is good enough, then you certainly don't need floating point. But without accuracy and data rate specs, it's impossible to say what you might really need.

Integer math cubic splines have worked for me in a variety of approximations. Results to 16 bit or better are usually available with a couple of k of look-up table + code space, a handful of 16x16 multiplies, and a few 16 bit adds. There's always a trade-off between table size and execution time. You could view the NIST polynomials as the smallest table (coefficients only - not including the FP lib you'll need) and the longest execution time.

Bob

Reply to
Bob

Then there is the classical table interpolation technique. As platinum resistors are linear plus slight deviation I guesstimate a 32 entry table of 16-bit values and 4 point interpolation to nearest points would do the job. Easy enough to increase to required precision.

Floating point is good if you have no time or inclination to go beyond copying the text book formula's.

--

--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Reply to
Albert van der Horst

The OP is about thermocouples, but the problem is similar.

Cubic splines *are* 4 point interpolations. The trick to making it fast is to re-sample the table, and pre-calculate and pre-scale the differences so that the run-time math is simple:

extract table index by masking and right-shift extract remainder by masking y = C[i] * r; y >>= S1; y += B[i]; y *= r; y >>= S2; y += A[i];

B[], and C[] are scaled to compensate for S1 and S2 (improves accuracy in the higher terms). I usually do some easy error calculations on a spreadsheet before writing a desktop test wrapper for the approximation code. See Jack Crenshaw's "Math Toolkit for Real-time Programming" for the calculus behind it and details about how to get B[] and C[] (and higher orders, if necessary). Or pull out your ESP archives where he wrote about it more than once.

I very much agree. Bob

Reply to
Bob

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.