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


Browsing this Thread:   1 Anonymous Users






請問於PICC16 V9.6該如何自定RAM位址?
#1
資深會員
資深會員


查看用戶資訊
大家好:
如題,個人使用16f914想將變數的RAM address,
定於BANK0 之0x71及0x72,不知該如何設定,
煩請指教,Thanks.

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


Re: 請問於PICC16 V9.6該如何自定RAM位址?
#2
資深會員
資深會員


查看用戶資訊
大家好:
RAM的定址已解決=>
volatile unsigned char eeprom_addr @ 0x71;

但現在又有一個問題,如何將RAM的位址設給FSR呢?
嘗試中...
Thanks.

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


Re: 請問於PICC16 V9.6該如何自定RAM位址?
#3
版主
版主


查看用戶資訊
FSR=@eeprom_addr;

如果夠狠的話 : FSR = 0x71;

發表於: 2008/6/2 15:58
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問於PICC16 V9.6該如何自定RAM位址?
#4
資深會員
資深會員


查看用戶資訊
大家好:
感謝版主回答,But這行FSR=@eeprom_addr;會有錯誤=>
Error [195] D:\Test\MCU\PIC\HTC_16C\TS_914C\MAIN.C; 71.5 expression syntax

不知是何原因?
再麻煩了!
Thanks.

發表於: 2008/6/2 16:43
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問於PICC16 V9.6該如何自定RAM位址?
#5
版主
版主


查看用戶資訊
抱歉! 打錯字了。應該是用 & 才能抓到位址。
FSR=& eeprom_addr;

發表於: 2008/6/2 17:54
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問於PICC16 V9.6該如何自定RAM位址?
#6
資深會員
資深會員


查看用戶資訊
大家好:
很抱歉,版主又要麻煩你了!
1.在main()之前=>
volatile unsigned char eeprom_addr @ 0x71;

2.在main()中=>
unsigned char* j;
...
FSR=&eeprom_addr;

3.Compiler顯示警告=>
Warning [358] D:\Test\MCU\PIC\HTC_16C\TS_914C\MAIN.C; 72.17 illegal conversion of pointer to integer
不知是什麼原因?

4.當然在main()中=>
unsigned char eeprom_addr;
unsigned char* j;
j=&eeprom_addr;
是OK的.

能否幫忙代為解說呢?
Thank you very much.

發表於: 2008/6/3 8:12
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問於PICC16 V9.6該如何自定RAM位址?
#7
版主
版主


查看用戶資訊
參照:
Warning [358] D:\Test\MCU\PIC\HTC_16C\TS_914C\MAIN.C; 72.17 illegal conversion of pointer to integer
不知是什麼原因?

會出現這種錯誤是: FSR 不是 C 所宣告指標,所以會有型態上的錯誤。只要在 Hi-Tech PICC 使用指標形態變數基本上只要指向 RAM 的指標就會使用 FSR。所以寫C 的時候不要直接動 FSR否則會發生指標錯誤的Bug。

參照:
unsigned char eeprom_addr;
unsigned char* j;
j=&eeprom_addr;

這是正確的寫法。


發表於: 2008/6/3 8:36
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問於PICC16 V9.6該如何自定RAM位址?
#8
資深會員
資深會員


查看用戶資訊
大家好:
謝謝版主,又有一個MPLAB V8.2顯示的問題?=>
unsigned char* j;
我是定義unsigned char應該是8位元吧!
在Watch視窗為何是顯示16位元呢?
Address | Symbol Name | Value | Hex
042 j 0x0143 0x0143
煩請解說.Thanks.

我有試個應該沒有關係,只是顯示上的小錯誤!


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


Re: 請問於PICC16 V9.6該如何自定RAM位址?
#9
版主
版主


查看用戶資訊
j 是指標變數,不是指標所指到的 unsigned char 資料,又指標為512Byte的大小所以就會用16-bit 的資料格式 (只使用 9-bit而已)。

發表於: 2008/6/3 17:02
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問於PICC16 V9.6該如何自定RAM位址?
#10
資深會員
資深會員


查看用戶資訊
大家好:
謝謝版主.
由File Register的視窗來看是真的有問題!
假設 j 的位址是在0x43,而另一由compiler
自行定義的變數位址是0x44,
又設0x43的內容為0x00而0x44的內容為0x01,
那麼於Watch的視視窗則顯示 j 的內容為0x0100,
這樣的話當0x44的內容有更動,是否會影響到0x43
的內容呢(9-bit)?

煩請指教.Thanks.

發表於: 2008/6/4 9: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... ]

教育訓練中心

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