[En-Nut-Discussion] Receiving data problem

MUHAMMAD AZEEM AZAM muhammadazeemazam786 at yahoo.com
Mon Jan 22 21:12:57 CET 2007


Hello
   
  I can use malloc
  But i have to send 131072 Bytes of data (ie 2Dimensional array ,  128KB Data , 
  char array[1024][128] accessing memory )
  How is that possible.
  can Malloc reserve that amonut of memory
  My microcontroller is ATmega 128.
   
  Thanks
  Bye
  
Ulrich Hertlein <ulrich.hertlein at artcom.de> wrote:
  MUHAMMAD AZEEM AZAM wrote:
> i am unable to sent 2d ARRAY TO MY CLIENT ON PC.
> the code is below.
> I have to use tcp sockets.
> i need to send "char var[1024][128]" this array. 
> "char var[4][128]" this thing is working but after that my client application hangs.
> 
> if (strncmp(buff, "2darray", got_data) == 0) //If Match 
> {
> int a = 5;
> int b = 128;
> char mvar[a][b];
> char mvarr[128];

When using variables like that you're allocating from the stack.
It's possible you're overwriting your stack and thereby messing up your app.

Try using malloc to allocate from the heap and see if it makes a difference.

/Ulrich

-- 
Ulrich Hertlein | Software Development

ART+COM AG
Kleiststr. 23-26 | 10787 Berlin | Germany

phone: +49.30.21001-433
fax: +49.30.21001-555
http://www.artcom.de
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion


  
---------------------------------
Looking for earth-friendly autos? 
 Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.  


More information about the En-Nut-Discussion mailing list