选用管脚P7.5,为ADC12的A13口,初始化配置如下:
P7SEL|=0x05;
ADC12CTL0=ADC12ON+ADC12REFON+ADC12REF2_5V;
ADC12CTL1=ADC12SHP;
ADC12MCTL0=ADC12SREF_1+ADC12INCH_5;
ADC12CTL0|=ADC12ENC;
没用到中断,读数据如下:
ADC12CTL0|=ADC12SC;
for(iTempi=0X00;iTempi<0X64;iTempi++);
while((ADC12CTL1&ADC12BUSY));
lVoltageValue=ADC12MEM0;
读出来的lVoltageValue一直为0X00,原因未知,请指点,谢谢!
Maka Luo:
P7SEL|=0x05; //P7.5 这个配置是不对的
应该是 P7SEL |= BIT5; //BIT5 0X20
USER
选用管脚P7.5,为ADC12的A13口,初始化配置如下:
P7SEL|=0x05; ADC12CTL0=ADC12ON+ADC12REFON+ADC12REF2_5V; ADC12CTL1=ADC12SHP; ADC12MCTL0=ADC12SREF_1+ADC12INCH_5; ADC12CTL0|=ADC12ENC;
没用到中断,读数据如下:
ADC12CTL0|=ADC12SC; for(iTempi=0X00;iTempi<0X64;iTempi++); while((ADC12CTL1&ADC12BUSY)); lVoltageValue=ADC12MEM0;
读出来的lVoltageValue一直为0X00,原因未知,请指点,谢谢!