Hi guys, I use Keil µV3 for C16x for 1 year and today a problem came alive. I tried to solve it by myself, but not successfully. So I'm asking you - the experts of this forum - for any help (just a hint could be enough). First let me introduce the problem by posting the source code:
//Definition of data type typedef union { unsigned char c2bytes[2]; unsigned int iWord; } tLUT; extern void vInitLUTforFT ( tLUT xhuge * ); ... main ( ) { tLUT XDATA uLUTamp[1024]; vInitLUTforFT ( ( tLUT xhuge * ) uLUTamp[0].iWord ); } ... //problematic function void vInitLUTforFT ( tLUT xhuge *pLUTamp ) { unsigned int iAdd; iAdd = iIsolBitsToWord ( *pLUTamp.c2bytes[1], 0x03, 0 ); }
You committed a simple C programming error --- nothing particular to C166 or uV3. You got caught by operator precedence rules on pointers versus struct/union element dereferencing. This line
iAdd = iIsolBitsToWord (*pLUTamp.c2bytes[1], 0x03, 0 );
iAdd = iIsolBitsToWord ((*pLUTamp).c2bytes[1], 0x03, 0 );
iAdd = iIsolBitsToWord (pLUTamp->c2bytes[1], 0x03, 0 );
Such a simple problem. I can't believe it, now it compiles fine. Thanks a lot!