Re: 請問組態設定要怎麼寫?
|
||||
---|---|---|---|---|
資深會員
|
收到了
謝囉 建議可以把這一篇config.txt放到討論區的精華區裡 或是範例程式裡 這樣大家要找比較方便 我在一般的書中都沒看到該如何寫組態設定 規格書中有寫各位元的代表意義 但沒有說明有這種寫法...
發表於: 2005/4/13 12:07
|
|||
|
Re: 請問組態設定要怎麼寫?
|
||||
---|---|---|---|---|
版主
|
Jubel,
已經用 e-mail 傳過去了,內容包含 Configuration setting & Internal EEPROM.
發表於: 2005/4/13 11:15
|
|||
|
Re: 請問組態設定要怎麼寫?
|
||||
---|---|---|---|---|
資深會員
|
版主
請問你放了嗎? 我都找不到 ~_~"
發表於: 2005/4/13 9:05
|
|||
|
Re: 請問組態設定要怎麼寫?
|
||||
---|---|---|---|---|
版主
|
下午會把它放在右邊的範例程式裡。
發表於: 2005/4/11 9:47
|
|||
|
Re: 請問組態設定要怎麼寫?
|
||||
---|---|---|---|---|
資深會員
|
發表於: 2005/4/11 9:39
|
|||
|
Re: 請問組態設定要怎麼寫?
|
||||
---|---|---|---|---|
高級會員
|
__CONFIG _CP_OFF & _WDT_ON & _BODEN_ON
& _PWRTE_ON & _RC_OSC 利用__CONFIG來定義 , 而"&"來連結不同的設定 下面的定義字可以在INC檔中找到 , 每一個PIC都有些許的差別 ;==================================; ; Configuration Bits ;==================================; _BODEN_ON EQU H'3FFF' _BODEN_OFF EQU H'3FBF' _CP_ALL EQU H'00CF' _CP_75 EQU H'15DF' _CP_50 EQU H'2AEF' _CP_OFF EQU H'3FFF' _PWRTE_OFF EQU H'3FFF' _PWRTE_ON EQU H'3FF7' _WDT_ON EQU H'3FFF' _WDT_OFF EQU H'3FFB' _LP_OSC EQU H'3FFC' _XT_OSC EQU H'3FFD' _HS_OSC EQU H'3FFE' _RC_OSC EQU H'3FFF'
發表於: 2005/4/8 9:18
|
|||
|
Re: 請問組態設定要怎麼寫?
|
||||
---|---|---|---|---|
資深會員
|
板主辛苦了
這麼晚了還來回答問題 剛剛忘了說明 我是用組合語言的 所以那些好像不適合^^" 嗯...程式編譯完成後 如果程式碼裡有寫到組態設定就以程式為主 那還是直接寫到程式裡比較保險...
發表於: 2005/4/8 0:47
|
|||
|
Re: 請問組態設定要怎麼寫?
|
||||
---|---|---|---|---|
管理員
|
請問是 C18 嗎 ? 若是的話就看看下面的說明啦 :
MPLAB C18 V2.40 and newer 把下面的選項加在程式的開頭 . 注意 !! 您可能有更多選項要指定. 詳細的選項說明請下在以下的 C18 Addendum : ( DS51537A) http://ww1.microchip.com/downloads/en ... onfig_Settengs_51537a.pdf #pragma config OSC = HS #pragma config WDT = OFF #pragma config LVP = OFF MPLAB C18 V2.40 以前版本 : 將以下片段加入程式中. 當然, 各暫存器的值要依照需要而修改 #pragma romdata CONFIG const rom unsigned char CONFIG1L=0xff ; // Don't care byte const rom unsigned char CONFIG1H=0b00100010 ; // Disable OSC switch , XXXXX010 = HS const rom unsigned char CONFIG2L=0b00000001 ; // Disable PWRT , Disable BOR const rom unsigned char CONFIG2H=0b00000000 ; // Disable WDT timer const rom unsigned char CONFIG3L=0xff ; // Don't care byte const rom unsigned char CONFIG3H=0b00000000 ; // XXXXXXX0 = CCP2 --> RB3 const rom unsigned char CONFIG4L=0b00000001 ; // 0XXXXXXX Backgroung Debug Enable const rom unsigned char CONFIG4H=0xff ; // Don't care byte const rom unsigned char CONFIG5L=0b00001111 ; // Not PROG code protected const rom unsigned char CONFIG5H=0b11000000 ; // Not EEPROM code protected const rom unsigned char CONFIG6L=0b00001111 ; const rom unsigned char CONFIG6H=0b11100000 ; const rom unsigned char CONFIG7L=0b00001111 ; const rom unsigned char CONFIG7H=0b01000000 ; #pragma romdata 最後 , 程式中宣告的項目會在每次 Compiler 成功後重新載入 Configuration Bytes. 所以他是比手動設定更優先的. Best Regards,
發表於: 2005/4/8 0:42
|
|||
|
請問組態設定要怎麼寫?
|
||||
---|---|---|---|---|
資深會員
|
我平常都是用ICD2燒錄程式
改組態都到MPLAB的選單裡去改 我想把程式碼鎖住讓人無法讀出 請問在程式中要如何直接用寫的設定組態呢? 因為我怕要是忘了改MPLAB裡的設定 到時候程式碼都沒鎖就會被讀出了 直接寫在程式裡就不怕忘了改設定了... 另外還有一個問題 我把組態設定寫到程式裡後 mPLAB裡的設定跟程式裡寫的設定若不同 到時燒錄是依據哪個為主?
發表於: 2005/4/8 0:27
|
|||
|