I am working on the S12G processor (9s12g128 specificaly) and am going to be doing 2D and 3D table interpolations.
I have my table interpolation function working by using structs:
typedef struct{
float *X;
float *Y;
}Table2D;
typedef struct{
float *X;
float *Y;
float *Table;
}Table3D;
Now I want to move my tables into absolute addresses in EEPROM so they can be reprogrammed on the fly
I have a number of predefined tables, but their size and values will be flexible.
I am trying to structure my code thusly:
float x[5] = {3300, 3400, 3500, 3700, 4000} @ *some_address*
float y[5] = {2150, 1750, 1450, 1300, 1200}; @ *address continued from x*
float *x_pntr = x @ *defined address*
float *y_pntr = y @ *defined address*
Table2D SlipPower ={
*x_pntr,
*y_pntr
};
so if the sized of the table chages, then the addresses of where x and y start can change, but the pointers to those addresses stay in the same place
But I can still use the structures I created before so
temp = table->X[index]; // an example from my interpolation funtion
still works
Original Attachment has been moved to: tables.h.zip
Original Attachment has been moved to: control_gains.h.zip
Original Attachment has been moved to: tables.c.zip