do floating point supported in mc912zvca192

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

do floating point supported in mc912zvca192

1,311 Views
sathishkannan
Contributor III

Hi I checked floating point program but its showing error

 

#include <hidef.h> /* for EnableInterrupts macro */

#include "derivative.h" /* include peripheral declarations */

 

 

#include "math.h"

 

 

 

 

 

 

 

 

void main(void) {

 

 

  EnableInterrupts;

  /* include your code here */

 

 

  float a=4.5;

  float b=5.5;

  float c;

 

  c=a+b;

  for(;;) {

    __RESET_WATCHDOG(); /* feeds the dog */

   

  } /* loop forever */

  /* please make sure that you never leave main */

 

 

}

 

how to correct this code to check floating point operations?

 

i need to do natural log calculations also for below mentioned expression will it possible ?

 

 

 

 

 

 

 

#define A1    -13.4088568

#define B1     4547.9615

#define C1    -176965.92

#define D1     3861154

#define R25    10000        //10KOHM

#define R1     1000          // 1KOHM

 

 

//To Find Rt

Rt = {(4096/ADC)-1}*R1

 

 

//and To Find Temprature T

 

 

RtR25   =Rt/R25

result1 = log(Rt);

result2 = log(Rt)*log(Rt);

result3 = log(Rt)*log(Rt)*log(Rt);

 

 

//TEMP_KELVIN =1/(A1+B1+ln[Rt/R25]+C1ln2[Rt/R25]+D1ln3[Rt/R25]) (ln-natural log)

 

 

 

 

TEMP_KELVIN =1/(A1+B1+result1+(C1*result2)+(D1*result3))

TEMP_DEGREE=TEMP_KELVIN+273

Labels (1)
0 Kudos
Reply
3 Replies

1,131 Views
sathishkannan
Contributor III

thanks,

i am already running a non float type project.i need to change the option to support float points,how to change in between of projects. ?

0 Kudos
Reply

1,131 Views
RadekS
NXP Employee
NXP Employee

Hi Sathish,

Please add the right ansi library.

Under Settings + S12Z Linker + Input, the Libraries (see picture above) you must change the lib file used.

\CW MCU v10.6.4\MCU\S12lisa_Support\s12lisac

The readme.txt will provide more info to select the right lib file.

I hope it helps you.


Have a great day,
RadekS


-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,131 Views
RadekS
NXP Employee
NXP Employee

Hi Sathish,

When you create new project, you could select type of Float/Double type implementation.

Float support.png

Appropriate ANSI IEEE-754 Floating Point Library will be linked with your project.

IEEE-754 Floating Point Library.png


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------