Problem with Freescale Compiler

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with Freescale Compiler

1,472 Views
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

Labels (1)
0 Kudos
Reply
2 Replies

675 Views
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 Kudos
Reply

675 Views
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 Kudos
Reply