This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Initialising Values to Structures

Dear Sir,

I am making a program using Keil PK51 package. I am using a structure of arrays declared as:

#define MAX_TESTS 30

struct param{ /* 80 bytes per test */
char mode[MAX_TESTS];
float factor[MAX_TESTS];
int aspVolume[MAX_TESTS];
char temperature[MAX_TESTS];
char filter1[MAX_TESTS];
char filter2[MAX_TESTS];
char unit[MAX_TESTS];
float nvMin[MAX_TESTS];
float nvMax[MAX_TESTS];
char decimal[MAX_TESTS];
int reagVolume[MAX_TESTS];
int sampleVolume[MAX_TESTS];
float linLim[MAX_TESTS];
float blankMin[MAX_TESTS];
float blankMax[MAX_TESTS];
int delayT[MAX_TESTS];
int rateT[MAX_TESTS];
char noOfReadings[MAX_TESTS];
float absMin[MAX_TESTS];
char printCurve[MAX_TESTS];
char shortName[MAX_TESTS][SHORTNAMELENGTH+1];/* +1 is for NULL Character */
char fullName[MAX_TESTS][FULLNAMELENGTH+1];/* +1 is for NULL Character */
float standard[MAX_TESTS];
float blankOD[MAX_TESTS];
float standardOD[MAX_TESTS];
unsigned char DACgainSet[MAX_TESTS][2];
unsigned char calibrationDone[MAX_TESTS];
unsigned char relayStatus[MAX_TESTS][2];

};

struct param xdata saveTestParam _at_ 0x8000;

I want to initialise these 30 tests with some initial values which are different for different tests. One set of structure takes 80 bytes of storage so for 30 tests, 80x30 = 2400 bytes are required.

I would like to store all these values(which are different for different tests) in the code memory and use a for loop to initialise these tests. I am not sure how to store these values in the code memory so that they can be transferred to the structure whenever required.

Can anyone guide me how to do this. I am using a Keil C cross compiler.


Regards,

Mohit

0