本文主要是介绍Atmel SAM4 PMC,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.设置引脚Mode
ioport_set_pin_mode(PIO_PA17_IDX,IOPORT_MODE_MUX_B);//把PA17复用为PCK1
ioport_disable_pin(PIO_PA17_IDX);
ioport_set_pin_mode(PIO_PA18_IDX,IOPORT_MODE_MUX_B);//把PA18复用为PCK2
ioport_disable_pin(PIO_PA18_IDX);
2.设置PMC,使能输出
2.1寄存器
PMC->PMC_PCK[1] |= PMC_PCK_CSS_MCK | PMC_PCK_PRES_CLK_32;
PMC->PMC_IER |= PMC_IER_PCKRDY1;
PMC->PMC_SCER |= PMC_SCER_PCK1;
PMC->PMC_PCK[2] |= PMC_PCK_CSS_SLOW_CLK ;
PMC->PMC_IER |= PMC_IER_PCKRDY2;
PMC->PMC_SCER |= PMC_SCER_PCK2;
2.2 库函数
pmc_switch_pck_to_pllack(1,PMC_PCK_PRES_CLK_32);
pmc_enable_pck(1);
pmc_switch_pck_to_sclk(2,PMC_PCK_PRES_CLK_1);
pmc_enable_pck(2);
这篇关于Atmel SAM4 PMC的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!