Can anybody suggest the best technique to use for storing a look-up table array in ROM? Right now I just have: unsigned char code LUT1[256] = { 0, 1, 2, ..., 255};
That is very close to how Jon Ward from Keil has suggested to do it in the past. http://www.keil.com/forum/docs/thread2164.asp
I'd also suggest declaring the "unsigned char" as const. You won't be able to change the table contents. So, let the compiler know that fact, and it (and lint) can then help you find any potential mistakes in using the table as though it were variable.
Thanks very much. Paul
"I'd also suggest declaring the "unsigned char" as const. You won't be able to change the table contents. So, let the compiler know that fact, and it (and lint) can then help you find any potential mistakes in using the table as though it were variable." Actually, there's no need, the 'code' specifier has the desired effect (unmodifiable lvalue). Given 'C''s notion of the meaning of const it may possibly be safer to rely on the 'code' specifier.