• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: 請問關於Configuration Bits的設定
#5
版主
版主


查看用戶資訊
參照:

wei0510 寫道:
找到相關資料了,Microchip有提供一份文件PIC18 Configuration Settings Addendum,裡面有各個PIC18 IC可以設定的Configuration Bits列表,只要在程式中利用假指令#pragma config應該就能達到上述的功能了。

不過PIC18 Configuration Settings Addendum文件中沒有我使用的IC(PIC18F65J50),我在CPU DIV的地方有點疑問:

PIC18F65J50的文件中圖示CPU system clock divide分為1、2、3、6

因為PIC18 Configuration Settings Addendum沒有PIC18F65J50這個IC,所以我參考別顆IC的CPUDIV選項,能除頻選項卻是2、3、4、6

請問這樣子要怎麼辦?


沒有 PIC18F65J50 的設定? 那就是你所使用的 C18 Compiler 是舊版本,重新下載新版的 compiler 就有支援了。

參考資料在 C:\MCC18\doc\hlpPIC18ConfigSet.htm

範例程式:
--------------------    MPLAB C18   ----------------------------------------

;*******************************************************************************
;*
3.For MPLAB C18 V2.40 or higher, use #pragma config directive                       *
;*for example                                                                     *    
//******************************************************************************
    #include <p18f452.h>
//*******************************************************************************
//*Configuration settings may be specified with multiple #pragma config directives.          *
//*MPLAB C18 verifies that the configuration settings specified are valid for the processor*
//*for which it is compiling                                                                                *            
//*The labels following the directive "pragma config" are defined in the P18F452.h file.    *
//*******************************************************************************
    #pragma config    OSC=HS
    #pragma config     PWRT=ON
    #pragma config     BOR=OFF, BORV=42
    #pragma config     WDT=OFF
    #pragma config      CCP2MUX=ON
    #pragma config      STVR=OFF, LVP=OFF, DEBUG=OFF
    #pragma config      CPD=OFF
    
void main(void)
{
//your code
}

發表於: 2010/2/8 13:27
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問關於Configuration Bits的設定
#4
高級會員
高級會員


查看用戶資訊
前幾天上完W401課程後這個問題已經解決了:

在MPLAB IDE介面中的HELP->Topics->PIC18 Config Setting中,只要選擇你使用的IC型號,裡面會詳細記載它所能設定的Configuration Bits項目及選項,接著只要在程式中以指令#pragma config編寫,就會包含在hex檔中了。

在不同點腦上燒錄這個hex檔時,只要先開啟Configure->Configuration Bits,把Configuration Bits set in code.這個選項打勾,燒錄時就會以hex檔內的設定為準。

一些小地方提供大家做參考

發表於: 2010/2/8 12:19
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問關於Configuration Bits的設定
#3
資深會員
資深會員


查看用戶資訊
試試 MPLAB 的 File->export 功能。

發表於: 2010/2/2 16:39
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問關於Configuration Bits的設定
#2
高級會員
高級會員


查看用戶資訊
找到相關資料了,Microchip有提供一份文件PIC18 Configuration Settings Addendum,裡面有各個PIC18 IC可以設定的Configuration Bits列表,只要在程式中利用假指令#pragma config應該就能達到上述的功能了。

不過PIC18 Configuration Settings Addendum文件中沒有我使用的IC(PIC18F65J50),我在CPU DIV的地方有點疑問:

PIC18F65J50的文件中圖示CPU system clock divide分為1、2、3、6

因為PIC18 Configuration Settings Addendum沒有PIC18F65J50這個IC,所以我參考別顆IC的CPUDIV選項,能除頻選項卻是2、3、4、6

請問這樣子要怎麼辦?

發表於: 2010/2/2 15:51
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請問關於Configuration Bits的設定
#1
高級會員
高級會員


查看用戶資訊
我最近使用C18完成了一個程式,並將HEX檔傳給朋友請他幫忙驗證,結果發現他將HEX檔寫入至手邊的IC後,執行起來速度慢了一倍。

經過一段時間的查驗,我發現是因為我們兩個在MPLAB IDE的Configuration Bits選項不同的關係,我在設計、編寫時,開啟HS+PLL及CPU DIV 2,而他收到HEX檔後在他的電腦上進行燒錄時,卻採用了沒有開啟PLL及CPU DIV的預設設定,後來我請他把Configuration Bits選項設定的與我相同,他的執行速度就正常了。

經過這次事件我發現了HEX檔並不包含這些設定,這些設定是在"燒錄時"才會被寫入IC中。

請問除了每次燒錄前與他確認Configuration Bits的設定以外,有沒有更簡便的方法,可以將Configuration Bits的內容直接包含在HEX檔中呢?

發表於: 2010/2/2 14:49
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------