Wierd wierd function behavior... - MCS08GT32A

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Wierd wierd function behavior... - MCS08GT32A

1,774件の閲覧回数
Rubberduck
Contributor I

I really hope someone can tell me whats is going wrong, im fairly new to c/codewarrior and to the HCS08GT32A microcontroller. The following doesn't make any sense me :smileysad:.

 

my main looks like this:

void main(void)

  char *test_str = "111222333";
  
  system_setup();
 
  for(;:smileywink:
  {
     display_string_still(test_str);
  }
}

void display_string_still(incomming_str)

  unsigned char disp_buffer[BUFFER_LENGTH][BUFFER_HEIGHT]; //BUFFER_LENGTH = 4  BUFFER_HEIGHT = 10
  unsigned char i;
  unsigned char j;
  
  display_string_rolling_left(incomming_str);
  

  for(i = 0; i < BUFFER_LENGTH; i++)
  {
    for(j = 0;j < BUFFER_HEIGHT; j++)
    {
      disp_buffer[i][j] = 0b00000000;
    }
  }

}

The above code doesn't work... But if I out comment the two for-loops it will run perfectly(display_string_rolling_left(incomming_str) is then working and making the text roll on my LEDS). But why?... First of all the for-loops occurs after the display_string_rolling_left(incomming_str) function call. To my knowledge these things should be executed sequential? And since the disp_buffer is a local variable, it shouldn't influence anything out of this void display_string_still() scope?.. Or am I missing something(which problerly is the case since im new in this microcontroller world :smileywink:) ?

 

 

Thanks in advance!

Rubberduck

 

Added p/n to subject.



Message Edited by NLFSJ on 2008-12-17 07:47 AM
ラベル(1)
0 件の賞賛
返信
2 返答(返信)

658件の閲覧回数
Lundin
Senior Contributor IV
First of all, 0b00000000 is not valid C and will not compile on any standard C compiler.

Apart from that, I suspect that the problem is related to a stack overflow. You are allocating 40 bytes on the stack at each function call.

What does "going wrong / doesn't work" mean, more specifically?
0 件の賞賛
返信

658件の閲覧回数
Rubberduck
Contributor I
You were right, it was the stacksize that was too small, so it runs again now :smileyhappy: Thanks alot for your answer!:smileyvery-happy:
 
What i meant with the going wrong thing, was that the display_string_rolling_left(incomming_str);
 was the place where the stack overflow was occuring, so i was just confused, since a change in function A made function B go mad, but I learned something, and thanks again :smileyhappy:
0 件の賞賛
返信