sscanf problem

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

sscanf problem

658 Views
freddyka
Contributor I

Hi,

 

i have a problem with using sscanf. I want to convert a hexdezimal ASCII Code to an integer. If i use it in main(), everything works, but if i put in in an event like AS1_OnRxChar() it does not work. Sometimes there are the wrong results, somtimes the program "hangs".

 

My code is like:

void  AS2_OnRxChar(void)
{
...
      char in[] = "CD";
      int i;   
...

      sscanf(in, "%x", &i);

...

}

The variable i should be 205, but it does not work!!!

Can sombody help me? What is my mistake?

Best Regards

 

freddyka

Labels (1)
0 Kudos
2 Replies

419 Views
CompilerGuru
NXP Employee
NXP Employee

Sounds like a stack overflow. Increase the STACK_SIZE in the prm file.

0 Kudos

419 Views
freddyka
Contributor I

Hi,

 

if i change the Stack-size sometime it runs better, sometimes not. It seems, that is the problem. But what size is necessary for the Stack? Where can i see the used RAM? My microcontroller is the MC9S08DZ60.

 

Thank you for an answer,

 

freddyka

0 Kudos