Other Parts Discussed in Thread: MSP430F5438A, MSP430F5438
Hello!
I am using MSP430f5438a for sensor network application which contains positioning ,i have 3072 bytes of char array how can i use this arrays in my program!!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Other Parts Discussed in Thread: MSP430F5438A, MSP430F5438
Hello!
I am using MSP430f5438a for sensor network application which contains positioning ,i have 3072 bytes of char array how can i use this arrays in my program!!
This seems like a very generic question. I'm not certain what you are really asking here. Please clarify.
If you need some information on what arrays in C are and how to interact with them (ie. use them), there are a number of good books and tutorials online for describing C constructs.
BrandonAzbell said:... there are a number of good books and tutorials online for describing C constructs.
I have a load of suggestions here: http://blog.antronics.co.uk/2011/08/08
Dear Brandon!
I am a high level programmer like java ,C# and C++,and starter in MSP430 i write the program in PC and it works fine but when i start to use Code Composer v5 it run until the size is 1200 bytes but after that i can not load it ,even the run and step into buttons disappear and it makes difficult for me to debug and i am not sure whether it is loaded or not!!
I found your other post regarding the observation of the behavior of CCS. My reply on that thread was to use a smaller, known working example to isolate the issue from your application.
The 5438 has 16k of ram. Your 3k array shouldn't cause any problem. So most likely, it is something else or the combination of other things you do.Binyam Shiferaw said:when i start to use Code Composer v5 it run until the size is 1200 bytes but after that i can not load it ,even the run and step into buttons disappear
Do you have large local variables? they add to the stack at runtime and perhaps the stack overflows into your array and access to the array overwrites the stack and the whole thing crashes. We've had a case where at the beginning of main an array of 512 bytes was defined, but th eMSP did only have 512 bytes ram total. So the define of the local variable immediately pushed he stack past the ram area and crashed the system.
On older MSP seires, large amoiunts of initialized data could cause the watchdog timer to expire during variable initialization. On 5438, however, the default watchdog delay is much larger and this doesn't happen.
On PC, you usually have 64k for the stack and next to no limits on data size. On MSP430, both, variables and stack share the same small ram space.Binyam Shiferaw said:i write the program in PC and it works fine
I dont have any local variables just see the code below and judge if i have many many local variables.
ebelow
#include<msp430f5438.h>
//#include"header.h"
char ucode_data[3072] = {0,0};
void led(char a[],int);
void main(void) {
P1DIR=BIT0;
int size =3500;
P1OUT&=~BIT0;
led(ucode_data,size);
}
void led(char a[],int s)
{
//long c=ab+b;
P1OUT&=~BIT0;
while(s>0)
{
P1OUT|=BIT0;
s--;
}
}
I just compiled your code using MSPGCC and the compiler didn't generate anything suspicious.
It is rather unusual to type a function parameter as "char a[]", but IMHO valid. The more usual version would be "char * a"
The code doesn't make much sense (it clears P1.0, then sets it 3072 times), but otherwise should work. So it must be something else...
The code seems to be written for a 5438 (according to the include), but is this the processor that is set in the project settings? It may be that the compiler and linker compile and link for a different device with less ram and then stack position and variables do only utilize a much smaller ram. Just an idea.
**Attention** This is a public forum