AnsweredAssumed Answered

exp,log and other math functions using CW for MCU Development Studio v10.6 and an MC9S08PA8

Question asked by Efthymios Kondos on Feb 3, 2016
Latest reply on Feb 8, 2016 by Efthymios Kondos

Dear community,

I am transfering a part of code from one MCU vendor (Atmel xmega32E5) to Freescale/NXP MC9S08PA8 MCU ,

and when I use the log function from math.h (i hope like other IDEs does)  the MCU "hits" endless restarts.

If i comment this line, MCU does its supposed job without any issue and i can see an ADC result on debugger crystal clear.


unsigned int temp;

double ftemp;


void main(void)


  System_Init();                                            //Initialise system hardware/software modules




  temp=ADC_Get_Sample(CH11);              //Read current channel ADC value (54us@8MHz)

  ftemp=log(((10240000/temp) - 10000));   //Endless restart occurs - CRITICAL point




1) How /When do i  update/include the "math.h" or similar (?) library header ?

2) Does this IDE support floats and doubles for "small ones" like the PA16 MCU?

(I have chosen at the beggining bareboard project with IIEE 64bit float support)


Best Regards,