本人是菜鸟,请多多指教。
我定义了一个结构体
typedef struct
{
char name[12];
uint min;
uint max;
uint value;
}PARAM;
定义了一个结构体数组
PARAM code g_allparam[]=
{
{"th-n",0,250,1},
{"c1-F",-1,1,1},
{"c1-1",0,9999,500},
{"c1-2",0,250,0},
{"c2-F",-1,1,1},
{"c2-1",0,9999,100},
{"c2-2",0,250,0},
{"c3-F",-1,1,1},
{"c3-1",0,9999,1000},
{"c3-2",0,250,0},
{"c4-F",-2,2,-1},
{"c4-1",0,9999,58},
{"c4-2",0,250,0},
{"sh-2",1,4,0},
{"FL-1",1,100,100},
{"ALLn",0,1,0},
{"OFFS",-100,1000,0},
{"bPS",0,5,2},
{"CH-1",1,22,1},
{"SP-1",0,3,0},
{"A1-0",-1990,9999,1000},
{"A1-1",-1999,9999,1000},
{"U1-1",-1999,9999,1000},
{"U1-2",-1999,9999,1000},
{"yn",0,2,2},
{"U1-3",1000,2800,2800},
{"U1-4",0,1000,1000},
{"bb-1",0,50,25},
{"E1-H",1000,9999,1000},
{"E1-L",-1999,5000,0},
};
void setparam(E_SEQ seq,bool upordown)
{
bool bchg =false;
if(upordown)
{
if(g_allparam[seq].value<g_allparam[seq].max)
{
g_allparam[seq].value++; 编译时此处出现unmodifiable lvalue,为什么??
bchg =true;
}
}
else
{
if(g_allparam[seq].value<g_allparam[seq].min)
{
g_allparam[seq].value--;
bchg =true;
}
}
if(bchg)
{} //设置到仪器上 I2C模块
} |