AnsweredAssumed Answered

Hi, ATOI on HCS08 not working for me, help

Question asked by Gus Navarro on Mar 16, 2015
Latest reply on Jun 18, 2015 by ZhangJennie

Hi, im new here, and Im doing a proyect which happens that i need to change a string to integer.

On C eclipse works fine however on Freescale doesnt do anything.

 

Pleace help

 

I create a new proyect apart just to see ATOI working properly. I was able to see that the variable "number" changes from 4 to cero, as if nothing got atoi and if I uncoment the atof line i geet the error Symbol strtod ... is undefined.

 

Please advice (version of  my codewarrior is V6.3 build 9279

This is the code:

 

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

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

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

 

char y[] @0x0068 ="12";

char f[] @0x0070 ="143.343";

 

int number @0x0060 =4;

double flot;

 

void main(void) {

  

  EnableInterrupts; /* enable interrupts */

  /* include your code here */      

  for(;;) {

    __RESET_WATCHDOG(); /* feeds the dog */

      number=atoi((const char*)y);   /// also like this doesnt work : number=atoi(y);

  

     //flot = atof((const char*)f);

 

  } /* loop forever */

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

}

Outcomes