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


Browsing this Thread:   1 Anonymous Users






Re: 請教各位前輩C18要如何宣告才能共用同一塊記憶體空間
#2
版主
版主


查看用戶資訊
這要看 p18f4520.asm 裡對 T4CON & T4CONbits 的位址設定。
你的宣告當然會使用兩個記憶體,如要共用要加上 union 的宣告。參考 W401 C18 教育訓練課程的第四章說明。

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


請教各位前輩C18要如何宣告才能共用同一塊記憶體空間
#1
新會員
新會員


查看用戶資訊
請教各位前輩一下:

小弟目前在用C18寫程式,IC使用18F6520
請問要如何宣告才可以做到以下的功能

下面程式我從18F6520.H引用的
extern volatile near unsigned char T4CON;
extern volatile near struct {
unsigned T4CKPS0:1;
unsigned T4CKPS1:1;
unsigned TMR4ON:1;
unsigned T4OUTPS0:1;
unsigned T4OUTPS1:1;
unsigned T4OUTPS2:1;
unsigned T4OUTPS3:1;
} T4CONbits;

我可以對T4CON寫入一個8BIT的資料,也可只對T4CONbits.TMR4ON的位元作改變

為什麼我做以下的宣告組譯後會變成二個不同的記憶體位址
unsigned char LCDBUFA;
struct {
unsigned FANL:1;
unsigned FANM:1;
unsigned FANH:1;
unsigned MDEF:1;
unsigned MHEAT:1;
unsigned MFAN:1;
unsigned MCOOL:1;
unsigned MAUTO:1;
} LCDBUFAbits

發表於: 2009/2/24 15:58
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... ]

教育訓練中心

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