- UID
- 123796
- 性别
- 男
|
版主大人:
我用浮点型指针变量,子函数如下:
void code2volt(unsigned char *uv,float *voltage)
{
unsigned long code = 0;//the code in the waveform register
unsigned int c = 0;
code = (unsigned long)(*uv);
code = (code<<8);
uv++;
code = ((code|(*uv))<<8);
uv++;
code = (code|(*uv));
if((code&0x80000) != 0)//voltage is negative
{
code = (~code);
code = (code&0x0007ffff);//get the absolute value
code = code + 1;
}
else //voltage is positive
{
code = (code&0x0007ffff);//get the absolute value
}
*voltage = ((float)(code*2.4/1.52/262144));//get the voltage value in float
}
主函数中调用:
void main(void)
{
unsigned char u[3];
float Uvoltage = 0;
/* put your own code here */
EnableInterrupts;
for(;;)
{
code2float(u,&Uvoltage);
} /* wait forever */
}
报错:
Link Error : L1822: Symbol _FUFLOAT in file E:\BMS CODING\MC9S12 BMS\5.23\5.15_Data\P&E_ICD\ObjectCode\BMS.c.o is undefined
Link Error : L1822: Symbol _FMUL in file E:\BMS CODING\MC9S12 BMS\5.23\5.15_Data\P&E_ICD\ObjectCode\BMS.c.o is undefined
Link Error : L1822: Symbol _FDIV in file E:\BMS CODING\MC9S12 BMS\5.23\5.15_Data\P&E_ICD\ObjectCode\ATD.c.o is undefined
Link Error : Link failed
但是把形参和实参都改成unsinged int 类型的,则没有这个错误,是不是对12的浮点型指针有什么限制??谢谢!!
|
|