linck error??

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

linck error??

3,350 Views
quimey
Contributor I
This is from my tesis ,is a v/f  motor control ,for the v/f scale i need to scale the modulus of the pwm,but i need to use a float operation for decimal results
The problem is when i use the operation ./ this is the code: 
 
(is a mr32 8 bits microcontroler)
 
 
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
#include "sinetables.h"
unsigned char TableIndex = 0;
int leer=1;
int ADC_IN;
int i=1;
float ADC_FLOT;
float k;
 
 
if(ADC_IN<0X2FC){
k=1;}
if(0x2FC<=ADC_IN<=0x9F2){
k=ADC_IN*9/.17820;
k=-k+1.38585;
}
if(ADC_IN<0X9F2){
k=0.1;}
       
          PVAL1 =k * PHASE_A[TableIndex];
          PVAL3 =k * PHASE_B[TableIndex];
          PVAL5 =k * PHASE_C[TableIndex];
         
          leer=PCTL1_LDOK;
          PCTL1 |= 0x02;          /* Load new PWM values */
   
   
TableIndex++;           /* Update Table Index */
   
    if (TableIndex == 64)
    {
       TableIndex = 0;     /* Reset Table Index */
  }
 
 }
 
when I compiling te code warrior display tihs message:
 
 
Link Error   : L1822: Symbol _FSFLOAT in file C:\Documents and Settings\COMPAC\Mis documentos\SENOFRECVAR307\SENOFRECVAR307_Data\Standard\ObjectCode\main.c.o
is undefined

Link Error   : L1822: Symbol _FDIV_RC in file C:\Documents and Settings\COMPAC\Mis documentos\SENOFRECVAR307\SENOFRECVAR307_Data\Standard\ObjectCode\main.c.o
is undefined

Link Error   : L1822: Symbol _FNEG in file C:\Documents and Settings\COMPAC\Mis documentos\SENOFRECVAR307\SENOFRECVAR307_Data\Standard\ObjectCode\main.c.o
is undefined

Link Error   : L1822: Symbol _FADD_RC in file C:\Documents and Settings\COMPAC\Mis documentos\SENOFRECVAR307\SENOFRECVAR307_Data\Standard\ObjectCode\main.c.o
is undefined

Link Error   : L1822: Symbol _FUFLOAT in file C:\Documents and Settings\COMPAC\Mis documentos\SENOFRECVAR307\SENOFRECVAR307_Data\Standard\ObjectCode\main.c.o
is undefined

Link Error   : L1822: Symbol _FMUL in file C:\Documents and Settings\COMPAC\Mis documentos\SENOFRECVAR307\SENOFRECVAR307_Data\Standard\ObjectCode\main.c.o
is undefined

Link Error   : L1822: Symbol _FSTRUNC in file C:\Documents and Settings\COMPAC\Mis documentos\SENOFRECVAR307\SENOFRECVAR307_Data\Standard\ObjectCode\main.c.o
is undefined

Link Error   : Link failed
 
I must to installing codewarrior libraris
from were?
Labels (1)
0 Kudos
Reply
4 Replies

1,323 Views
bigmac
Specialist III
Hello,

When you created the CW project, did you specify that floating point operations were required?  This needs to be done in order to link the correct ANSI library file, that supports floating point operations.

However, since the PWMMC module is eventually loaded with 16-bit values, I would suspect that it should be possible to avoid the need for floating point calculations, and the conversion of floating point values to integer values, with the associated code size and timing penalties.  The careful use of integer calculations should be able to maintain 16-bit precision.

Regards,
Mac



Message Edited by bigmac on 2009-02-10 03:21 PM
0 Kudos
Reply

1,323 Views
quimey
Contributor I
Hey Mac do you know how to get out a integer part of a float number in C?
Because when I load the float number in a PVAL registers and debug the proyetc The compiller diplay  a message :warning convert float to integer but the signal is completely a disaster
sorry for my inglish
Muchas Gracias!!
0 Kudos
Reply

1,323 Views
bigmac
Specialist III
Hello,

It would seem that your calculation applies to a range of decimal values for ADC_IN of 764 to 2545.

Now consider the calculation -
k = ADC_IN*9/.17820;
Alternatively, this could be expressed as -
k = ADC_IN*50.50505;
This will give a calculated range 38586.8.. to 128535.3..

The next calculation 
k = -k+1.38585;  will negate slightly reduced values.

The next three calculations are similar to -
PVAL1 = k * PHASE_A[TableIndex];

You have not revealed what values are in the table, and whether they are floating point or integer.  However, my understanding is that PVALx variables provide an integer value.  If a table value should exceed 0.254, it is possible for an overflow condition and an erroneous conversion from floating point.

I wonder if this is your problem.  I also note that the calculated values are always negative (assuming table values are positive).  Is this correct?


Regards,
Mac



0 Kudos
Reply

1,323 Views
quimey
Contributor I
Thank you sow much for you help!
 I created the project again and it`s worck.
For the second ,I must to create a carrier of 8khz thit borders the PMOD to 0X307.
Bay
0 Kudos
Reply