/*另外一个Tab.c文件中的表格的内容*/
const unsigned char ATab[256] = {.......};
const unsigned char BTab[256] = {.......};
const unsigned char CTab[256] = {.......};
const unsigned char DTab[256] = {.......};
const unsigned char ETab[5] = {.......};
const unsigned char FTab[5] = {.......};
const unsigned int FadeSpTab[5] = {0x0500,0x0300,0x0150,0x0060,0x0020};
//子函数里用到的内存
extern const unsigned int FadeSpTab[5];
unsigned char SpeedVar;
unsigned int ModeSpeed;
void FadeMode(void)
{
ModeSpeed = FadeSpTab[SpeedVar];
}
/*为什么ModeSpeed中的数不是表格中的数呢,有时候等于5,有时候等0,
当我把表格放从Tab.c文件中剪切到函数中时,ModeSpeed的值就是表格中的值,
程序如下:*/
unsigned int FadeSpTab[5] = {0x0500,0x0300,0x0150,0x0060,0x0020};
unsigned char SpeedVar;
unsigned int ModeSpeed;
void FadeMode(void)
{
ModeSpeed = FadeSpTab[SpeedVar];
} |