Mity Eltu
Member
Allright, I'm not new to Oshonsoft or programming in C/C++, but I have never (that I can recall) used a lookup table. I've read up on them some, but I can't find how to implement one in Oshonsoft Basic Compiler.
Here's what I'm trying to accomplish. I need a datalogger for a fuse testing rig based on UL 248 (that's not really important). I have managed to get the datalogging part working such that I can write all my data to a file on an SD card and I am now working on the thermocouple design. The temp range for the testing will be from near room temp (I'm going to start at 18°C) up to about 200°C (I'm going to go up to 250 for margin's sake). I'm planning on type T thermocouples. I figure on just scaling all the values up by 350 and feeding them directly into a 18F4580. That should put all the values just under 5V. I'll add circuit protection for the pins later - so no worries there.
The rub is the conversion from a/d to °C. The math is atrocious and I'm not sure the chip can handle the 7th degree eqn with single precision numbers (any thoughts on that?). So I thought about using a lookup table and including most of the singe degree mV values from the TC chart in the range I'm looking at. The problem is the table. How do I do this? The only example I can find that looks like a lookup table uses some kind of function call (ie mask = lookup(0x23, 0x....). Will this work with 250 entries? Would this work better loading into an external EPROM? Is there a better way?
Any advice you guys have will be great.
Thanks
Here's what I'm trying to accomplish. I need a datalogger for a fuse testing rig based on UL 248 (that's not really important). I have managed to get the datalogging part working such that I can write all my data to a file on an SD card and I am now working on the thermocouple design. The temp range for the testing will be from near room temp (I'm going to start at 18°C) up to about 200°C (I'm going to go up to 250 for margin's sake). I'm planning on type T thermocouples. I figure on just scaling all the values up by 350 and feeding them directly into a 18F4580. That should put all the values just under 5V. I'll add circuit protection for the pins later - so no worries there.
The rub is the conversion from a/d to °C. The math is atrocious and I'm not sure the chip can handle the 7th degree eqn with single precision numbers (any thoughts on that?). So I thought about using a lookup table and including most of the singe degree mV values from the TC chart in the range I'm looking at. The problem is the table. How do I do this? The only example I can find that looks like a lookup table uses some kind of function call (ie mask = lookup(0x23, 0x....). Will this work with 250 entries? Would this work better loading into an external EPROM? Is there a better way?
Any advice you guys have will be great.
Thanks