Problem with Freescale Compiler

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problem with Freescale Compiler

1,469件の閲覧回数
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 返答(返信)

672件の閲覧回数
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 件の賞賛
返信

672件の閲覧回数
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 件の賞賛
返信