- //系统初始化
- void InitSys(void)
- {
- if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)
- {
- while(1); // If calibration constants erased (调试时,总陷入这一句)
- // do not load, trap CPU!!
- }
- //12Mhz
- BCSCTL1 = CALBC1_12MHZ; // Set range
- DCOCTL = CALDCO_12MHZ; // Set DCO step + modulation*/
- }
复制代码板子是MSP430.LaunchPad,用的是MSP430G2553芯片,在调试的时候,发现总陷入while(1)死循环里,已经是第二个芯片成这样了,我借了我同学的G2553芯片试试,发现可以跳过死循环,程序是没问题,那么是不是芯片有问题呢?MSP430芯片不会这么脆弱的吧?
遇到这样的情况,应该怎么办呢?
此帖出自
小平头技术问答
- //******************************************************************************
- // MSP430G2xx3 Demo - Basic Clock, Output Buffered clocks with preloaded DCO
- // calibration constants for BCSCTL1 and DCOCTL.
- //
- // Description: Buffer ACLK on P2.0, default SMCLK(DCO) on P1.4 and MCLK/10 on
- // P1.1. DCO is software selectable to 1, 8, 12, or 16Mhz using calibration
- // contstants in INFOA.
- //
- // ACLK = LFXT1 = 32768, MCLK = SMCLK = Selectable at 1, 8, 12 or 16Mhz
- // //* External watch crystal installed on XIN XOUT is required for ACLK *//
- //
- // MSP430G2xx3
- // -----------------
- // /|| XIN|-
- // | | | 32kHz
- // --|RST XOUT|-
- // | |
- // | P1.4/SMCLK|-->SMCLK = Default DCO
- // | P1.1|-->MCLK/10 = DCO/10
- // | P1.0/ACLK|-->ACLK = 32kHz
- //
- // D. Dang
- // Texas Instruments Inc.
- // December 2010
- // Built with IAR Embedded Workbench Version: 3.42A
- //******************************************************************************
- #include
- void main(void)
- {
- WDTCTL = WDTPW +WDTHOLD; // Stop Watchdog Timer
- if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)
- {
- while(1); // If calibration constants erased
- // do not load, trap CPU!!
- }
- //1Mhz
- BCSCTL1 = CALBC1_1MHZ; // Set range
- DCOCTL = CALDCO_1MHZ; // Set DCO step + modulation */
- /* //8Mhz
- BCSCTL1 = CALBC1_8MHZ; // Set range
- DCOCTL = CALDCO_8MHZ; // Set DCO step + modulation */
- /* //12Mhz
- BCSCTL1 = CALBC1_12MHZ; // Set range
- DCOCTL = CALDCO_12MHZ; // Set DCO step + modulation*/
- /* //16Mhz
- BCSCTL1 = CALBC1_16MHZ; // Set range
- DCOCTL = CALDCO_16MHZ; // Set DCO step + modulation*/
- P1DIR |= 0x13; // P1.0,1 and P1.4 outputs
- P1SEL |= 0x11; // P1.0,4 ACLK, SMCLK output
- while(1)
- {
- P1OUT |= 0x02; // P1.1 = 1
- P1OUT &= ~0x02; // P1.1 = 0
- }
- }
复制代码这是官方例程代码如何判断稳定与不稳定呢?
#include
void main(void)
{
WDTCTL = WDTPW +WDTHOLD; // Stop Watchdog Timer
if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)
{
while(1); // If calibration constants erased
// do not load, trap CPU!!
}
//1Mhz
BCSCTL1 = CALBC1_1MHZ; // Set range
DCOCTL = CALDCO_1MHZ; // Set DCO step + modulation */
这一段好像都注释掉了
一周热门 更多>