Jump to content
43oh

String object strange behaviour


Recommended Posts

I am running an MSP-EXP430G2 Lauchpad with an MSP430G2553 on Windows 7.

 

The following code:

============================

#include <IRremote.h>
String st;
 
void setup()
{
     Serial.begin(9600);
     st=String();
}
 
void loop()
{
   st=st+'2';
   Serial.println(st);  
   delay(200); 
}
===============
produces following output:
2
22
222
2222
22222
222222
2222222
22222222
222222222
2222222222
22222222222
222222222222
2222222222222
22222222222222
222222222222222
2222222222222222
22222222222222222
222222222222222222
2222222222222222222
 
2
22
222
2222
.....
After a string length of 19 the string is cleared.  Why?
When exactly this happens depends also on additional code.
With a MPU with lesser RAM I would guess that the RAM overflows, but 0.5kB of the MSP430G2553 should be large enough.
Has anybody an explanation?
cheers, Daniel
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...