我用以下的代码,都没有输出2.5V呢?
ADC12CTL0 &=~ ENC; //在进行设置时首先复位ADC的转换使能
ADC12CTL0 = ADC12ON+REF2_5V+SHT0_8; //采用内部2.5V参考,打开通道10REFON自动打开
ADC12CTL1 = SHP+ADC12SSEL_2; //上升沿采样,主时钟,MEM0
ADC12MCTL0 = EOS + INCH_10+SREF_1; //选择通道10,Vref+为参考电压,进行温度测量
ADC12CTL0 |= ENC;
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
void main(void)
{
unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL = 0x01; // Enable A/D channel A0
ADC12CTL0 = ADC12ON+SHT0_2+REFON+REF2_5V; // Turn on and set up ADC12,2.5V Internal REF
//ADC12CTL0 = ADC12ON+SHT0_2+REFON; // Turn on and set up ADC12,1.5V Internal REF
ADC12CTL1 = SHP; // Use sampling timer
ADC12MCTL0 = SREF_1; // Vr+=Vref+
for ( i=0; i<0x3600; i++) // Delay for reference start-up
{
}
ADC12CTL0 = ENC; // Enable conversions
while (1)
{
ADC12CTL0 = ADC12SC; // Start conversion
while ((ADC12IFG & BIT0)==0);
_NOP(); // SET BREAKPOINT HERE
}
}
用这个代码,没有任何的输出,VeREF脚为0V
一周热门 更多>