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

MSP4\F5348 调试AD12寄存器不能给变量赋值

 A0results;

 A1results;

在单步调试的时候ad12MEMO  ad12MEM1中的值没办法赋到上述两个变量中,

请问是怎么回事

#include <msp430.h>volatile unsigned int A0results;
volatile unsigned int A1results;
void main(void)
{
volatile unsigned int a0;
volatile unsigned int a1;
WDTCTL = WDTPW + WDTHOLD;
P6SEL = 0x03;
P6DIR = 0x00;
REFCTL0 &= ~REFMSTR;
ADC12CTL0 = ADC12ON + ADC12MSC + ADC12REF2_5V + ADC12REFON + ADC12SHT02;

ADC12CTL1 = ADC12SHP + ADC12CONSEQ1 + ADC12CONSEQ0;

ADC12MCTL0 = ADC12SREF_1+ADC12INCH_0;
ADC12MCTL1 = ADC12SREF_1+ ADC12INCH_1+ADC12EOS;
ADC12IE = 0x0002;
ADC12CTL0 |= ADC12ENC;

while(1)
{
ADC12CTL0 |= ADC12SC;
while((ADC12IFG == 0x03)==1);
{
__no_operation();
a0 = A0results;
a1 = A1results;
}
}
}

__interrupt void ADC12ISR(void)
{
switch(__even_in_range(ADC12IV,34))
{
case 0: break; // Vector 0: No interrupt
case 2: break; // Vector 2: ADC overflow
case 4: break; // Vector 4: ADC timing overflow
case 6: break; // Vector 6: ADC12IFG0
case 8:
A0results= ADC12MEM0;
A1results = ADC12MEM1; // Vector 8: ADC12IFG1
case 10: break; // Vector 10: ADC12IFG2
case 12: break;
case 14: break; // Vector 14: ADC12IFG4
case 16: break; // Vector 16: ADC12IFG5
case 18: break; // Vector 18: ADC12IFG6
case 20: break; // Vector 20: ADC12IFG7
case 22: break; // Vector 22: ADC12IFG8
case 24: break; // Vector 24: ADC12IFG9
case 26: break; // Vector 26: ADC12IFG10
case 28: break; // Vector 28: ADC12IFG11
case 30: break; // Vector 30: ADC12IFG12
case 32: break; // Vector 32: ADC12IFG13
case 34: break; // Vector 34: ADC12IFG14
default: break;
}
}

HG:

有中断产生么,中断处理函数能不能进?这两个寄存器里面有没有值?

灰小子:

ADC12CTL0 &= ~ENC; //只有在ENC复位的情况下才能对ADC12CTL0、1进行设置

赞(0)
未经允许不得转载:TI中文支持网 » MSP4\F5348 调试AD12寄存器不能给变量赋值
分享到: 更多 (0)