飞思卡尔智能车CCD图象处理的C语言编程

2024-12-25 02:27:29
推荐回答(2个)
回答1:

我好不容易找出来一个。

int SignalProcess( unsigned int signal )

{

const int BitValue[8] = {43,26,12,6,-6,-12,-26,-43}; //MAX:28

int i,CurrPoint=0,LastPoint=0,BitNum=0;

unsigned char SignalBit[8];

for(i=0;i<8;i++)

{

SignalBit[i] = signal & 0x0001;

BitNum += SignalBit[i];

signal >>= 1;

}

switch(BitNum)

{

case 1:

for(i=0;i<8;i++)

if(SignalBit[i] != 0)

CurrPoint += BitValue[i];

CarState.E0 = CurrPoint;

break;

case 2:

for(i=0;i<8;i++)

if(SignalBit[i] != 0)

CurrPoint += BitValue[i];

CurrPoint >>= 1;

CarState.E0 = CurrPoint;

break;

default:

CarState.E0 = CarState.E1;

break;

}

return CalculateP()*100;

}

回答2:

晕~飞思卡尔智能车比赛都没开始,谁会乐意告诉你啊?