EmbeddedRelated.com
Forums

Problem of Structure array filling from ADC memory for MSP430F149

Started by svijbhaskar January 3, 2006
Hi to all,


The following structure declaration for six arrays of integers for 
MSP430F1611 


__no_init struct channel
{
 int  ch[50];
}ch0,ch1,ch2,ch3,ch4,ch5;


for storing the ADC sample values

           for(k=0;k<50;k++)
	   {
	   	ch0.ch[k] = ADC12MEM0;                               
           	ch1.ch[k] = ADC12MEM1;
           	ch2.ch[k] = ADC12MEM2;
	   	ch3.ch[k] = ADC12MEM3;
           	ch4.ch[k] = ADC12MEM4;
           	ch5.ch[k] = ADC12MEM5;
	    }

is working well.


	But, when I use the same declaration for the MSP430F149 to 
store ADC values, the arrays  seem to be filled with some
abnormal values after storing the ADC memory register values, 
especilly for last arrays, ch4 and ch5. Please help me in 
solving this problem for MSP430F149.






Beginning Microcontrollers with the MSP430

6 arrays * 50 elements/array * 2 bytes/element = 600 bytes.

I assume your stack is crashing into the last two arrays as the 1611 has
10K of RAM, the 169 has 2K.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and now MAXQ processors

> -----Original Message-----
> From: svijbhaskar [mailto:svijbhaskar@svij...] 
> Sent: 03 January 2006 05:41
> To: msp430@msp4...
> Subject: [msp430] Problem of Structure array filling from ADC 
> memory for MSP430F149
> 
> Hi to all,
> 
> 
> The following structure declaration for six arrays of integers for 
> MSP430F1611 
> 
> 
> __no_init struct channel
> {
>  int  ch[50];
> }ch0,ch1,ch2,ch3,ch4,ch5;
> 
> 
> for storing the ADC sample values
> 
>            for(k=0;k<50;k++)
> 	   {
> 	   	ch0.ch[k] = ADC12MEM0;                               
>            	ch1.ch[k] = ADC12MEM1;
>            	ch2.ch[k] = ADC12MEM2;
> 	   	ch3.ch[k] = ADC12MEM3;
>            	ch4.ch[k] = ADC12MEM4;
>            	ch5.ch[k] = ADC12MEM5;
> 	    }
> 
> is working well.
> 
> 
> 	But, when I use the same declaration for the MSP430F149 to 
> store ADC values, the arrays  seem to be filled with some
> abnormal values after storing the ADC memory register values, 
> especilly for last arrays, ch4 and ch5. Please help me in 
> solving this problem for MSP430F149.
> 
> 
> 
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 

>From: svijbhaskar <svijbhaskar@svij...>
>Date: Mon Jan 02 23:41:14 CST 2006
>To: msp430@msp4...
>Subject: [msp430] Problem of Structure array filling from ADC memory for
MSP430F149

Svij,
 
>The following structure declaration for six arrays
of integers for 
>MSP430F1611 

>
>      But, when I use the same declaration for the MSP430F149 to 


the 1611 has 10Kbytes of RAM, the 149 has only 2Kbytes.

Without jumping into this too far, I would look at stack overflows, or at least
if the stack grew big enough to meet up with your data arrays. 

Other things to check may include where these arrays are positioned in memory.
Do they extend beyond allowable RAM space? When you switched processors, you may
not have changed the memory model and the arrays may be put into invalid
locations.

Good Luck, and Let us know how things work out!

Rachel Adamec
Norristown, PA, USA


Perhaps you're RAM use that works on 1611 is falling off the end of RAM
on the 149.
Be aware 
The 149  has  2Kb of RAM 0200-09FF.
The 1611 has 10Kb of RAM 1100-38FF (where the lower 2Kb is mirrored
0200-09FF).

Regards,

Colin,
 
-----Original Message-----
From: msp430@msp4... [mailto:msp430@msp4...] On Behalf
Of svijbhaskar
Sent: 03 January 2006 05:41
To: msp430@msp4...
Subject: [msp430] Problem of Structure array filling from ADC memory for
MSP430F149

Hi to all,


The following structure declaration for six arrays of integers for
MSP430F1611 


__no_init struct channel
{
 int  ch[50];
}ch0,ch1,ch2,ch3,ch4,ch5;


for storing the ADC sample values

           for(k=0;k<50;k++)
	   {
	   	ch0.ch[k] = ADC12MEM0;                               
           	ch1.ch[k] = ADC12MEM1;
           	ch2.ch[k] = ADC12MEM2;
	   	ch3.ch[k] = ADC12MEM3;
           	ch4.ch[k] = ADC12MEM4;
           	ch5.ch[k] = ADC12MEM5;
	    }

is working well.


	But, when I use the same declaration for the MSP430F149 to 
store ADC values, the arrays  seem to be filled with some
abnormal values after storing the ADC memory register values, 
especilly for last arrays, ch4 and ch5. Please help me in 
solving this problem for MSP430F149.







.

 
Yahoo! Groups Links



 



RAM too small?

M.

On Tue, Jan 03, 2006 at 05:41:14AM -0000, svijbhaskar
wrote:
> Hi to all,
> 
> 
> The following structure declaration for six arrays of integers for 
> MSP430F1611 
> 
> 
> __no_init struct channel
> {
>  int  ch[50];
> }ch0,ch1,ch2,ch3,ch4,ch5;
> 
> 
> for storing the ADC sample values
> 
>            for(k=0;k<50;k++)
> 	   {
> 	   	ch0.ch[k] = ADC12MEM0;                               
>            	ch1.ch[k] = ADC12MEM1;
>            	ch2.ch[k] = ADC12MEM2;
> 	   	ch3.ch[k] = ADC12MEM3;
>            	ch4.ch[k] = ADC12MEM4;
>            	ch5.ch[k] = ADC12MEM5;
> 	    }
> 
> is working well.
> 
> 
> 	But, when I use the same declaration for the MSP430F149 to 
> store ADC values, the arrays  seem to be filled with some
> abnormal values after storing the ADC memory register values, 
> especilly for last arrays, ch4 and ch5. Please help me in 
> solving this problem for MSP430F149.
> 
> 
> 
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
        Matthias