//-----------------------------------------------------------------------------------------
//函数名称:void SD24_Init(void)
//功能描述: SD24初始化函数
//说 明:
//-----------------------------------------------------------------------------------------
void SD24_Init(void)
{
int n,i;
SD24CTL = SD24REFON+SD24SSEL0+SD24DIV_3+SD24XDIV_3+SD24OVIE+SD24VMIDON; // 1.2V ref, SMCLK,8分频
SD24CCTL0 |= SD24LSBACC+SD24LSBTOG ; // Single conv, enable interrupt,自动高低位变化,初始读低位
SD24INCTL0 |= SD24INCH_0+SD24INTDLY0; //
for(n=0;n<8;n++)
{
for (i = 0; i < 0x3600; i++); // Delay for 1.2V ref startup
}
}
//-----------------------------------------------------------------------------------------
//函数名称:void SD24AISR(void)
//功能描述: SD24中断函数
//说 明:
//-----------------------------------------------------------------------------------------
#pragma vector=SD24_VECTOR
__interrupt void SD24AISR(void)
{
SD24CCTL0 &= ~SD24IE;
SD24CCTL0 &= ~SD24SC;
switch (SD24IV)
{
case 2: // SD24MEM Overflow
break;
case 4:
results[index]= SD24MEM0;
break;
}
//delay_us(200);
SD24CCTL0 |= SD24IE;
SD24CCTL0 |= SD24SC;
}
单片机型号MSP430AFE221,进入中断函数后SD24IV值始终为0或2。。不知道为什么?
盼大虾们帮忙解答下,先谢了~ |