close

在PIC32中若要得正確的pb_clk,除了要先填適當的congig bit之外,在程式中亦需執行下列function

// Configure the device for maximum performance but do not change the PBDIV
// Given the options, this function will change the flash wait states, RAM
// wait state and enable prefetch cache but will not change the PBDIV.
// The PBDIV value is already set via the pragma FPBDIV option above..
 SYSTEMConfig(SYS_FREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE);
or
 SYSTEMConfig(SYS_FEEQ, SYS_CFG_ALL);
or
 SYSTEMConfigPerformance(SYS_FEEQ);
 
 否則peripheral的clk將會錯誤
 
 ex:
 #define SYS_FEEQ 80000000L
 
 int pb_clk;
 pb_clk=SYSTEMConfig(SYS_FEEQ, SYS_CFG_ALL);

全站熱搜
創作者介紹
創作者 iamqq 的頭像
iamqq

iAmqq

iamqq 發表在 痞客邦 留言(0) 人氣()