程序如下:
初始化函数:
void SD24Init(void)
{
uint16_t i = 0;
SD24CTL = SD24REFON | SD24SSEL0 | SD24DIV_3;
SD24CCTL0 = (SD24SNGL | SD24GRP | /*SD24DF |*/
SD24LSBTOG);
SD24CCTL1 = (SD24SNGL | SD24GRP | /*SD24DF |*/
SD24LSBTOG);
SD24CCTL2 = (SD24SNGL | SD24IE | /*SD24DF |*/
SD24LSBTOG);
SD24INCTL0 |= SD24INCH_5;
SD24INCTL1 |= SD24INCH_6;
SD24INCTL2 |= SD24INCH_7;
for (i = 0; i < 0x3600; i++);
SD24CCTL2 |= SD24SC;
}
中断处理函数:
int32_t ConvData[3];
float SampValue[3];
#pragma vector=SD24_VECTOR
__interrupt void SD24AISR(void)
{
switch (SD24IV)
{
case 2:
break;
case 4:
break;
case 6:
break;
case 8:
ConvData[0] = SD24MEM0;
SD24CCTL0 |= SD24LSBACC;
ConvData[1] = SD24MEM1;
SD24CCTL1 |= SD24LSBACC;
ConvData[2] = SD24MEM2;
SD24CCTL2 |= SD24LSBACC;
ConvData[0] = (ConvData[0] << 16) + SD24MEM0;
SD24CCTL0 &= ~SD24LSBACC;
ConvData[1] = (ConvData[1] << 16) + SD24MEM1;
SD24CCTL1 &= ~SD24LSBACC;
ConvData[2] = (ConvData[2] << 16) + SD24MEM2;
SD24CCTL2 &= ~SD24LSBACC;
SampValue[0] = 0.6 * ConvData[0] / (4194304);
SampValue[1] = 0.6 * ConvData[1] / (4194304);
SampValue[1] = SampValue[1] * 1000 / 1.32 - 273;
SampValue[2] = 0.6 * ConvData[2] / (4194304);
break;
}
}
IAR5.5 3个SD24通道分别采样 芯片模拟供电电压、内部温度传感器、PAG偏置,采用24位数据模式,单次转换,
但是得到结果却是完全不对,有人知道原因吗?是不是我的程序有什么问题?求指导