• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   2 Anonymous Users






Re: 為什麼TBLRD*指令在C18中不能用嵌入式組語?
#4
版主
版主


查看用戶資訊
1. 那是在程式裡所宣告的 struct or union,須把整的 USB bootloader 的 Project 打開後去 Search
2. 不敢確定有沒有 Read 函數,要找一下。
3. 沒辦法,這是 In-Line Assembly 的限制。你可以用 C call Assembly 的方式來處理。不要用傳參數的方式,採用 Global Variable 的方式與C共用變數或陣列。

發表於: 2008/3/26 9:07
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 為什麼TBLRD*指令在C18中不能用嵌入式組語?
#3
資深會員
資深會員


查看用戶資訊
1.請問dataPacket.ADR.low這個變數是??
我看過flash的datasheet好像沒有類似的暫存器
不知道是那來的??

2.又除了write之外,可有read的函式可供參考?

3.又所謂的tblrd的基本型是指不加任何*或+-符號嗎?
因為我看datasheet說明最少都有加一個*,不知道不加任何
符號有意義嗎?

發表於: 2008/3/25 22:31
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 為什麼TBLRD*指令在C18中不能用嵌入式組語?
#2
管理員
管理員


查看用戶資訊
Hi 你好,

TBLRD 指令在 MPLAB C18 的嵌入式組合言只能用基本型. 如果要用 C 的話可以參考以下寫法 : ( 取自 Microchip USB bootloader 中 boot.c 的片段 , 若 Install 了 Microchip USB F/W 後可以在 c:\MCHPFSUSB\fw\boot\system\usb\class\boot 找到 :)


void WriteProgMem(void//TESTED: Passed
{
    
/*
     * The write holding register for the 18F4550 family is
     * actually 32-byte. The code below only tries to write
     * 16-byte because the GUI program only sends out 16-byte
     * at a time.
     * This limitation will be fixed in the future version.
     */
    
dataPacket.ADR.low &= 0b11110000;  //Force 16-byte boundary
    
EECON1 0b10000100;        //Setup writes: EEPGD=1,WREN=1

    //LEN = # of byte to write

    
for (counter 0counter < (dataPacket.len); counter++)
    {
        *((
dataPacket.ADR.pAdr)+counter) = 
        
dataPacket.data[counter];
        if ((
counter 0b00001111) == 0b00001111)
        {
            
StartWrite();
        }
//end if
    
}//end for
}//end WriteProgMem

發表於: 2008/3/25 18:05
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


為什麼TBLRD*指令在C18中不能用嵌入式組語?
#1
資深會員
資深會員


查看用戶資訊

我試著想把FLASH的讀寫寫成C語言函式

發現TBLRD 和TBLWT這兩個指令無法相對應

試著用
_ASM
TBLRD*
_ENDASM

compile就會出現錯誤
改成 TBLRD又沒問題,但組語好像沒有這種用法
只要TBLRD後面加上有+或*的都不行

不知道大家都怎麼處理C語言寫FLASH內呢

發表於: 2008/3/24 23:50
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... ]

教育訓練中心

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