此为TI官网例程,msp430f2618 DCO外接电阻(ROSC)设置频率,用IAR编译,430仿真器JTAG口下载仿真,单步调试到标志处(如下代码黄 {MOD}背景)处程序跑飞,不能继续,实在不明白为什么,求高手知道。
(代码说明中下滑线处说这可能影响到JTAG重新建立链接的能力,不知问题是否在此,应如何解决?)
//******************************************************************************
// MSP430F26x Demo - DCOCLK Biased with External Resistor Rosc
//
// Description: Use external resistor on P2.5 as DCO current source. DCOCLK
// is used by default as the MCLK source and this is buffered on P5.4.
// Mainloop drives a 10 cycle software loop toggling P1.1. Measure DCOCLK/10
// on P1.1. Example also disables XTAL buffer. Use of external resistor reduces
// temperature sensitivity of DCOCLK.
// NOTE: With no resistor conencted, the oscillator will stop. Also, in this
// case,
the ability of re-establishing JTAG connectivity may be affected.
//
// DCOCLK Frequency using DCO = 3 and RSEL = 4 values @ 3V
// R=100K -> ~2MHz (See device datasheet)
//
// MSP430F261x/241x
// -----------------
// /| /|| XIN|-
// | | | |
// R --|RST XOUT|-
// | | |
// -------|P2.5/ROSC P1.1|-->DCOCLK/10
// | P5.4/MCLK|-->MCLK = DCOCLK
//
// B. Nisarga
// Texas Instruments Inc.
// September 2007
// Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.42A
//******************************************************************************
#include "msp430x26x.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x02; // P1.1 = output direction
BCSCTL2 |= DCOR; // Rosc
BCSCTL1 &= ~(RSEL1 + RSEL0); // RSEL = 4
P5DIR |= 0x010; // P5.4= output direction
P5SEL |= 0x010; // P5.4= MCLK option select
__bis_SR_register(OSCOFF); // XTAL not used
while(1) // 10 MCLK (= DCOCLK) cycle loop
{
P1OUT |= 0x02;
P1OUT &= ~0x02;
}
}
file:///C:UserssunchyAppDataRoamingTencentUsers493807864QQWinTempRichOleV~H_11WVHN{GRQ2%C5MYA0K.jpg
此帖出自
小平头技术问答
一周热门 更多>