• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::


Browsing this Thread:   1 Anonymous Users






Re: C30 VARIABLE TO BE PLACED IN PROGRAM MEMORY
#4
版主
版主


查看用戶資訊
當你用了 const 的宣告其資料會擺放在 ROM 裡,因為 PIC24 & dsPIC 有提供 PSV 映射功能所以可以像讀 RAM 的方式ㄧ樣來讀取 ROM 資料。建議你先將 PSV 的功能先了解一下,你可以參考 dsPIC30F Perioheral Module 裡的 EEPROM 那裡有詳細的 PSV 說明與練習。

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


Re: C30 VARIABLE TO BE PLACED IN PROGRAM MEMORY
#3
新會員
新會員


查看用戶資訊
sir:

針對data 放在ram 是這樣寫,但存在ROM 好像不是,user guide 有如下說明

The MPLAB C30 compiler does not directly support accessing variables in
program space. Variables so allocated must be explicitly accessed by the
programmer, usually using table-access inline assembly instructions, or
using the program space visibility window

但我不知如何coding

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


Re: C30 VARIABLE TO BE PLACED IN PROGRAM MEMORY
#2
版主
版主


查看用戶資訊
陣列長度是你自己指定的長度大小你是知道的,ANSI C 有計算字串長度的函數。

"陣列每個位置資料" 這是最基本的陣列使用: my_const_array[0] 就會指到第一個資料的位址,my_const_array[9] 就會只到最後的資料。此外也可以用指標方式:

const char *ptr;

ptr=my_const_array; 將 ROM 的陣列起始位址傳給ㄧ指向 ROM 得指標
data = * ptr++;

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


C30 VARIABLE TO BE PLACED IN PROGRAM MEMORY
#1
新會員
新會員


查看用戶資訊
請問16bit MCU,若陣列資料存在program memory,如下

const __attribute__((space(auto_psv)))
char my_const_array[10] = "Help";

語法如何宣告將此my_const_array陣列指標傳至另一函數

及如何取出此陣列長度和陣列每個位置資料?

發表於: 2008/9/26 11:02
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... ]

教育訓練中心

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