TI中文支持网
TI专业的中文技术问题搜集分享网站

msp430f149AD采集失败问题

硬件出什么问题会使msp430f149在ad采样时失败(无法进入中断),我用的TI给的ad采样的例程,在线调试时应该是无法进入中断,在register栏中MEM0,MEM1,MEM2,MEM3的值都为零,求会的朋友帮忙,谢谢了!!ad转换的值没有写进去如下图

程序如下

#include <msp430.h>

static unsigned int results[4]; // Needs to be global in this example
// Otherwise, the compiler removes it
// because it is not used for anything.

int main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL = 0x0F; // Enable A/D channel inputs
ADC12CTL0 = ADC12ON+MSC+SHT0_2; // Turn on ADC12, set sampling time
ADC12CTL1 = SHP+CONSEQ_1; // Use sampling timer, single sequence
ADC12MCTL0 = INCH_0; // ref+=AVcc, channel = A0
ADC12MCTL1 = INCH_1; // ref+=AVcc, channel = A1
ADC12MCTL2 = INCH_2; // ref+=AVcc, channel = A2
ADC12MCTL3 = INCH_3+EOS; // ref+=AVcc, channel = A3, end seq.
ADC12IE = 0x08; // Enable ADC12IFG.3
ADC12CTL0 |= ENC; // Enable conversions

while(1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, Enable interrupts
}
}

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR (void)

#elif defined(__GNUC__)
void __attribute__ ((interrupt(ADC12_VECTOR))) ADC12ISR (void)
#else
#error Compiler not supported!
#endif
{ results[0] = ADC12MEM0; // Move results, IFG is cleared
results[1] = ADC12MEM1; // Move results, IFG is cleared
results[2] = ADC12MEM2; // Move results, IFG is cleared
results[3] = ADC12MEM3; // Move results, IFG is cleared
__bic_SR_register_on_exit(LPM0_bits); // Clear LPM0, SET BREAKPOINT HERE
}

user5767411:

补充一下,编译时出现results没有使用的警告

user5767411:

回复 Wei.Jetim Zhao:

您好,我用的是TI说给程序里的fet140_adc12_09,刚刚看了一下,确实没有调成FET Debugger,我调完之后在线调试时出现下面的图片,好像是我硬件的问题,但是用TI给的程序编译时有警告说中断里的变量results定义的但没有用到,也是因为硬件的问题吗,这是不是说明程序没有进入中断,麻烦您了,谢谢。

赞(0)
未经允许不得转载:TI中文支持网 » msp430f149AD采集失败问题
分享到: 更多 (0)