• 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: PSV功能疑惑
#2
版主
版主


查看用戶資訊
底下是一個利用PSV讀取 EEPROM 的例子參考看看

const char _EEDATA(1sine_table[ ] = {128,152,176,198,217,233,245,252,255,252 
                                   
,245,233,217,198,176,152,128,102,78,56,37,21
                                       
,9,2,0,2,9,21,37,56,78,102};

CORCONbits.PSV 1;                  // 起用 PSV 功能
PSVPAG 0xFF;                    // 設定 PSVPAG 指向 EEPROM 的區域
while(1)
    {
        if (
Index 31Index=0;    
        
Sine_temp[I] = (sine_table[Index]); //讀取 EEPROM
        
Index ++;
        if (
I>255) while (1);        // 讀取完畢 ?
        
++;
    }

發表於: 2006/4/11 11:04
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PSV功能疑惑
#1
初級會員
初級會員


查看用戶資訊
看过PSV的介绍后,我有些疑问。
1 PSV功能是否只是在用组合语言写程序时候会方便一些(不用查表指令了。)如果在C语言里面PSV 还有价值吗?

2 PSV功能跟查表指令相比有哪些优势?

3 在C下面如何启动PSV的功能?

我测试发现如果把程序写成
const unsigned char __attribute__((space(auto_psv))) table[]={"hello world"};
unsigned char tempreg;
const unsigned char *str;
这样可以使用 指针的方式给 tempreg 赋值。

如果改成((space(psv)))这个参数,我发现指针地址没有问题但是通过指针方式已经无法把table 里面的数据再送跟tempreg了。

我看参考手册上说,使用psv 这个参数后就不能在使用普通C的方式来读取表格数据了。

这两个参数最大不同在什么方面?如果我要用psv的参数定义表格后该如何在C下读出?



發表於: 2006/4/11 7:15
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... ]

教育訓練中心

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