|
我这个程序为什么采集不到数据,哪位大神能讲解一下,谢谢
[复制链接]
void ADC10_init() //ADC10初始化函数
{
ADC10CTL0|=SREF_2+ADC10IE;
ADC10CTL0|=ADC10SHT_1+MSC;
ADC10CTL1|=ADC10SSEL_3+ADC10DIV_7+SHS_0;
ADC10CTL1|=INCH_5+CONSEQ_2;
ADC10CTL0|=ADC10ON;
ADC10AE0|=BIT5;
}
int main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
Clk_init(); //时钟初始化
Lcd_Io_init(); //12864Io口初始化
Lcd_dis_init();
write_com(0x81);
delay_ms(5);
Lcd_dis_string("ADC 电压采集");
ADC10_Io_init();
ADC10_init();
ADC10CTL0&=~ENC;
while(ADC10CTL1&ADC10BUSY);
ADC10CTL0|=ADC10SC+ENC;
_EINT();
LPM0;
}
#pragma vector=ADC10_VECTOR
__interrupt void ADC_SR()
{
uchar j;
A[k++]=ADC10MEM;
if(k==64)
{
for(i=0;i<64;i++)
{
sum+=A[i];
}
sum>>=7;
real=2500*sum/1023;
Volate[0]=real/1000+0x30;
Volate[1]=0x2e;
Volate[2]=(real%1000)/100+0x30;
Volate[3]=(real%100)/10+0x30;
Volate[4]=real%10+0x30;
write_com(0x90);
for(j=0;j<5;j++)
{
write_data(Volate[j]);
}
}
LPM0_EXIT;
}
|
|