enable clock switch會卡在迴圈中
|
||||
---|---|---|---|---|
中級會員
|
各位先進好
我在MCC中設定系統參數時 使用primary clock 若enable PLL 但沒設定clock switch的話 會顯示warning 但若enable clock switch 執行程式時則會卡在while (oscconbits.oswen = 0) 請問是哪裡沒設定到嗎 感謝
發表於: 2020/12/5 22:44
|
|||
|
Re: enable clock switch會卡在迴圈中
|
||||
---|---|---|---|---|
版主
|
1. 請問是使用哪一顆 PIC ?
2. 是使用軟體模擬嗎? 在模擬下這些震盪穩定位元是不會變成 1 的,必須使用硬體的開發工具來驗證。
發表於: 2020/12/7 14:33
|
|||
|
Re: enable clock switch會卡在迴圈中
|
||||
---|---|---|---|---|
管理員
|
while (oscconbits.oswen = 0)
修正成 while (OSCCONbits.OSWEN != 0); 在測試一次程式。
發表於: 2020/12/9 14:18
|
|||
|
Re: enable clock switch會卡在迴圈中
|
||||
---|---|---|---|---|
管理員
|
CLKDIV = 0x3000;
OSCTUN = 0x00; REFOCON = 0x00; PLLFBD = 0x26; ACLKCON3 = 0xA4C1; ACLKDIV3 = 0x07; PMD1 = 0x00; PMD2 = 0x00; PMD3 = 0x00; PMD4 = 0x00; PMD5 = 0x00; PMD6 = 0x00; PMD7 = 0x00; __builtin_write_OSCCONH((uint8_t) (0x03)); __builtin_write_OSCCONL((uint8_t) (0x01)); while (OSCCONbits.OSWEN != 0); while (OSCCONbits.LOCK != 1); 這是我用de33EP256MU806的clock設定 透過MCC 設定 Generate ,讓你交互比對看看 如果方便,你可以貼上你的程式碼,這樣比較好找出問題
發表於: 2020/12/9 14:35
|
|||
|
Re: enable clock switch會卡在迴圈中
|
||||
---|---|---|---|---|
版主
|
=0 是指定運算,要用==0 的判斷式才對。
發表於: 2020/12/10 9:25
|
|||
|