Thank you all for the replys and your interest in this...

The data type of all tables are ints

the tables are generated by excel by a very long complex polynomial. I tried the equation in arduino and it was not satisfactory... i have to stick to tables

here are some mini examples of the tables. the tables will get larger than these:

const int tempTable [][2] = {

// ms , Temp

{100, 59},

{150, 54},

{200, 49},

{250, 44},

{300, 39},

{350, 33},

{400, 28},

{450, 23},

{500, 18},

{550, 13},

{600, 7}};

const int ONtimeTable [][11] = {

// BAR 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 //Temp

{727, 749, 771, 794, 816, 838, 860, 883, 905, 927, 949}, //10

{662, 684, 706, 728, 751, 773, 795, 817, 839, 862, 884}, //15

{596, 618, 641, 663, 685, 707, 730, 752, 774, 796, 818}, //20

{531, 553, 575, 598, 620, 642, 664, 686, 709, 731, 753}, //25

{466, 488, 510, 532, 554, 577, 599, 621, 643, 666, 688}, //30

{400, 422, 445, 467, 489, 511, 533, 556, 578, 600, 622}, //35

{335, 357, 379, 401, 424, 446, 468, 490, 513, 535, 557}, //40

{269, 292, 314, 336, 358, 380, 403, 425, 447, 469, 492}, //45

{204, 226, 248, 271, 293, 315, 337, 360, 382, 404, 426}, //50

{139, 161, 183, 205, 227, 250, 272, 294, 316, 339, 361}, //55

{73, 95, 118, 140, 162, 184, 207, 229, 251, 273, 295}}; //60

const int ValveTimeoutTable[][2] = {

// Temp, ms

{10, 1308},

{15, 1369},

{20, 1430},

{25, 1491},

{30, 1552},

{35, 1613},

{40, 1674},

{45, 1735},

{50, 1796},

{55, 1857},

{60, 1918}};

The baud rate is 57600... this is the fastest I can go, because any faster and I will get garbage data... the format will mess up...

Every 5 ms I am sending 5 ints to computer

By "it" I mean the process of looking up data from 3 tables ( two tables of 1D and one table of 2D...[above]) and applying linear interpolation on the 1D and bilinear interpolation on the 2D...

I have cooked up the linear interpolation function: (the bilinear will be soon to come)...

int OneDimLookUp ( const int table[][2], int X) {

int lowIndex, highIndex;

int X0, Y0, X1, Y1, Y;

lowIndex = (X/50) - 2;

highIndex = (X/50) - 1;

X0 = table[lowIndex][0];

X1 = table[highIndex][0];

Y0 = table[lowIndex][1];

Y1 = table[highIndex][1];

Y = Y0 + ((Y1 - Y0)*(X - X0))/(X1 - X0);

return Y;

}

I am getting good results from this. I wrote a code that does this lookup and linear interpolation 500 times and it takes about 18ms to complete...

Here is the test code:

void loop() {

if (run) {

Serial.println(micros());

for (int i = 100; i < 601; i++) {

output = OneDimLookUp(tempTable, i);

}

Serial.println(micros());

Serial.println(tempTable[0][0]);

}

run = 0;

}

So the thing that worries me is if arduino can do "it" in less than 1 ms or not. And if not, is there a faster and more efficient way of doing this?

Thanks