MSP430的堆栈问题

来源:百度知道 编辑:UC知道 时间:2024/06/06 08:36:51
在使用MSP430学习机调试Flash程序时,出现错误:Sat May 16 20:28:40 2009: The stack 'Stack' is filled to 100% (80 bytes used out of 80). The warning threshold is set to 90.%
我选用的单片机型号是MSP430F449,软件为IAR4.20,程序为
#include <msp430x44x.h>

#define FLASH_ADR 0x1200

void InitSys();
void FlashErase(unsigned int adr);
unsigned char FlashBusy();
void FlashWB(unsigned int Adr,unsigned char DataB);

void InitSys()
{
unsigned int count0=0;
do
{
IFG1 &= ~OFIFG; //清除振荡器失效标志
for (count0=0xFF; count0>0; count0--);
}
while ((IFG1 & OFIFG)!=0); //判断XT2是否起振
_EINT();
}

void FlashErase(unsigned int adr)
{
unsigned char *p0;
FCTL1=FWKEY+ERASE;
FCTL2=FWKEY+FSSEL_1+FN3+FN4; //分频为320kHz
FCTL3=FWKEY; //解锁
while(FlashBusy()==1);
p0=(unsigned char *)adr;
*p0=0;
while(FlashBusy()==1);
FCTL3=FWKEY+LOCK;
}

unsigned char FlashBusy()
{

我用的是iar4.21b,估计都一样,你需要修改general options里的stack/heap项,把值修大点就行了,我感觉你最好是从代码处找毛病,因为默认的值一般情况下都比较合理!只是点拙见,适量参考

估计你是软件版本的问题吧 在我的计算机上面 加上了
FlashErase(Address);
for(i=0;i<=1;i++)
{
FlashWB(Address,10);
Address++;
}
Address=FLASH_ADR;

也没有出现任何错误信息