OFIFG fault when using DCO in MSP430

The OFIFG flag always set in my recent MSP430 smoke device project. In this A sample hardware, there is no external LFXT1CLK low-frequency/high-frequency oscillator, also there is no XT2CLK. It uses the internal digitally controlled oscillator (DCO). Therefore, the OSCOFF shall be disabled before checking OFIFG flag. The example code is shown below.

   //disable the OSC
   __bis_SR_register(OSCOFF);

  // wait until clock stabilizes
  do
  {
    IFG1 &= ~OFIFG;
    __delay_cycles(50);
  } while(IFG1 & OFIFG);

Using __bic_SR_register(OSCOFF); to enable the OSCOFF.

猜你喜欢

转载自www.cnblogs.com/zjbfvfv/p/10303024.html