This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F28335例程PLL配置问题

Other Parts Discussed in Thread: CONTROLSUITE

小弟在学习F28335,对controlSUITE中Example_2833xEPwmTimerInt例程Dsp2833x_SysCtrl.c 配置PLL里边的一段代码不是很明白,请教一下各位。

代码如下:

void InitPll(Uint16 val, Uint16 divsel)
{
   // Make sure the PLL is not running in limp mode
   if (SysCtrlRegs.PLLSTS.bit.MCLKSTS != 0)
   {
      // Missing external clock has been detected
      // Replace this line with a call to an appropriate
      // SystemShutdown(); function.
      asm("        ESTOP0");
   }

   if (SysCtrlRegs.PLLSTS.bit.DIVSEL != 0) 
   {
       EALLOW;
       SysCtrlRegs.PLLSTS.bit.DIVSEL = 0;
       EDIS;
   }

   // Change the PLLCR
   if (SysCtrlRegs.PLLCR.bit.DIV != val) //疑问,这里 val 是不是0?以前学习的C语言全部还给老师了,汗
   {

      EALLOW;
      // Before setting PLLCR turn off missing clock detect logic
      SysCtrlRegs.PLLSTS.bit.MCLKOFF = 1;
      SysCtrlRegs.PLLCR.bit.DIV = val;
      EDIS;
      DisableDog();

      while(SysCtrlRegs.PLLSTS.bit.PLLLOCKS != 1)
      {
	      // Uncomment to service the watchdog
          // ServiceDog();
      }

      EALLOW;
      SysCtrlRegs.PLLSTS.bit.MCLKOFF = 0;
      EDIS;
    }

	if((divsel == 1)||(divsel == 2))
	{
		EALLOW;
	    SysCtrlRegs.PLLSTS.bit.DIVSEL = divsel;
	    EDIS;
	}
	if(divsel == 3)
	{
		EALLOW;
	    SysCtrlRegs.PLLSTS.bit.DIVSEL = 2;
	    DELAY_US(50L);
	    SysCtrlRegs.PLLSTS.bit.DIVSEL = 3;
	    EDIS;
    }
}

代码里边的val是不是0,以前学习C语言的时候,int val; 这应该是一个不确定的值,一般会这样 int val=0;

这里没有赋值为0,是为什么呢?

x 出现错误。请重试或与管理员联系。