万安文 发表于 2012-4-16 20:55:57

求助:有关IAR仿真430时中断函数进不去的问题

今天参考了TI有关提供的ADC12的例程,想通过仿真来查看ADC12MEMx的转换结果,不过仿真的时候程序一直停留在main函数里面,根本没进中断服务函数,望大家帮忙看看到底是什么问题,simulation里的interrupt steup 的中断向量也已经设置成ADC12_VECTOR了,下面是代码//******************************************************************************
//MSP-FET430P140 Demo - ADC12, Sequence of Conversions (non-repeated)
//
//Description: This example shows how to perform A/D conversions on a sequence
//of channels. A single sequence of conversions is performed - one conversion
//each on channels A0, A1, A2, and A3. Each conversion uses AVcc and AVss for
//the references. The conversion results are stored in ADC12MEM0, ADC12MEM1,
//ADC12MEM2, and ADC12MEM3 respectively and are moved to 'results[]' upon
//completion of the sequence. Test by applying voltages to pins A0, A1, A2,
//and A3, then setting and running to a break point at the "_BIC..."
//instruction in the ISR. To view the conversion results, open a watch window
//in debugger and view 'results' or view ADC12MEM0, ADC12MEM1, ADC12MEM2, and
//ADC12MEM3 in an ADC12 SFR window.
//This can run even in LPM4 mode as ADC has its own clock
//Note that a sequence has no restrictions on which channels are converted.
//For example, a valid sequence could be A0, A3, A2, A4, A2, A1, A0, and A7.
//See the MSP430x1xx User's Guide for instructions on using the ADC12.
//
//
//                MSP430F149
//            -----------------
//         |               |
//   Vin0 -->|P6.0/A0          |
//   Vin1 -->|P6.1/A1          |
//   Vin2 -->|P6.2/A2          |
//   Vin3 -->|P6.3/A3          |
//         |               |
//
//
//M. Mitchell
//Texas Instruments Inc.
//Feb 2005
//Built with IAR Embedded Workbench Version: 3.21A
//******************************************************************************

#include<msp430x14x.h>

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

void 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(LPM0_bits + GIE);               // Enter LPM0, Enable interrupts
}
}

#pragma vector=ADC_VECTOR
__interrupt void ADC12ISR (void)
{
results = ADC12MEM0;                   // Move results, IFG is cleared
results = ADC12MEM1;                   // Move results, IFG is cleared
results = ADC12MEM2;                   // Move results, IFG is cleared
results = ADC12MEM3;                   // Move results, IFG is cleared
_BIC_SR_IRQ(LPM0_bits);                   // Clear LPM0, SET BREAKPOINT HERE
}

34071417 发表于 2012-4-16 23:24:16

看工程option中的debugger,driver设置如果为smulator的话,是进不去中断的;只有选择FET Debugger才行。

万安文 发表于 2012-4-17 07:12:58

34071417 发表于 2012-4-16 23:24 static/image/common/back.gif
看工程option中的debugger,driver设置如果为smulator的话,是进不去中断的;只有选择FET Debugger才行。 ...

不行啊,刚我试了一下如果选择FET Debugger的话就进不去仿真界面了,我是通过烦烦真来查看ADC12MEMx里面的结果

34071417 发表于 2012-4-17 09:31:46

你用的是IAR的话,仿真的话应该看不到吧

万安文 发表于 2012-4-17 12:00:26

34071417 发表于 2012-4-17 09:31 static/image/common/back.gif
你用的是IAR的话,仿真的话应该看不到吧

那请问怎样才能进去中断函数?还有在单信号多通道转换的时候 CSTARTADDx的值是不是按设置的初值后,转换完一个通道的值后就自加,为第二个转换做准备?

万安文 发表于 2012-4-17 12:39:09

zhoufly 发表于 2012-4-17 12:21 static/image/common/back.gif
单纯仿真是不能近中断的的吧,要有目标板的

我把开发板插上以后还是不能进入中断,这到底怎么回事呢,是软件问题还是得要设置什么呢?

万安文 发表于 2012-4-17 12:52:13

zhoufly 发表于 2012-4-17 12:44 static/image/common/back.gif
driver设置为FET Debugge?

总终端允许 _EINT(); 加没?


driver设置为FET Debugge时就没法进入仿真界面了,上面的是TI提供的例程,中断啥都设置好了,就是在仿真的时候进不去中断服务函数

万安文 发表于 2012-4-17 22:05:08

zhoufly 发表于 2012-4-17 13:59 static/image/common/back.gif
连目标板,
给目标板供电
烧写程序,在线仿真


谢谢你的帮忙,不过我按照你的建议做了,结果还是一样
页: [1]
查看完整版本: 求助:有关IAR仿真430时中断函数进不去的问题