Harsha Sidramappa

Code get reset when i tried to run small application please help me to solve this issue - MC9S08AC128

Discussion created by Harsha Sidramappa on Dec 15, 2008
Latest reply on Dec 16, 2008 by Harsha Sidramappa
Dear All,
 
I am using the MC9S08AC128 Simulator. I am using the Special edition Code warrior
 
I have created a project with IEEE32 Floating support enabled.
 
I have small piece of code which will calculate the distunce between two coardinates of the Earth.
 
I am using library functions like sinf, cosf, atan2f.
 
 ..............
................. some Declarations here all are float values
.................... 
line1.   sin2lat = sinf(Dlat2Rad/2);
  ....................
 
line2.  sin2lng = sinf(DLng2Rad/2);
  ......................................
 
line3.  a = sin2lat + cosf(Lat1Rad) * cosf(Lat2Rad) * sin2lng;
 
A_sqrt = sqrtf(a);
 
  A_sqrt1 = sqrtf(1-a);
............................................ Till here it works fine .
 
c = 2 * atan2f(A_sqrt,A_sqrt1); When i press f9 here it resets the CPU andgoes to 0x000 PC..

Here i noticed that i can call only four library functions ex. sinf,cosf ......which i have done in code...
 
 
If i Remove any 2 calls of library function() (Remove line1 & line2 ) then my code will work fine(i am able to call atan2f and CPU doesn't reset executes normally ).... I don't understand what might be the probelm ...........
 
please anybody can give some suggestions....
 
Warm Regards,
Harsha S
 
Added p/n to subject.


Message Edited by NLFSJ on 2008-12-17 07:48 AM

Outcomes