#include "msp430f437.h"
#include "LCD.h"
#define Num_of_Results 8
unsigned char table[]={0x08,0x04,0x02,0x01,0x02,0x04,0x08};
float ADC0=0;
fp32 result[Num_of_Results];//静态结果数组
void ADC12_many_cover_Init(void)
{
//unsigned int i;
P6SEL|=0X08;//使能AD通道A3
ADC12CTL0=ADC12ON+SHT0_8+MSC;//打开ADC12模块+采集分频系数n=8+采样信号由SHI仅首次触发(上升沿)
ADC12CTL1=CSTARTADD_0+SHP+CONSEQ_2;//SAMPCON信号选为采样定时器输出+单通道多次转换
ADC12IE=0x01;//允许A0中断 ADC12IFG.0
//ADC12内部参考电压设置
ADC12CTL0|=REF2_5V;//选用内部参考电压2.5v
ADC12MCTL0|=REFON;//内部参考电压打开
//for(i=0;i<0x3600;i++)
ADC12CTL0|=ENC;//转换允许
ADC12CTL0|=ADC12SC;//开始转换
_BIS_SR(LPM0_bits+GIE);//进入LPM0,开中断总允许
//_EINT();
}
void main( void )
{
WDTCTL = WDTPW + WDTHOLD; //关闭看门狗
P2DIR|=BIT6;
2OUT|=BIT6;
Lcd_Init();
ADC12_many_cover_Init();
}
#pragma vector=ADC_VECTOR
__interrupt void ADC12ISR(void)
{
ADC0=ADC12MEM0;
ADC0=(2.5*ADC0/4095);
show_
time(ADC0);
}
上面是我的ADC12单通道多次采集的程序,各位大神帮忙看一下,哪里有错,
单片机一上电显示的ADC0的值就是2.5.