Problem with Freescale Compiler

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Problem with Freescale Compiler

1,473 次查看
MarkusWimmer
Contributor I

Hello, i have some trouble with my programm an i hop you can help me.

 

Her my code 

for(;:smileywink:
  {
   
        int result;
        float voltage;
       
   
        ACMP1SC = 0x00; //Analog Comperator ausschalten
       
        ADCSC1 = 0x22;  //Kanal 1 Messung jede Sekunde
        while (!(ADCSC1 & 0x80))
          ;
        result = ~ADCRL;     
      
        voltage = 4096/1023*result;
    
   
  }    

The Compiler error is

"Link Error   : L1822: Symbol _FSFLOAT in file C:\Users\Markus\Desktop\BAUVORHABEN\BUS_SYSTEM\SOFTWARE\EINFACHE_ROUTINEN\Analog\Analog_Data\Standard\ObjectCode\main.c.o
is undefined
Link Error   : Link failed"

 

What´s wrong with this code??

Thanks Markus

标签 (1)
0 项奖励
回复
2 回复数

676 次查看
CompilerGuru
NXP Employee
NXP Employee

As Markus already explained, you are using a integral only library.

 

Check if you do need indeed floating point numbers, for a small 8 bit chip using integers (including longs) is much efficient.

 

Also

voltage = 4096/1023*result;

is not actually performing the computation in floating point arithmetic, instead it computes

 

voltage = 4*result;

 

4096/1023 is 4 (int type), and not 4.0039100684...

 

Daniel
0 项奖励
回复

676 次查看
pgo
Senior Contributor V

Dear Markus,

 

It looks like the floating point library is missing.

 

When you created the project did you select the floating point option?  It appears at the bottom of

  one of the New Project Wizard dialogues.

 

bye

0 项奖励
回复