请问有使用S12G128的小伙伴吗?
当然可以,配合相应寄存器使用即可
If XOSCLCP is disabled (OSCE=0) f(REF )= f(IRC1M)
If PLL has locked (LOCK=1) f(VCO) = 2 × f (REF) × (SYNdiv+1 )
If PLL is locked (LOCK=1) f (PLL )=f(VCO)/( POSTdiv +1)
If PLL is selected (PLLSEL=1) f(bus) = f(PLL) /2
void INIT_PLL(void)
{
CPMUPROT=0x26; //解除时钟配置保护
CPMUOSC_OSCE=0; //禁止外部晶振
//while(CPMUOSC_OSCPINS_EN==0); //等待外部晶振使能
CPMUCLKS &=(~0x40);
CPMUCLKS |= 0x80; //设置PLLCLK为系统时钟
//PLLCLK=2×OSCCLK×(SYNdiv+1)/(REFdiv+1), fbus=PLLCLK/2
CPMUSYNR=0x0F; //SYNdiv的值为1,
CPMUREFdiv = 0x00; //REFdiv的值为1
CPMUPOSTdiv=0x00;
CPMUPLL=0x10;
while(CPMUFLG_LOCK==0); //等待PLLCLK锁定
CPMUPROT=0x00; //使能时钟配置保护
}