片子是149型号,之前调单路P6.0通道ad采集,一切正常,
现在要采集8路ad,用P6脚 序列多通道多次转换,初始化如下。调试发现,AD1通道依旧正常,AD2...AD8采集数不正确。望哪位朋友赐教。谢谢
P6DIR =0x00; //p6=input
P6SEL = 0xff; // Enable A/D channel A0 A1 A2 A3 ....A7
ADC12MCTL0 |=0x020; // sel channel A0 Sref=1 OUT VR+=VEREF
ADC12MCTL1 |=0x020; // sel channel A1 Sref=1 OUT VR+=VEREF
ADC12MCTL2 |=0x022; // sel channel A2 Sref=1 OUT VR+=VEREF
ADC12MCTL3 |=0x023; // sel channel A3 Sref=1 OUT VR+=VEREF
ADC12MCTL4 |=0x024; // sel channel A4 Sref=1 OUT VR+=VEREF
ADC12MCTL5 |=0x025; // sel channel A5 Sref=1 OUT VR+=VEREF
ADC12MCTL6 |=0x026; // sel channel A6 Sref=1 OUT VR+=VEREF
ADC12MCTL7 |=0x027; // sel channel A7 Sref=1 OUT VR+=VEREF
ADC12MCTL7 |=0x080; // set channel A7 last time
ADC12CTL0 = ADC12ON;//+SHT0_0;//+SHT1_0;
ADC12CTL0 |= 0x0080; //MSC=1
ADC12CTL1 = SHP; // Use sampling timer /ADC12OSC
ADC12CTL1 |= 0x0008; // ADC12SSEL=1 Use sampling timer /ACLK
ADC12CTL1 |= 0x0006; //mult channel conseq continue ad
ADC12CTL0 |= ENC; // Enable conversions
ADC12CTL0 |= ADC12SC; // Start conversion |
|