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


Browsing this Thread:   1 Anonymous Users






Re: 關於WriteUSART
#5
版主
版主


查看用戶資訊
PIC18 的 Bootloader 要不要參考一下 AN851 Application Note :
http://www.microchip.com/stellent/idc ... eId=1824&appnote=en012031

還有 C18 v2.40 以後的版本在 Configuration Setting 上有很大的改變,請參考一下 C18 目錄下的說明檔:..\MCC18\doc\hlpPIC18ConfigSet.html

參考範例如下:
;*******************************************************************************
;*
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

發表於: 2009/1/21 14:17
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於WriteUSART
#4
初級會員
初級會員


查看用戶資訊
Hi各位
我發現問題了
因為table write 把ReadUSART Code erase掉
所以 接下來就收不到任何data了
感謝各位的幫忙

發表於: 2009/1/20 23:50
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於WriteUSART
#3
初級會員
初級會員


查看用戶資訊
Hi 版主:
It's OK!謝謝.
現在遇到另外一個問題
我使用tableWrite 從0x00~0x6FFF
前面一直OK
但是 再寫到位址0x5E00時就發生PIC不回應命令的狀況
觀察 0x5E00這邊的code 主要是做Timer的控制
============================
TMR1H=0; // Clear out timer registers
TMR1L=0;
PIR1bits.TMR1IF=0;

if(config&0x80) // Enable interrupts if selected

PIE1bits.TMR1IE=1;
else
PIE1bits.TMR1IE=0;
===============================
我已經把不能 flash的code 搬往0x07000後
所以 應該不會有code over write 的狀況
請問,有任何建議嗎?
我是懷疑是不是CONFIG BIT是PROTECT MODE
但是 看起來又不像,列於其下
===============================
const rom unsigned char CONFIG1L=0xff ; /
const rom unsigned char CONFIG1H=0b00100010 ;
const rom unsigned char CONFIG2L=0b00000001 ;
const rom unsigned char CONFIG2H=0b00000000 ;
const rom unsigned char CONFIG3L=0xff ; /
const rom unsigned char CONFIG3H=0b10000000 ;
const rom unsigned char CONFIG4L=0b10000001 ;
const rom unsigned char CONFIG4H=0xff ; /
const rom unsigned char CONFIG5L=0b00001111 ;
const rom unsigned char CONFIG5H=0b11000000 ;
const rom unsigned char CONFIG6L=0b00001111 ;
const rom unsigned char CONFIG6H=0b11100000 ;
const rom unsigned char CONFIG7L=0b00001111 ;
const rom unsigned char CONFIG7H=0b01000000 ;
===================================
有任何建議嗎??
感謝 您的幫忙

發表於: 2009/1/20 2:09
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於WriteUSART
#2
版主
版主


查看用戶資訊
#progma code 的正確語法為 :

#pragma code [section-name [=address]]
section-name可以在連結描述檔中加以指定該段程式 編譯後的執行位址 (18c452.lkr)
也可以直接指定該段程式的執行位址
#pragma code My_Code_On = 0x1000


所以在指定位址前要加入一個節區名稱,而這節區名稱不要重複。
例:
#pragma code abc=0x7000

發表於: 2009/1/19 9:39
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


關於WriteUSART
#1
初級會員
初級會員


查看用戶資訊
版主您好
最近在做Boot loader tableflash練習
遇到一個問題請指教
在做tablewrite時data 是從USART收的
不過因為在write flash的過程中
會overwrite WriteUSART的code,導致program 不預期中斷
試過
將 C:\mcc18\src\pmc_common\USART\uwrite.c
並強制設定 位址
#pragma code 0x7000
void WriteUSART(char data)
{
if(TXSTAbits.TX9) // 9-bit mode?
{
TXSTAbits.TX9D = 0; // Set the TX9D bit according to the
if(USART_Status.TX_NINE) // USART Tx 9th bit in status reg
TXSTAbits.TX9D = 1;
}

TXREG = data; // Write the data byte to the USART
}
#pragma code
add 到pic's project
但是位置並無法如我想要的
有什麼方法可以處裡嗎??是不是compiler 還是去抓舊的呢??
可以像C018i.c的作法 將linker 檔中的obj path mark自己新增asource code 到project嗎??
請幫忙!!
Thanks

發表於: 2009/1/19 1:22
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... ]

教育訓練中心

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