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


Browsing this Thread:   1 Anonymous Users






Re: 想通过__builtin_函数改变dsPIC33里面的const常量值,下列方式可以吗(附简单程序)
#6
版主
版主


查看用戶資訊
參照:

jldxlwx 寫道:
View菜单里能看到Porgram Memory,我在ICD2 DEBUG下面看FLASH内容,也是不对的!但用AN1095就OK,看来好好研究下AN1095是正解,谢谢!


View 菜單所看到的 Program Memory 不見得就是片上的 Program Memory。如果有做 Flash Modification 後一定要用手動的方式更新 View 底下的 Program Memory 顯示。

發表於: 2009/6/24 9:31
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 想通过__builtin_函数改变dsPIC33里面的const常量值,下列方式可以吗(附简单程序)
#5
新會員
新會員


查看用戶資訊
View菜单里能看到Porgram Memory,我在ICD2 DEBUG下面看FLASH内容,也是不对的!但用AN1095就OK,看来好好研究下AN1095是正解,谢谢!

發表於: 2009/6/24 2:37
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 想通过__builtin_函数改变dsPIC33里面的const常量值,下列方式可以吗(附简单程序)
#4
版主
版主


查看用戶資訊
仿真時是修改片上的 Flash 的,而 LPLAB IDE 下的 Program Window 是不會被修改到的,要看到被修改過的 Flash 內容就須將片上的東西讀回 MPLAB IDE 。所以請用 ICD2 下的 Read Target Device 的圖示讀回後顯示。

發表於: 2009/6/23 15:06
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 想通过__builtin_函数改变dsPIC33里面的const常量值,下列方式可以吗(附简单程序)
#3
新會員
新會員


查看用戶資訊
_WritePM:
mov W0,W2
mov W1,W3
mov #tblpage(_c_f),w0
mov w0,TBLPAG
mov #tbloffset(_c_f),w0

TBLWTL W2,[W0]
TBLWTH W3,[W0++]
MOV #0x4003,W0
MOV W0,NVMCON
PUSH SR
MOV #0x00E0,W0
IOR SR
mov #0x55,W0
mov W0, NVMKEY
mov #0xAA, W0
mov W0, NVMKEY
bset NVMCON, #15
nop
nop
btsc NVMCON, #15
bra $-2
pop SR
return
使用以上代码,用W0、W1来传递两个字参数,来写FLASH中的24位,在仿真时结果不正确,代码是参照FRM中Section 5 "FLASH Programming"中的示例代码,对一个WORD的FLASH区域进行编程。对于这部分有用AN1095中的代码进行操作仿真正确,不得其解,谢谢帮助!

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


Re: 想通过__builtin_函数改变dsPIC33里面的const常量值,下列方式可以吗(附简单程序)
#2
版主
版主


查看用戶資訊
要修改 Flash Memory 是要透過 builtin Function 來取得 Talbe-Page & Table-Offset 的,此外還要使用 in-line assembly 的語法來做 Table Write 及 NVMKEY Register 的解鎖步驟。還有 Flash 一次就是一個區塊的清除,要寫入前就必須對寫入的區塊作 Block Erase 的動作。建議你看一下 dsPIC33F Family Reference Guide 裡的 Flash Memory Section.

底下是 dsPIC30F 的 EEPROM 的教育訓練課程,可以先砍一下,方法與dsPIC33F 的 Flash 類似:
http://www.microchip.com.tw/modules/w ... glefile.php?cid=4&lid=229

AN1094 Bootloader 可以參考一下是怎樣改 Flash 的:
http://www.microchip.com/stellent/idc ... eId=1824&appnote=en533154
http://www.microchip.com/stellent/idc ... eId=1824&appnote=en530200

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


想通过__builtin_函数改变dsPIC33里面的const常量值,下列方式可以吗(附简单程序)
#1
新會員
新會員


查看用戶資訊
想通过__builtin_函数改变dsPIC33里面的const常量值,下列方式可以吗(附简单程序)??

typedef union
{
float fl;
uint16 x[2];
}un_fl;

char str_tmp[10];

const un_fl adcK = {3.14};
un_fl adcK_t = {5.24};

int main()
{
uint16 lowWord,highWord;
int tbloffset;
un_fl adcK_tmp;
adcK_tmp = adcK;
adcK_tmp.fl = 5.42;
TBLPAG = __builtin_tblpage(&adcK);
tbloffset = __builtin_tbloffset(&adcK);
lowWord = __builtin_tblrdl(tbloffset);
highWord = __builtin_tblrdl(tbloffset+2);
//__builtin_write_NVM();
printf("%.2f\n",adcK.fl);

TBLPAG = __builtin_tblpage(&adcK);
tbloffset = __builtin_tbloffset(&adcK);
__builtin_tblwtl(tbloffset,adcK_t.x[0]);
__builtin_tblwtl(tbloffset+2,adcK_t.x[1]);
printf("%.2f\n",adcK.fl);

while(1);
return 0;
}

發表於: 2009/6/18 21: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... ]

教育訓練中心

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