选择不了外部时钟
请先检查硬件,比如外部时钟是否起振
程序请参考:
unsigned char i = 0;
/*--------------------------------------------------
- Change on-chip oscillator clock to Main clock -
---------------------------------------------------*/
prc0 = 1; /* Protect off */
cm13 = 1; /* Xin Xout */
cm15 = 1; /* XIN-XOUT drive capacity select bit : HIGH */
cm05 = 0; /* Xin on */
cm16 = 0; /* Main clock = No division mode */
cm17 = 0;
cm06 = 0; /* CM16 and CM17 enable */
while (i <= 100) /* This setting is an example of waiting time for the */
i++; /* oscillation stabilization. Please evaluate the time */
/* for oscillation stabilization by a user. */
ocd2 = 0; /* Main clock change */
prc0 = 0; /* Protect on */