sscanf problem

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

sscanf problem

1,311 次查看
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

标签 (1)
0 项奖励
回复
2 回复数

1,072 次查看
CompilerGuru
NXP Employee
NXP Employee

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

0 项奖励
回复

1,072 次查看
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 项奖励
回复